Question

every one,

I am trying to use NVCC to compile the following code that uses FFTW3.3 library:

#include <stdio.h>
#include <fftw3.h>

void main() {

    fftwf_complex a;
    a[0] = 1;
    a[1] = -1;

    printf("a = %f %f, Testing FFTW with NVCC\n", a[0], a[1]);

}

When I compile using gcc it works fine:

cc main.cpp -o main.out  -lfftw3 -lm
main.out
a = 1.000000 -1.000000, Testing FFTW with CUDA

However, when I am trying to compile the same code as .cu file, using nvcc instead of gcc, I get a long list of compile errors:

nvcc main.cu -o main.out -lfftw3 -lm
/usr/include/fftw3.h(370): error: identifier "__float128" is undefined
/usr/include/fftw3.h(370): error: identifier "__float128" is undefined
...

Removing the two libraries -lfftw3 -lm would result in an undefined symbol of fftwf_complex.

Can anyone figure out what's going on?

Was it helpful?

Solution

This is a known problem in FFTW 3.3 whereby the FFTW headers misidentify that they are being compiled with a gcc version >=4.6 which has 128bit floating point support. It has been reported to effect compilation with icc, and it looks like nvcc steered compilation has the same problem.

The recommended workaround is to upgrade to FFTW 3.3.2.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top