Skip to content

First attempt at adding planner_nthreads#205

Merged
stevengj merged 2 commits intoFFTW:masterfrom
galenlynch:add_planner_nthreads
Aug 20, 2020
Merged

First attempt at adding planner_nthreads#205
stevengj merged 2 commits intoFFTW:masterfrom
galenlynch:add_planner_nthreads

Conversation

@galenlynch
Copy link
Copy Markdown
Contributor

@galenlynch galenlynch commented Jun 19, 2020

While you can currently set the maximum number of threads used by the planner,
there is no way to check that number. This simply adds a new function,
planner_nthreads, that provides this information, as was suggested by
@stevengj (JuliaMath/FFTW.jl#150).

I have no idea which files I should edit to introduce this new function beyond threads/api.c, due to my unfamiliarity with autoconf and the build system used by FFTW. I have additionally added planner_nthreads to api/fftw3.h, and threads/f77funcs.h. I was unsure how to test this new function, and I have not yet done so. I will try to figure that out soon, if someone with more experience does not do it before I can.

I have also added planner_nthreads to all the relevant portions of the documentation that I could find.

While you can currently set the maximum number of threads used by the planner,
there is no way to check that number. This simply adds a new function,
`planner_nthreads`, that provides this information, as was suggested by
@stevengj.
In an attempt to verify that planner_nthreads works as intended, I have added an
assertion in `fftw-bench.c` that `planner_nthreads` returns the nthreads just
passed as an argument to `plan_with_nthreads`.
@galenlynch
Copy link
Copy Markdown
Contributor Author

I successfully built this branch, and added a test of planner_nthreads into fftw-bench.c that confirms that planner_nthreads returns the last argument passed to plan_with_nthreads. After adding this, make check runs without error.

I'm not sure if this is the best place to test this new function, or if there are other tests that should also be added. If so, I would be happy to add them to this PR.

@stevengj
Copy link
Copy Markdown
Contributor

LGTM. Probably you could add a test after this line, of the form:

BENCH_ASSERT(FFTW(planner_nthreads)() == nthreads);

There is also some copyright-assignment paperwork that MIT requires for contributions to FFTW; @matteo-frigo, can you point @galenlynch in the right direction for this?

@galenlynch
Copy link
Copy Markdown
Contributor Author

galenlynch commented Jun 22, 2020

BENCH_ASSERT(FFTW(planner_nthreads)() == nthreads);

I think that's the exact test that I added in the second commit of this PR, which is great! Happy to do whatever paperwork is required. I'm a MIT employee if that makes a difference.

@galenlynch
Copy link
Copy Markdown
Contributor Author

Is this ok to merge?

@stevengj stevengj merged commit 16164a7 into FFTW:master Aug 20, 2020
@galenlynch galenlynch deleted the add_planner_nthreads branch August 29, 2020 18:51
saosudo pushed a commit to fujitsu/fftw3 that referenced this pull request Mar 26, 2021
* First attempt at adding planner_nthreads

While you can currently set the maximum number of threads used by the planner,
there is no way to check that number. This simply adds a new function,
`planner_nthreads`, that provides this information, as was suggested by
@stevengj.

* Add basic testing of planner_nthreads

In an attempt to verify that planner_nthreads works as intended, I have added an
assertion in `fftw-bench.c` that `planner_nthreads` returns the nthreads just
passed as an argument to `plan_with_nthreads`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants