Skip to content

Conversation

@AlexanderSinn
Copy link
Member

@AlexanderSinn AlexanderSinn commented Oct 28, 2025

This PR implements a new FFT-based Poisson solver that uses DST type 2 for the forward transform and DST type 3 for the backward transform. Compared to the existing solver, which uses DST type 1, this internally uses an FFT of size n instead of n+1, giving different performance characteristics for different resolutions. Fast algorithms for the DST are implemented according to the book "Computational Frameworks for the Fast Fourier Transform" Algorithms 4.4.4 and 4.4.5.

Performance test:

Not only does the new Poisson solver nicely cover the 2^n resolution cases where the existing solver would have been slow, it is even a little bit faster at the respective optimal resolution.

New FFTDirichletQuick (DST-2 / DST-3)

255      0.2612 s
256      0.1409 s <<

511      0.4398 s
512      0.1766 s <<

1023     0.8011 s
1024     0.3357 s <<

2047     4.409 s
2048     1.491 s <<

4095     17.61 s
4096     5.578 s <<

8191     98.91 s
8192     31 s <<

FFTDirichletFast (DST-1)

255      0.1478 s <<
256      0.285 s

511      0.1838 s <<
512      0.3209 s

1023     0.3697 s <<
1024     0.8144 s

2047     1.708 s <<
2048     10.7 s

4095     6.502 s <<
4096     37.21 s

8191     34.62 s <<
8192     143.4 s

Test of the MR boundary condition interpolation (new=FFTDirichletQuick, old=FFTDirichletFast):

image image
  • Small enough (< few 100s of lines), otherwise it should probably be split into smaller PRs
  • Tested (describe the tests in the PR description)
  • Runs on GPU (basic: the code compiles and run well with the new module)
  • Contains an automated test (checksum and/or comparison with theory)
  • Documented: all elements (classes and their members, functions, namespaces, etc.) are documented
  • Constified (All that can be const is const)
  • Code is clean (no unwanted comments, )
  • Style and code conventions are respected at the bottom of https://github.com/Hi-PACE/hipace
  • Proper label and GitHub project, if applicable

@AlexanderSinn AlexanderSinn added component: fields About 3D fields and slices, field solvers etc. performance optimization, benchmark, profiling, etc. labels Oct 28, 2025
Copy link
Member

@MaxThevenet MaxThevenet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! Could you add a CI test with checksum?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: fields About 3D fields and slices, field solvers etc. performance optimization, benchmark, profiling, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants