Can g95 be used as a 64 bit compiler

I am trying to compile some physics code in 64 bit mode (on a dual 2.7 GHz G5). I have purchased the absoft 9.2 Pro compiler, but it fails the numerical tests for the code I am using (abinit) in 32 bit mode. Much to my surprise fink's g95 compiles the code fine (in 32 bit mode), but the fink installation seems not to work in 64 bit mode (32 bit libraries only). Does anyone know if g95 will work with 64 bits? I have tried Apples gfortran and while it does claim to work in 64 bit mode, it fails with an internal compiler error on the source code (the version seems to be older than the fink g95).

Two questions:

1. Can I get g95 to compile in 64 bit mode somehow (download, build from source etc.)?

2. I understand from reading (old?) comments on hpc.sourceforge.net that there are two version of fortran 95 under the gnu project -- what is the true story here (after all g95 (www.g95.org) works and gfortran (Apple) doesn't on my source code).

Thanks for any help.

Posted on Aug 19, 2005 1:44 AM

Reply
16 replies

Aug 21, 2005 6:40 PM in response to Paul Fons

Since writing the first message, I have downloaded the g95 source from www.g95.org and built my own special 64 bit version (I just compiled the libraries for 64 bit mode). This works fine and compiles my code without error and passes the included floating point tests for the physics program. Interestingly enough gfortran (the other gnu fortran compiler failed with internal errors - dead in the water here).

Reiterating. In 32-bit mode the Absoft pro fortran compiler 9.2 has problems with the included tests (it builds OK). This is something I am still working on. The company seems to want to help so I hope we find the cause of these problems. There also seems to be some instability (memory exceptions with the version I did build). The 64 bit version is then only a step away.

Aug 21, 2005 7:48 PM in response to Bill Scott

Are you the W.G. Scott from fink? In any case, I wrote fink's Jeff Whitaker and he said he hadn't realized the capability was there (although he does now). The thing is that the compiler code generated (by g95 at least -- and probably by g77 as well) can be 64 bit (as of gcc 4). The snafu with the fink versions is that the dynamic/static libraries are only built as 32 bit objects so you die when you link. All I had to do to get g95 to handle 64 bit code was to recompile the runtime library with 64 bit. If I put a little more time into it, I bet I could use Apples lipo tool to build a "fat" library with both 32 and 64 bit code in it that the linker would resolve automatically.

Aug 21, 2005 10:04 PM in response to Paul Fons

Yeah, but I'm not from fink (I'm not part of the core group -- I'm not competent to be). I maintain a few biophysics-type packages. I think that a decision was made in fink somewhere along the line that all packages should compile on all OS X G4 and G5 machines.

The g77 is 3.4.3; as you know, there is no longer a g77 in 4.0. Unfortunately, the programs I maintain that are fortran-based run significantly faster when compiled by g77 than g95 or gfortran, and thankfully g77 plays well with gcc4.0.

Aug 21, 2005 10:21 PM in response to Bill Scott

Greetings from a fellow hacker (almost certainly not enough skill to get into the core fink group), but someone willing to get their hands dirty compiling things more complicated than I can understand from source. I didn't realize that g77 support has stopped with gcc 4.0. This seems like a rather strange decision. There seems to be a fair amount of activity regarding g95. Unless I misunderstood (entirely possible), the g95 code has been donated to gnu for integration with the gfortran code, the latter of which generated better optimized code or so it said on the hpc.sourceforge.net page (by someone who was working on the gfortran project).
I would love to get the code I am working with now (abinit from www.abinit.org) running under absoft, but it would seem that the floating point checks included with the abinit code fail -- sometimes... There are over a 1000 source files of f90 and I suspect it will take a while to track down the cause. In the meantime, I really need to use the code so I am glad that the f95 compiler worked! My full time job is as a materials scientist here at a national laboratory in Japan... and hence running ab-initio simulations is acceptable work, but fooling endlessly with compilers would probably be frowned upon...
In any case, good luck. I do XAFS (x-ray absorption) and some crystallography as well and I am grateful for your contributions to fink (I think I even sent you an email way back when).

Oct 20, 2005 9:50 AM in response to Paul Fons

I'm having trouble downloading the g95 source- keeps dying after only a few k. If anyone is willing to put their old g95 source up on a website for a day, I'd like to download it and try it out.

We're having issues with Absoft and Apple. When I try to statically allocate more than 4 GB of RAM, I get a Bus Error.

I would be interested to know if anyone can get this to run with g95...
program test_memory
IMPLICIT NONE
INTEGER NMAX
PARAMETER(NMAX=600)
DOUBLE PRECISION U(NMAX,NMAX,NMAX)
INTEGER i,j,k,n,nh,iter

open(unit=12,file='U.dat')
n=NMAX
nh=n/2
do iter=1,10
do k=1,n
do j=1,n
do i=1,n
U(i,j,k)=dble(i)
enddo
enddo
enddo
enddo
c Write out a sample of the data
do i=1,n
write(12,*)U(i,nh,nh)
enddo
STOP
END

According to Absoft...
--------------------------------
The reason for the runtime failure is actually an issue with the Apple
development environment which we have reported to Apple but which has
not yet been resolved. The example code below basically does the same
thing as your example, but it is written in C and uses only Apple
components to build. The code just creates a large memory space, then
accesses it. The result is a segmentation fault:

// Compile as gcc -m64 large cblock.c to see the crash
#define N 15000
#define N2 N*N

struct one {
double a[N2];
double b[N2];
double c[N2];
} large_block;

int main()
{
double x,y,z;
x = large_block.a[0];
y = large_block.b[0];
z = large_block.c[0];
return 0;
}

I'm afraid that there is really no workaround I can offer at the present
time.
-----------------------------------

Now it has been shown we can dynamically allocate more than 4 GB of RAM, but given all of our various codes, it would be prohibitive to reprogram everything as opposed to switching our crunching to amds.

The g95 binary from www.g95.org yields this error when compiling the above fortran code...
ld64 failed: library not found for -lf95
I'm assuming that this means I need to compile and install g95 from source for the appropriate 64-bit libraries?

Thanks for any help anyone can give.
Fuzzy

Oct 20, 2005 10:13 AM in response to Bill Scott

Thanks Bill- got it.
I wasn't sure whether it was possible to build g95 without rebuilding the whole of gcc- seems like the actual g95 download is much smaller. Regardless I'll play with it and learn something.

As for the hardware 4GB limit, that would too bad to hear. I suppose the marriage of 32-bit & 64-bit could never be perfect- just wish I would have known that upfront.

Thanks,
Fuzzy

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Can g95 be used as a 64 bit compiler

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.