0
votes

I am currently learning to use fftw3-mpi. I followed the 2D example from http://www.fftw.org/fftw3_doc/2d-MPI-example.html but I receive an error saying

/usr/local/lib/libfftw3_mpi.so: undefined reference to fftw_ialignment_of

The problem occurs when calling the function fftw_mpi_init()

#include <mpi.h>
#include <fftw3-mpi.h>                                                                                                                                                                                                         

int main(int argc, char **argv)
{
  const ptrdiff_t N0 = 32, N1 = 32;
    fftw_plan plan;
    fftw_complex *data;
    ptrdiff_t alloc_local, local_n0, local_0_start, i, j;                                                                                                                                                                                                                    

    MPI_Init(&argc, &argv);
    fftw_mpi_init(); // problem occurs here
    MPI_Finalize();
    return 0; 
}

I have looked into /usr/local/lib/ and there indeed is libfftw3_mpi.so so I am not to sure what the problem is. I have also tried reinstalling fftw3 (with mpi enabled), but it doesn't solve the problem.

The code is compiled with the link -lfftw3_mpi -lfftw3 -lm , so here is my line to compile.

mpiCC fftwmpi.cpp -o test.o -lfftw3_mpi -lfftw3 -lm

Any comment is appreciated. Thank you

1
please post your link command line.Gilles Gouaillardet
@GillesGouaillardet Hi, I have edited my post regarding to the link command line.jchan192
Try using the -L flag and point to the library?Parth Shah
what does ldd test.o says ? what if you mpirun -np 1 ldd test.o? last but not least, what does nm /usr/local/lib/libfftw3.so | grep fftw_ialignment_of says?Gilles Gouaillardet

1 Answers

0
votes

Thanks to Gouailardet and Shah for the help.

I simply misssed an explicit link -L flag to the library when compiling. Here is the corrected command line.

mpiCC fftwmpi.cpp -o test.o --std=c++11 -L/usr/local/lib/ -lfftw3_mpi -lfftw3 -lm