-
Notifications
You must be signed in to change notification settings - Fork 407
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
core/src/impl: Conditionally define get_gpu in Kokkos_Core #3072
core/src/impl: Conditionally define get_gpu in Kokkos_Core #3072
Conversation
Can one of the admins verify this patch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just ifdef the entire function for GPU builds?
a5fdee1
to
32468fa
Compare
core/src/impl/Kokkos_Core.cpp
Outdated
@@ -168,6 +168,7 @@ int get_ctest_gpu(const char* local_rank_str) { | |||
|
|||
namespace { | |||
|
|||
__attribute__ ((unused)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not portable and doesn't work for MSVC. Just guard it with
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
32468fa
to
cb9727f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation needs to be fixed:
diff --git a/core/src/impl/Kokkos_Core.cpp b/core/src/impl/Kokkos_Core.cpp
index b4d93f35..2f9d4e1c 100644
--- a/core/src/impl/Kokkos_Core.cpp
+++ b/core/src/impl/Kokkos_Core.cpp
@@ -168,8 +168,7 @@ int get_ctest_gpu(const char* local_rank_str) {
namespace {
-#if defined(KOKKOS_ENABLE_CUDA) || \
- defined(KOKKOS_ENABLE_ROCM) || \
+#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_ROCM) || \
defined(KOKKOS_ENABLE_HIP)
int get_gpu(const InitArguments& args) {
int use_gpu = args.device_id;
@@ -210,7 +209,7 @@ int get_gpu(const InitArguments& args) {
}
return use_gpu;
}
-#endif // KOKKOS_ENABLE_CUDA || KOKKOS_ENABLE_ROCM || KOKKOS_ENABLE_HIP
+#endif // KOKKOS_ENABLE_CUDA || KOKKOS_ENABLE_ROCM || KOKKOS_ENABLE_HIP
bool is_unsigned_int(const char* str) {
const size_t len = strlen(str);
Please apply the above patch or run clang-format 8
.
core/src/impl/Kokkos_Core.cpp
Outdated
@@ -168,6 +168,9 @@ int get_ctest_gpu(const char* local_rank_str) { | |||
|
|||
namespace { | |||
|
|||
#if defined(KOKKOS_ENABLE_CUDA) || \ | |||
defined(KOKKOS_ENABLE_ROCM) || \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, this has no effect and the ROCM
related implementations will be removed (in favor of HIP
) in the future anyway. Since there are still a lot of places that have it, it doesn't matter that much, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK to me. Thanks!
OK to test |
Codecov Report
@@ Coverage Diff @@
## develop #3072 +/- ##
=========================================
+ Coverage 82.4% 82.7% +0.2%
=========================================
Files 122 122
Lines 8095 8074 -21
=========================================
+ Hits 6672 6678 +6
+ Misses 1423 1396 -27
Continue to review full report at Codecov.
|
This PR conditionally defines
get_gpu
since a subset of the kokkos-kernels nightly tests do not enableCUDA
,ROCM
, orHIP
and fail to build due toget_gpu
being defined but not used.This was tested by running spot-checks from kokkos-kernels:
Unable to select reviewers: @crtrott, @bartlettroscoe.