Forum: Ruby Python for Fortran Programmers

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A87f7a014c624587fab0d3d78c5b9c18?d=identicon&s=25 Bil Kleb (Guest)
on 2006-02-17 11:35
(Received via mailing list)
It was neat to see Ruby naturally appear under this
thread recently on news:comp.lang.fortran

  http://tinyurl.com/c8vtf
Fcc5cdf0f0f3e1a3a39c11ed4bf8d5e5?d=identicon&s=25 Stephan Mueller (Guest)
on 2006-02-17 16:11
(Received via mailing list)
* Bil Kleb <Bil.Kleb@NASA.gov> [060217 11:32]:
> It was neat to see Ruby naturally appear under this
> thread recently on news:comp.lang.fortran

I think Ruby is getting quite popular in SC now. Btw: Is there something
like f2py for ruby?

I guess one have to use swig instead to get a binding for a fortran lib.
But there seems to be no english tutorial on the web. Any hints?


Cheers,

Steph.

PS: Bil, sorry for the PM.
Cb48ca5059faf7409a5ab3745a964696?d=identicon&s=25 unknown (Guest)
on 2006-02-17 16:23
(Received via mailing list)
On Sat, 18 Feb 2006, Stephan Mueller wrote:

>
> Cheers,
>
> Steph.
>
> PS: Bil, sorry for the PM.

better still - ruby/dl can call into fortan libs directory : no binding
required.  i think this only works with f77 code though...

check this out

   http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/...

regards.

-a
Bb6ecee0238ef2461bef3416722b35c5?d=identicon&s=25 pat eyler (Guest)
on 2006-02-17 17:11
(Received via mailing list)
On 2/17/06, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
> > But there seems to be no english tutorial on the web. Any hints?
> >
> >
> > Cheers,
> >
> > Steph.
> >
> > PS: Bil, sorry for the PM.
>
> better still - ruby/dl can call into fortan libs directory : no binding
> required.  i think this only works with f77 code though...


If there are any fortran gurus out here, I've long thought that a
RubyInline::Fortan would be a nice thing to see.

-pate
Fcc5cdf0f0f3e1a3a39c11ed4bf8d5e5?d=identicon&s=25 Stephan Mueller (Guest)
on 2006-02-18 19:08
(Received via mailing list)
* ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> [060217 16:22]:

> better still - ruby/dl can call into fortan libs directory : no binding
> required.  i think this only works with f77 code though...

I guess you are right. Tried it with gfortran and all I get is a
segfault. Setting the -f2c compiler flag does not help either.

Maybe C is still the language of choice when it comes to exending ruby?


Cheers,

Steph.
Fcc5cdf0f0f3e1a3a39c11ed4bf8d5e5?d=identicon&s=25 Stephan Mueller (Guest)
on 2006-02-18 23:11
(Received via mailing list)
* Stephan Mueller <d454d@web.de> [060218 18:52]:

> I guess you are right. Tried it with gfortran and all I get is a
> segfault.

Ooops, this seems to be a problem with the way I pass over parameters
from ruby to the lib. Will have to double check this. Simple functions
without parameters do work.

Sorry for the noise.


Cheers,

- Steph.
3cb4fdcf13aad6a7dcae83876b0e784e?d=identicon&s=25 Josef 'Jupp' SCHUGT (Guest)
on 2006-02-18 23:20
(Received via mailing list)
Hi!

At Sat, 18 Feb 2006 00:22:56 +0900, ara.t.howard@noaa.gov wrote:

> better still - ruby/dl can call into fortan libs directory : no
> binding required.  i think this only works with f77 code though...

Many people actually do not need Fortran 90+ support. What they need
is support for huge FORTRAN 77 code bases that consist of millions of
code-lines and are the result of man-millenia of coding and debugging.
Even if one would hire *all* people of adequate numerical mathematics
skills that can program it would most probably take years to re-write
and sufficently test all that code in another language. And quite a
number of these people would not give up their research no matter what
you pay them.

