Skip to content

Commit

Permalink
Fix clang+cuda compiler warning about cudaDeviceSynchronize (#5846)
Browse files Browse the repository at this point in the history
* Fix clang+cuda compiler warning got cudaDeviceSynchronize

* Restrict workaround to Clang
  • Loading branch information
masterleinad authored Feb 2, 2023
1 parent cba11a1 commit f2ec98d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/src/Cuda/Kokkos_Cuda_Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,17 @@ void cuda_device_synchronize(const std::string &name) {
name,
Kokkos::Tools::Experimental::SpecialSynchronizationCases::
GlobalDeviceSynchronization,
#if defined(KOKKOS_COMPILER_CLANG)
// annotate with __host__ silence a clang warning about using
// cudaDeviceSynchronize in device code
[] __host__() { // TODO: correct device ID
KOKKOS_IMPL_CUDA_SAFE_CALL(cudaDeviceSynchronize());
});
#else
[]() { // TODO: correct device ID
KOKKOS_IMPL_CUDA_SAFE_CALL(cudaDeviceSynchronize());
});
#endif
}

void cuda_stream_synchronize(const cudaStream_t stream, const CudaInternal *ptr,
Expand Down

0 comments on commit f2ec98d

Please sign in to comment.