PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Problems compiling FFTW libraries
Goto page 1, 2  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
slaton



Joined: 11 Oct 2004
Posts: 7

PostPosted: Mon Nov 01, 2004 10:21 pm    Post subject: Problems compiling FFTW libraries Reply with quote

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:

Code:
-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.
Back to top
View user's profile
slaton



Joined: 11 Oct 2004
Posts: 7

PostPosted: Mon Nov 01, 2004 11:03 pm    Post subject: Reply with quote

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:

Code:
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.
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5952
Location: The Portland Group Inc.

PostPosted: Tue Nov 02, 2004 3:00 pm    Post subject: Reply with quote

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
Back to top
View user's profile
slaton



Joined: 11 Oct 2004
Posts: 7

PostPosted: Thu Nov 04, 2004 3:34 pm    Post subject: Reply with quote

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.

Code:
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:

Code:
./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.
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5952
Location: The Portland Group Inc.

PostPosted: Thu Nov 04, 2004 5:28 pm    Post subject: Reply with quote

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
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group