Josef 'Jupp' Schugt
F690ec04b0501b74b033fc64ff4f682b?d=identicon&s=25 Dean Wampler (Guest)
on 2006-02-19 00:15
(Received via mailing list)
Fortran compilers pass arguments in the opposite order compared to C
and C++. I believe this is a "standard" and if I recall correctly,
it's because C/C++ support variable argument lists ("varargs"), while
Fortran doesn't; C passes the list in reverse order so it's easy to
mark both ends of the lists. ("Layman's" description ;) )

dean

On 2/18/06, Stephan Mueller <d454d@web.de> wrote:
>
>
> Cheers,
>
> - Steph.
>
>


--
Dean Wampler
http://www.aspectprogramming.com
http://www.newaspects.com
http://www.contract4j.org
4fea1ef11180adaaa299d503ca6010d0?d=identicon&s=25 John W. Kennedy (Guest)
on 2006-02-19 00:54
(Received via mailing list)
Dean Wampler wrote:
> Fortran compilers pass arguments in the opposite order compared to C
> and C++.

Certain Fortran compilers on certain operating systems on certain
architectures do so.
Fcc5cdf0f0f3e1a3a39c11ed4bf8d5e5?d=identicon&s=25 Stephan Mueller (Guest)
on 2006-02-19 17:12
(Received via mailing list)
* Stephan Mueller <d454d@web.de> [060218 23:06]:

> > I guess you are right. Tried it with gfortran and all I get is a
> > segfault.

Got it working now with Ruby 1.8.4 and gfortran-4.0. Thumbs up and
thanks
for the help!


Steph.
A87f7a014c624587fab0d3d78c5b9c18?d=identicon&s=25 Bil Kleb (Guest)
on 2006-02-21 17:49
(Received via mailing list)
Stephan Mueller wrote:
> Got it working now with Ruby 1.8.4 and gfortran-4.0. Thumbs up and thanks
> for the help!

Steph, can you post an example somewhere?

Thanks,
Fcc5cdf0f0f3e1a3a39c11ed4bf8d5e5?d=identicon&s=25 Stephan Mueller (Guest)
on 2006-02-23 23:10
(Received via mailing list)
* Bil Kleb <Bil.Kleb@NASA.gov> [060221 17:48]:
> Stephan Mueller wrote:
> >Got it working now with Ruby 1.8.4 and gfortran-4.0. Thumbs up and thanks
> >for the help!
>
> Steph, can you post an example somewhere?

Sure. Sorry for the delay. The link from Ara shows all you need. Compile
your fortran file with

gfortran --f2c --free-form -shared -O2 FILE.f -o LIB.so -fPIC

testet on Debian unstable with

ruby 1.8.4 (2005-12-24) [i486-linux]
GNU Fortran 95 (GCC 4.0.3 20060212 (prerelease) (Debian 4.0.2-9))

evil.rb seems to be neccessary only in case you have output parameters
and arrays on the fortran side of life. :)


Cheers,

Steph.
5a837592409354297424994e8d62f722?d=identicon&s=25 Ryan Davis (Guest)
on 2006-02-24 00:17
(Received via mailing list)
On Feb 17, 2006, at 8:09 AM, pat eyler wrote:

> If there are any fortran gurus out here, I've long thought that a
> RubyInline::Fortan would be a nice thing to see.

I'm willing to help with this, but I don't know squat about fortran
(and honestly, don't want to). However, getting it working for
RubyInline would be a very cool feat and I can finally get some my
friend at LBLL to maybe start using ruby. :)
Bb6ecee0238ef2461bef3416722b35c5?d=identicon&s=25 pat eyler (Guest)
on 2006-02-24 05:35
(Received via mailing list)
On 2/23/06, Ryan Davis <ryand-ruby@zenspider.com> wrote:
>
> On Feb 17, 2006, at 8:09 AM, pat eyler wrote:
>
> > If there are any fortran gurus out here, I've long thought that a
> > RubyInline::Fortan would be a nice thing to see.
>
> I'm willing to help with this, but I don't know squat about fortran
> (and honestly, don't want to). However, getting it working for
> RubyInline would be a very cool feat and I can finally get some my
> friend at LBLL to maybe start using ruby. :)


Just to pull things together, I created

http://www.rubygarden.org/ruby?RubyFortran
This topic is locked and can not be replied to.