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

Use HOST_ONLY macro instead of !define(CUDA) && !define(HIP) #843

Closed
lucbv opened this issue Nov 3, 2020 · 2 comments
Closed

Use HOST_ONLY macro instead of !define(CUDA) && !define(HIP) #843

lucbv opened this issue Nov 3, 2020 · 2 comments
Assignees

Comments

@lucbv
Copy link
Contributor

lucbv commented Nov 3, 2020

In a few spots the following logic has been implemented during the HIP backend work:
#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP)
one could probably replace that with
#if defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST)
to selectively enable blocks of code when the compiler is not targeting a device or we could add the following macro in KokkosKernels_macros.hpp:

#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP)
#define KOKKOSKERNELS_HOST_ONLY
#endif

@brian-kelley do you have an opinion?

@brian-kelley
Copy link
Contributor

@lucbv I don't think KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST is an exact replacement, since it is defined for host code in a cuda-enabled build (defined(KOKKOS_ENABLE_CUDA) && !defined(__CUDA_ARCH__)). I think adding the HOST_ONLY macro would make sense. Even better would be to avoid macros and use templated constexpr functions like kk_is_gpu_exec_space<ExecutionSpace>(), but I know that's not possible everywhere.

@lucbv
Copy link
Contributor Author

lucbv commented Nov 3, 2020

Yeah, I think in the case of the trtri and trmm tests the compiler would just complain about the use of a host function in a device function so the macro is probably the right approach, but in other cases I do like the templated constexpr function approach. I will make a PR for the new macro tonight.

@lucbv lucbv closed this as completed Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants