Ubuntu – Installing P3DFFT

software installation

I am installing P3DFFT in ubuntu. I downloaded the ".tar.gz" file for it and extracted. Then used the "./configure" command. The configure gave the following error,
" configure:error:You must choose to use either ESSL or FTTW "
I have istalled the FTTW lib before P3DFFT. Please help me on this error.

Thanks

Best Answer

  • As you do not specify your Ubuntu version I tested the method below on two supported LTS versions - Ubuntu 16.04 LTS (Xenial Xerus) and Ubuntu 18.04 LTS (Bionic Beaver).


    Install FFTW-related developer packages and build-dependencies. Do not forget to enable source code repositories in Software & Updates (software-properties-gtk) before you proceed.
    Then run:

    sudo apt-get install -y libfftw3-dev libfftw3-mpi-dev libopenmpi-dev gfortran
    sudo apt-get build-dep -y libfftw3-dev libfftw3-mpi-dev
    

    Download and extract P3DFFT package:

    cd ~/Downloads
    wget https://github.com/sdsc/p3dfft/archive/v2.7.6.tar.gz
    tar -xf v2.7.6.tar.gz
    cd p3dfft-2.7.6/
    

    As it was already written by @steeldriver:

    The first thing to note is that the argument to --with-fftw must be the top level path to the FFTW3 header files and libraries. So for example if the headers are in /usr/include and the libraries are under /usr/lib (the default, when package libfftw3-dev is installed from the Ubuntu repository), the value should be given as --with-fftw=/usr

    The additional issue in this case is that the provided configure script appears to be hard-wired to look in only the lib and lib64 subdirectories:

       3315         if test -e $withfftw/lib/libfftw3.a ; then
       3316                 FFTW_INC="-I$withfftw/include"
       3317 
       3318                 FFTW_LIB="$withfftw/lib/libfftw3.a"
       3319 
       3320         elif test -e $withfftw/lib64/libfftw3.a ; then
       3321                 FFTW_INC="-I$withfftw/include"
       3322 
       3323                 FFTW_LIB="$withfftw/lib64/libfftw3.a"
       3324 
       3325         else
       3326                 as_fn_error $? "libfftw3.a was not found in given location!" "$LINENO" 5
       3327         fi
    

    The use of a lib64 subdirectory is an old convention that pre-dates Debian's Multiarch framework - the modern location for 64-bit libraries would be lib/x86_64-linux-gnu

    So you need to patch the configure script. You can do it with commands below:

    sed -i 's/\$withfftw\/include/\/usr\/include/g' configure
    sed -i 's/\$withfftw\/lib64\//\$withfftw\//g' configure
    sed -i 's/\$withfftw\/lib\//\$withfftw\//g' configure
    

    Then run new patched configure script with correct options:

    ./configure --enable-fftw --with-fftw=/usr/lib/x86_64-linux-gnu
    

    Then run the compilation and installation:

    make
    sudo make install
    
  • Related Question