Skip to content

Commit

Permalink
Get rid of CudaInternal::cuda_get_error_{name,string}_wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
dalg24 committed Jan 12, 2024
1 parent c75d730 commit 868e42e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
12 changes: 4 additions & 8 deletions core/src/Cuda/Kokkos_Cuda_Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,8 @@ void cuda_stream_synchronize(
void cuda_internal_error_throw(cudaError e, const char *name, const char *file,
const int line) {
std::ostringstream out;
out << name << " error( "
<< CudaInternal::singleton().cuda_get_error_name_wrapper<false>(e)
<< "): "
<< CudaInternal::singleton().cuda_get_error_string_wrapper<false>(e);
out << name << " error( " << cudaGetErrorName(e)
<< "): " << cudaGetErrorString(e);
if (file) {
out << " " << file << ":" << line;
}
Expand All @@ -196,10 +194,8 @@ void cuda_internal_error_throw(cudaError e, const char *name, const char *file,
void cuda_internal_error_abort(cudaError e, const char *name, const char *file,
const int line) {
std::ostringstream out;
out << name << " error( "
<< CudaInternal::singleton().cuda_get_error_name_wrapper<false>(e)
<< "): "
<< CudaInternal::singleton().cuda_get_error_string_wrapper<false>(e);
out << name << " error( " << cudaGetErrorName(e)
<< "): " << cudaGetErrorString(e);
if (file) {
out << " " << file << ":" << line;
}
Expand Down
12 changes: 0 additions & 12 deletions core/src/Cuda/Kokkos_Cuda_Instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,6 @@ class CudaInternal {
return cudaFreeHost(ptr);
}

template <bool setCudaDevice = true>
const char* cuda_get_error_name_wrapper(cudaError_t error) const {
if constexpr (setCudaDevice) set_cuda_device();
return cudaGetErrorName(error);
}

template <bool setCudaDevice = true>
const char* cuda_get_error_string_wrapper(cudaError_t error) const {
if constexpr (setCudaDevice) set_cuda_device();
return cudaGetErrorString(error);
}

template <bool setCudaDevice = true>
cudaError_t cuda_get_last_error_wrapper() const {
if constexpr (setCudaDevice) set_cuda_device();
Expand Down

0 comments on commit 868e42e

Please sign in to comment.