PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

linking to FFTW
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
peterp



Joined: 16 Apr 2005
Posts: 11

PostPosted: Sat Apr 16, 2005 7:19 pm    Post subject: linking to FFTW Reply with quote

Hello all,

I'm trying to link to FFTW...as you can see below, no luck :-(

What am I doing wrong ?

Thanks,
Peter

master-83 peterp>: pgf90 -o burg burg.f90 -L/usr/local/lib -lfftw -lrfftw
/tmp/pgf90caaaanbfaa.o(.text+0xe3): In function `nonlinearity_pseudospectral_':
: undefined reference to `rfftwnd_f77_create_plan_'
/tmp/pgf90caaaanbfaa.o(.text+0x101): In function `nonlinearity_pseudospectral_':
: undefined reference to `rfftwnd_f77_create_plan_'
/tmp/pgf90caaaanbfaa.o(.text+0x680): In function `nonlinearity_pseudospectral_':
: undefined reference to `rfftwnd_f77_one_complex_to_real_'
/tmp/pgf90caaaanbfaa.o(.text+0x698): In function `nonlinearity_pseudospectral_':
: undefined reference to `rfftwnd_f77_one_complex_to_real_'
/tmp/pgf90caaaanbfaa.o(.text+0x736): In function `nonlinearity_pseudospectral_':
: undefined reference to `rfftwnd_f77_one_real_to_complex_'
master-84 peterp>:
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Apr 18, 2005 8:07 am    Post subject: Reply with quote

Hi Peter,

Your FFTW library was probablly built using g77. Fortran compilers place underscores after function names to avoid namespace conflicts with C. g77 uses two underscores while pgf90 and pgf77 use one. Compiling with "-Msecond_underscore" tells pgf90 to use the g77 convension of two underscores. You may also need to add "-g77libs" in order to link with the g77 runtime libraries.

Hope this helps!
Mat
Back to top
View user's profile
peterp



Joined: 16 Apr 2005
Posts: 11

PostPosted: Mon Apr 18, 2005 9:54 am    Post subject: Reply with quote

Thanks Mat...actually I think fftw was compiled with pgf90 -Msecond_underscore ! I got that code to compile.

Now here's a kicker: mpich has been compiled with one underscore while fftw with two.
(This is all Microway's doing !) And I have a code which makes mpi calls in subroutines
that also call fftw...so if I put in -Msecond_underscore then I get mpi errors...if I don't put
-Msecond_underscore I get fftw errors...

Is there any hope for this mathematician ?

Best,
Peter


mkcolg wrote:
Hi Peter,

Your FFTW library was probablly built using g77. Fortran compilers place underscores after function names to avoid namespace conflicts with C. g77 uses two underscores while pgf90 and pgf77 use one. Compiling with "-Msecond_underscore" tells pgf90 to use the g77 convension of two underscores. You may also need to add "-g77libs" in order to link with the g77 runtime libraries.

Hope this helps!
Mat
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Apr 18, 2005 10:34 am    Post subject: Reply with quote

Hi Peter,

If there isn't a lot of calls to the FFTW library, change your source and append the FFTW function names with an underscore. ie change "CALL foo" to "CALL foo_". Not the best solution, it would better if you could recompile the FFTW library, but would work as a quick hack.

- Mat
Back to top
View user's profile
peterp



Joined: 16 Apr 2005
Posts: 11

PostPosted: Mon Apr 18, 2005 12:01 pm    Post subject: Reply with quote

>Not the best solution, it would better if you could recompile the FFTW library, but would
>work as a quick hack.

unfortunatelly, one of the fftw rouines is "rfftwnd_f77_one_complex_to_real" which
is 31 chars long...appending the underscore brings it to 32 and the compiler truncates it
to 31 (bombs...)...there is no way to enable longer names ? If not I'll tell our people to
recompile fftw with one underscore...

Thanks,
Peter
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