When I compiled a program using “-L $PGI/linux86/5.2/liblf”, I have a different (and wrong) answer. I also saw the same thing when I compiled the program on Opteron. How do I get around this problem.
What happens when you compile with “-Mlfs” instead of “-L$PGI/linux86/5.2/liblf”?
It gave the same problem. One more note, I have the same problem with Intel 7.1 compiler.
In fortran, the only thing -Mlfs (aka “-L$PGI/linux86/5.2/liblf”) provides is the ability to use 64-bit file addressing in 32-bit environments. Large file support is also available for C but you need to call different functions. I can not think of any simple reason why your program is getting wrong answers. I would suspect since it also fails with ifc 7.1 that it might be something in your program or your system environment.
Can you provide a small example which exhibits this behavior?
Unfortunately, I don’t have any small example. My model is quite a big 3-d hydrodynamic model, CH3D. I have been using this for a long time. I ran this code on SGI, HP, alpha station, even on PC. I only saw this problem on Linux workstations. Currently, it works with -Kieee switch using 5.2 on my workstation with 4 Xeon processors (but number of processors shouldn’t matter because this is a serial version). Interestingly, “-pc 64” and “-Mlfs” option gives different answers but not drifting away.
Sounds like it might be more of an issue of the x87 80-bit double precision floating point representation rather than large file support. When using “-Kieee” and/or “-pc 64” your telling the compiler that you want the 64-bit representation. I believe SGI, HP, and Alpha all use the 64-bits.
What happens is the compiler will try and keep values in the 80-bit floating point registers since this makes for more efficiant code. However, this can lead to different answers since your using a more precise representation, especially for very small numbers. Once the value is stored into memory, then it is truncated to 64-bit.
Since your running on a P4, I would suggest using the SSE registers instead of the x87 registers since they use a 64-bit representation. (They are actually 128-bits but perform two 64-bit operations). To use SSE, specify the flag “-Mscalarsse” on the command line. You can then add additional optimizations, such as “-fast” or “-fastsse” which includes “-Mscalarsse” to help increase perfromance.
Hope this helps,
So far, I have seen problems with 64 bit library. I got the same wrong answers when I compiled on Xeon workstation using -Mlfs option and when I compiled on Opteron workstation (/usr/pgi/linux-64/5.1 is the directory). Without any option switches, I got expected results (meaning similar to the results from alpha workstation and SGI workstation as well as Cray) on my Xeon workstation (I am using v.5.2).
I still like to use my Opteron workstation (or -Mlfs switch on my Xeon workstation) because sometimes I like to deal with file size > 2 GB. Can anyone think of the reason why I have these problems?