There is FFTW library installed by an administrator system-wide, in /usr/lib64, and it includes /usr/lib64/libfftw3_threads.so.3.2.4.

When I compiled this library myself, before it was installed by sysadmin, I have noticed that you have to choose between OpenMP and pthreads version:

  • --enable-openmp: Like --enable-threads, but using OpenMP compiler directives in order to induce parallelism rather than spawning its own threads directly. Useful especially for programs already employing such directives, in order to minimize conflicts between different parallelization mechanisms. Use either --enable-openmp or --enable-threads, not both; in either case the multi-threaded FFTW interface/library (see Multi-threaded FFTW) is compiled (with different back ends).

The distribution is Gentoo, so theoretically either is possible.

How to check if said library was compiled with OpenMP support (which would be best), or with pthreads?

2 Answers 2


You can call ldd on it to see if -fopenmp was used:

$ cat x.c 
int foo()
{ return 0 ; }

$ gcc -shared -fopenmp x.c -o x.so
$  ldd x.so
    linux-vdso.so.1 =>  (0x00007fff293d6000)
    libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00007fa942998000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007fa94277b000)
    libc.so.6 => /lib/libc.so.6 (0x00007fa9423f7000)
    librt.so.1 => /lib/librt.so.1 (0x00007fa9421ef000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fa942dc7000)

Meaning it is both linked against libpthread and libgomp.

$ gcc -shared x.c -o x.so
$ ldd x.so                        
    linux-vdso.so.1 =>  (0x00007fff5fbff000)
    libc.so.6 => /lib/libc.so.6 (0x00007f5340a9b000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f534103f000)

Meaning it does not include openmp support.

In general it is not that easy to see what compiler flags were used since they are not recorded in the binary by default.

Perhaps you can look into some Gentoo log file that was created during package install (I mean package compile time).

Of course with binary package based distribution (like e.g. Debian) you don't have that problem - you can look up to what package the .so file belongs to, and look into the package description and/or the source package, where the compiler switches are specified.


You can check whether the library is linked against pthread at least by using ldd. On Debian squeeze, my version is linked against pthread.

$ ii  libfftw3-3      3.2.2-1      library for computing Fast Fourier Transforms

$ ldd /usr/lib/libfftw3_threads.so.3.2.4
linux-gate.so.1 =>  (0xb77be000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb776c000)
libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7753000)   <---
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb760c000)
/lib/ld-linux.so.2 (0xb77bf000)

Based on a quick net search, it looks like the program would have to link against the GCC OpenMP support library (GOMP) for OpenMP support, so you could use ldd to check for something with "libgomp" in it as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .