Problems compiling FFTW libraries

Hi,

I’m compiling a large F90 application that uses the FFTW libraries for some operations.

http://www.fftw.org

I’m using the current trial version of PGI Workstation 5.2 for x864-64 on a dual Opteron system.

Currently the application segfaults when it accesses the FFTW functions. But if I compile a version using native FFT routines instead of FFTW, it works OK (just slower…).

I’m compiling FFTW with pgcc/pgCC and pgf90, using these compiler flags:

-tp k8-64 -O3 -fastsse

Usually the F90 application is linked to shared FFTW libraries. But, i notice that while i am using the “–enable-shared” option to configure FFTW, no shared libs are being built.

So i checked the pgi manpages and tried adding the flag “-shared” or “-shared -fPIC” to my CFLAGS/FFLAGS. With these options, the FFTW configure script aborts immediately, as the sample program it tests the compiler with segfaults on execution. The test program is just a one-line void function.

Any suggestions would be appreciated. I’ve removed the optimization flags, but there is no change. This is my first forray into x86-64 architecture, have compiled the same software before on Xeon with PGI 5.1 compilers and had no problems, although i was mixing gcc and pgf90 if i recall correctly, for compiling FFTW.

Replying to my own post… :)

I looked more carefully through the configure output for FFTW, for the case of using no “-shared” or “-fPIC” options, but selecting the “–enable-shared” option:

checking if libtool supports shared libraries... no

That explains why i’m not getting shared libraries.

I did some googling of libtool and pgcc, but am not getting anywhere. Is there a way to build an automake-oriented package without libtool? Alternatively, could I reconfigure or update my libtool so that it supports shared libraries? Or do i have this totally wrong?

I am running the x86-64 release of Taolinux, which is itself a free rebuild of RHEL3. The libtool included is version 1.4.3-6.

Hi slaton,


I downloaded FFTW and was able to build it using “-tp k8-64 -O3 -fastsse” on an AMD64 running SuSE91. The included basic tests all passed so I was not able to recreate your seg fault. Of course this doesn’t mean much since these are just simple tests and do not test the Fortran interface.

If possible, I’d like you try and isolate where the seg fault is occuring. The evaluation copy of the compilers also come with the PGI debugger, pgdbg, which should help.

Also try compiling without optimization (-O0) to see if one of the compiler optimizations is to blame. If -O0 works, start adding back optimization to see which flag is causing the problem. Another possiblity is that its a 64-bit porting problem. Try compiling with “-tp k8-32” to see if a 32-bit executable works.

As for building a shared library with libtool, I personally don’t know a lot about libtool so wont be much help here. Hopefully another user can help out.

  • Mat

Hi,

Thanks for the reply.
Here are my results for compiling FFTW, this time with no optimization. I must use pgf90 instead of pgf77 because the application i am later linking FFTW libs to is F90.

setenv F90 pgf90
setenv FC pgf90
setenv F77 pgf90
setenv FFLAGS "-tp k8-64"
setenv CFLAGS "-tp k8-64"
setenv CXXFLAGS "-tp k8-64"
./configure --prefix=/usr/local/fftw/pgi --enable-threads --enable-float --enable-type-prefix
make
make check

make check crashes with a stack overflow during the following test:

./rfftw_threads_test 10 -x 100 -r 0
This test will run for 100 iterations.
Please wait (while X11 grows by another kilobyte).
Testing correctness for n = 1584...OK
Testing nd correctness for size = 54x81...specific...force buf...OK
Testing correctness for n = 1521...OK
Testing nd correctness for size = 6x2x8x3...OK
Testing correctness for n = 600...**ERROR: in routine alloca() there is a
stack overflow: thread 0, max 10228KB, used 2KB, request 48B
make[2]: *** [rfftw_threads_test-check] Error 1
make[2]: Leaving directory `/usr/local/src/fftw/fftw-2.1.5/threads'
make[1]: *** [check] Error 1
make[1]: Leaving directory `/usr/local/src/fftw/fftw-2.1.5/threads'
make: *** [check-recursive] Error 1

If i use gcc/g++ instead of pgcc/pgCC, but still pgf90 for the backend Fortran, all “make check” tests complete properly. For gcc I used only the “-m64” flag.

According to -V flag my pgi compilers are version 5.2-4.

Different compilers can use different amounts of stack space. In this case, pgcc is most likely using more stack than you have allocated. What happens when you set your stack size to unlimited? (‘unlimit’ in csh)

I compiled and ran again using the options you gave (I added CC=pgcc). All the tests passed as before. However, when I run make check, it runs a series of tests using “tools/bench”, but no test called “rfftw_threads_test” is performed. Which version of FFTW are you using? I downloaded 3.0.1 which is the latest stable release.

  • Mat

Sorry – MPI parallel transforms are still only available in 2.1.5, so that is the version MPI-enabled parallel programs need to use. Do you have any problems with the tests for 2.1.5? Thanks.

OK…setting the stacksize to unlimited does cause the “make check” tests to complete. Thank you.

However my application that uses FFTW still segfaults when it calls an FFTW routine. Not immediately, but after grinding away for perhaps 45 seconds.

I guess i will have to build with debug flags and get my feet wet with pgdbg.

OK…what the software vendor supports is the use of the FFTW shared library, not the static library. So as I mentioned previously, I’m currently using pgcc/pgCC/pgf90 to compile FFTW v2.1.5. When I use the --enable-shared autoconf option for FFTW, I see from config.log that this is not working:

checking whether the linker (/usr/bin/ld) supports shared libraries
result: yes
checking if libtool supports shared libraries
result: no
checking whether to build shared libraries
result: no

I tried removing “-mcmodel=medium” and adding -fPIC, with no change in the behavior.

I switched to gcc/g++/pgf90, using just “-m64 -O2” as CFLAGS and CXXFLAGS. Now the shared libraries DO get built. From config.log:

checking whether the linker (/usr/bin/ld) supports shared libraries
result: yes
checking if libtool supports shared libraries
result: yes
checking whether to build shared libraries
result: yes

Is this a known pgcc/pgCC issue with libtool? The only reference I’ve seen to this referred to not using -fPIC and -mcmodel together, mentioned in another post by mkcolg.

Has anyone been able to build FFTW3 with the --enable-sse option??
This causes the gcc inline assembly instruction asm to be used which
kills pgcc.

gas