Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed Fix for Cuda compilation Issue #308 #321

Open
JoMee opened this issue Oct 24, 2024 · 0 comments
Open

Proposed Fix for Cuda compilation Issue #308 #321

JoMee opened this issue Oct 24, 2024 · 0 comments

Comments

@JoMee
Copy link
Contributor

JoMee commented Oct 24, 2024

Cause of the problem

The cuda compilation issue described in #308 seems to be due to the missing template specialization of HeffteBackendType<Kokkos::HostSpace> when building with cuda.

The issue only arrives when compiling the unit tests for FFT. It is my understanding that the unit tests allocate memory on the host as well as the cuda device. The allocation on the host device is used for comparing the results of the FFT with the ground truth. This requires both specializations HeffteBackendType<Kokkos::HostSpace> and HeffteBackendType<Kokkos::CudaSpace> to exist.

In src/FFT/FFT.h, we conditionally generate the HeffteBackendType<Kokkos::HostSpace> but one of the conditions is !defined(KOKKOS_ENABLE_CUDA). So when we build for CUDA, this specialization is omitted.

Proposed solution

Remove the !defined(KOKKOS_ENABLE_CUDA) part of the condition.

- #if !defined(KOKKOS_ENABLE_CUDA) && !defined(Heffte_ENABLE_MKL) && !defined(Heffte_ENABLE_FFTW)
+ #if !defined(Heffte_ENABLE_MKL) && !defined(Heffte_ENABLE_FFTW)
        /**
         * Use heFFTe's inbuilt 1D fft computation on CPUs if no
         * vendor specific or optimized backend is found
         */
        template <>
        struct HeffteBackendType<Kokkos::HostSpace> {
            using backend     = heffte::backend::stock;
            using backendSine = heffte::backend::stock_sin;
            using backendCos  = heffte::backend::stock_cos;
            using backendCos1 = heffte::backend::stock_cos1;
        };
#endif

When removing this part of the condition, the unit tests compile without issue. This was tested on Gwendolen.

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

No branches or pull requests

1 participant