linking to FFTW

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

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

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


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

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

Hi Peter,

Unfortunately, Fortran limits names to 31 characters so you’ll need to have the library rebuilt.

-Mat