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

Add check to ensure complex alignment #228

Merged
merged 2 commits into from
Feb 20, 2025

Conversation

yasahi-hpc
Copy link
Collaborator

Resolves #226

In kokkos-fft, we strongly assume the 32 bit alignment of Kokkos::complex type.
This PR checks whether KOKKOS_ENABLE_COMPLEX_ALIGN is enabled in CMake and cpp code.

@yasahi-hpc yasahi-hpc self-assigned this Feb 20, 2025
@yasahi-hpc yasahi-hpc added enhancement New feature or request CMake labels Feb 20, 2025
Copy link
Member

@tpadioleau tpadioleau left a comment

Choose a reason for hiding this comment

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

Seems good to me. Could you check that the detection works if the option is missing ?

@yasahi-hpc
Copy link
Collaborator Author

For CUDA, I got the following errors if we compile with -DKokkos_ENABLE_COMPLEX_ALIGN=OFF

kokkos-fft/fft/src/KokkosFFT_default_types.hpp(11): error: static assertion failed with "KokkosFFT requires option -DKokkos_ENABLE_COMPLEX_ALIGN=ON to build Kokkos"

kokkos-fft/fft/src/KokkosFFT_Cuda_types.hpp(20): error: static assertion failed

kokkos-fft/fft/src/KokkosFFT_Cuda_types.hpp(23): error: static assertion failed

I think we need to improve the error messages under KokkosFFT_Cuda_types.hpp. I will do that in another PR

@tpadioleau
Copy link
Member

For CUDA, I got the following errors if we compile with -DKokkos_ENABLE_COMPLEX_ALIGN=OFF

kokkos-fft/fft/src/KokkosFFT_default_types.hpp(11): error: static assertion failed with "KokkosFFT requires option -DKokkos_ENABLE_COMPLEX_ALIGN=ON to build Kokkos"

kokkos-fft/fft/src/KokkosFFT_Cuda_types.hpp(20): error: static assertion failed

kokkos-fft/fft/src/KokkosFFT_Cuda_types.hpp(23): error: static assertion failed

Seems good, what about the cmake detection ?

@yasahi-hpc
Copy link
Collaborator Author

If we rely on installed Kokkos with -DKokkos_ENABLE_COMPLEX_ALIGN=OFF

-- Could NOT find Kokkos_OPTIONS (missing: COMPLEX_ALIGN)
CMake Error at lib/kokkos4.5_unalign/lib64/cmake/Kokkos/KokkosConfigCommon.cmake:112 (message):
  Kokkos does NOT provide all backends and/or architectures requested
Call Stack (most recent call first):
  CMakeLists.txt:42 (kokkos_check)

Should be OK

@tpadioleau
Copy link
Member

Ok for me!

@yasahi-hpc
Copy link
Collaborator Author

@tpadioleau
Thank for your review. I will merge this

@yasahi-hpc yasahi-hpc merged commit 02692b1 into kokkos:main Feb 20, 2025
21 checks passed
@yasahi-hpc yasahi-hpc deleted the check-complex-alignment branch February 20, 2025 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add check to ensure Kokkos is compiled with Kokkos_ENABLE_COMPLEX_ALIGN
2 participants