[DRAFT] Allow GPU code path to be executed on CPU #299
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a "host backend" for the GPU code path. Essentially I have made some minor tweaks to the Fortran and implemented host-side C++ backends for the Fourier and Legendre transforms, using the existing LAPACK and FFTW functionality brought in by the CPU version.
Along the way I have tried to separate out "host OpenMP" and "accelerator OpenMP" functionalities into separate CMake features, as I didn't want to affect the CPU build when switching off OpenMP for the GPU (actually also running on CPU) build. When this PR is working we should properly scrutinise how all the various features and builds interact.
Right now the host GPU backend is not working numerically, hence why this is still a draft. I'm almost there though... see this screenshot of the transformed spherical harmonic used in the benchmark case:
It seems to be correct, except for some latitudes which have obvious error patterns. Really weird. Not sure what's going on there, but I will keep testing.