stan-dev / stan-dev/math

Supporting Eigen & FFTW when STAN_THREADS is enabled

Open
#3,025 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
839
Forks
220
Avg merge
2d 4h
Merged PRs (30d)
14

Description

Description:

The FFTW library can be used seamlessly with Eigen and their FFT implementation which makes everything simple to use with Stan. Using FFTW has proven to yield huge speedups in our model.

There is however a problem when using threading. When using fftw in multi-threaded applications, you need to call fftw_make_planner_thread_safe(); once before calling fft().

Which means I need to add

#ifdef EIGEN_FFTW_DEFAULT
    fftw_make_planner_thread_safe();
#endif

in main() of cmdstan.

Do we think this might be worth adding for all users? Or is this too niche?

Current Version:

v2.33.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue points to cmdstan's main() and the fftw_make_planner_thread_safe() call when EIGEN_FFTW_DEFAULT and STAN_THREADS are enabled. Start by tracing how these flags reach the executable and how FFTW initialization is handled. Done means the supported behavior for this configuration is decided and validated.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.