amirgholami / accfft

A Massively Parallel FFT Library for CPU/GPU
http://accfft.org
GNU General Public License v2.0
54 stars 18 forks source link

Compile issue #9

Closed novatig closed 7 years ago

novatig commented 7 years ago

Hello,

I ran cmake without problems as:

cmake -DFFTW_ROOT=$FFTW_BUILD -DFFTW_INCLUDE_DIR=$FFTW_INC -DFFTW_USE_STATIC_LIBS=false -DBUILD_GPU=false -DCXX_FLAGS=“-O3” -DBUILD_SHARED=true -DMPI_C_LIBRARIES=$MPI_LIB -DMPI_CXX_LIBRARIES=$MPI_LIB -DMPI_C_INCLUDE_PATH=$MPI_INC -DMPI_CXX_INCLUDE_PATH=$MPI_INC -DMPI_CXX_COMPILER=${MPI_BIN}/mpicxx -DMPI_C_COMPILER=${MPI_BIN}/mpicc --warn-uninitialized -DBUILD_STEPS=false ..

The problem is that make fails. I get through most targets and then fails on step1, step2, step3, step4 and step5. Error is: ../../libaccfft.so: undefined reference to fftwf_plan_many_dft_r2c' ../../libaccfft.so: undefined reference tofftwf_execute_dft' ../../libaccfft.so: undefined reference to fftwf_execute_dft_r2c' ../../libaccfft.so: undefined reference tofftwf_plan_many_dft' ../../libaccfft.so: undefined reference to fftwf_execute_dft_c2r' ../../libaccfft.so: undefined reference tofftwf_plan_many_dft_c2r' ../../libaccfft.so: undefined reference to fftwf_destroy_plan' ../../libaccfft.so: undefined reference tofftwf_plan_guru_dft'

Note that it is trying to get the single precision functions. On the other hand, if I try to build step1f, step2f and so on, I get no error.

FFTW was compiled both in single and double precision.

EDIT: problem was fixed with -DBUILD_SHARED=false But this lead me to an other issue when linking CXX executable step1f: libfftw3_threads.a(libfftw3_threads_la-threads.o): In function fftw_threads_register_planner_hooks': threads.c:(.text+0x5f4): undefined reference tofftw_set_planner_hooks'

Thanks in advance.

amirgholami commented 7 years ago

Hi,

Can you please try the following and send the output log file:

make clean make VERBOSE=2

novatig commented 7 years ago

Hi, Thanks for the reply. This is the output:

accfft_make_verbose.out.txt

CMakeOutput.log.txt

amirgholami commented 7 years ago

So when building with -DBUILD_SHARED=true, you should check that FFTW single precision libraries are in your LD_LIBRARY_PATH. Is that the case?

For -DBUILD_SHARED=false, you seem to be getting an error regarding the threaded version of FFTW. Did you compile FFTW with --enable-threads option?

novatig commented 7 years ago

Hi, Yes, sure, the fftw lib folder is in the LD_LIBRARY_PATH and it contains fftw-3.3.5 compiled in both single and double precision, with threads, openmp, and mpi.

amirgholami commented 7 years ago

I have made a minor change to the CMakeList of step1. Can you please pull the latest version and try with & without the static build and let me know if you get any error?

e-ago commented 7 years ago

Hi, I'm getting the same error with -DBUILD_SHARED=false and fftw-3.3.5 :

libfftw3_threads.a(libfftw3_threads_la-threads.o): in function "fftw_threads_register_planner_hooks": threads.c:(.text+0x5d4): undefined reference to "fftw_set_planner_hooks"

Did you solve this issue?

Thank you

novatig commented 7 years ago

Hi, Sorry for not answering, I didn't really remember what I did. In the end I compiled with static libraries. When compiling with dynamic libraries I had to set a bunch of functions to static.

amirgholami commented 7 years ago

The above error with fftw-3.3.5 was related to the linking order used in cmake. This has been fixed in the latest version of the code