0xbadf00d
0xbadf00d

Reputation: 18228

multi-threaded fftw library on windows

I've downloaded the precompiled windows DLLs from the website http://www.fftw.org/install/windows.html. I've also created the *.lib files. However, they don't include the multi-threading related functions fftw_init_threads, fftw_plan_with_nthreads and so on.

So, how do I use multi-threaded fftw on windows? Do I need to compile the code by myself?

EDIT: I've tried to build version 3.3.10 by myself using Visual Studio 2022. I'm compiling with the following flags set in the cmakesettings.json:

{
  "name": "x64-Release",
  "generator": "Ninja",
  "configurationType": "RelWithDebInfo",
  "buildRoot": "${projectDir}\\out\\build\\${name}",
  "installRoot": "${projectDir}\\out\\install\\${name}",
  "cmakeCommandArgs": "",
  "buildCommandArgs": "",
  "ctestCommandArgs": "",
  "inheritEnvironments": [ "msvc_x64_x64" ],
  "variables": [
    {
      "name": "ENABLE_SSE",
      "value": "False",
      "type": "BOOL"
    },
    {
      "name": "ENABLE_SSE2",
      "value": "True",
      "type": "BOOL"
    },
    {
      "name": "ENABLE_AVX2",
      "value": "True",
      "type": "BOOL"
    },
    {
      "name": "ENABLE_AVX",
      "value": "False",
      "type": "BOOL"
    },
    {
      "name": "ENABLE_FLOAT",
      "value": "True",
      "type": "BOOL"
    },
    {
      "name": "ENABLE_THREADS",
      "value": "True",
      "type": "BOOL"
    },
    {
      "name": "CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS",
      "value": "True",
      "type": "BOOL"
    }
  ]
}

With this settings I'm still receiving the following linker errors:

Creating library fftw3f_threads.lib and object fftw3f_threads.exp
\fftw-3.3.10\out\build\x64-Release\api.c.obj : error LNK2001: unresolved external symbol fftwf_mksolver_ct_hook
\fftw-3.3.10\out\build\x64-Release\api.c.obj : error LNK2001: unresolved external symbol fftwf_mksolver_hc2hc_hook
\fftw-3.3.10\out\build\x64-Release\fftw3f_threads.dll : fatal error LNK1120: 2 unresolved externals

Upvotes: 1

Views: 197

Answers (1)

catnip
catnip

Reputation: 25388

OK, I think I've got it, pretty much. At least, I can see where things are going off the rails.

Following on from the comments, FFTW macroises all its function names (and globals). In CONVENTION, we read:

NAME MANGLING: use X(foo) for external names instead of fftw_foo. X(foo) expands to fftwf_foo or fftw_foo, depending on the precision.

So now we know that fftwf_mksolver_ct_hook's alter-ego is in fact X(mksolver_ct_hook).

And a quick search for mksolver_ct_hook reveals that it's defined in ct.c (it's a global), so that file is obviously not being included in the build.

Likewise, mksolver_hc2hc_hook is defined in hc2hc.c.

Over to you. There are probably still a few more miles to go, but you should be OK now.

Upvotes: 0

Related Questions