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

Move check() function into local namespace #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Common/helper_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,8 @@ static const char *_cudaGetErrorEnum(NppStatus error) {
}
#endif

namespace helper_cuda {
namespace detail {
template <typename T>
void check(T result, char const *const func, const char *const file,
int const line) {
Expand All @@ -588,11 +590,13 @@ void check(T result, char const *const func, const char *const file,
exit(EXIT_FAILURE);
}
}
} // namespace detail
} // namespace helper_cuda

#ifdef __DRIVER_TYPES_H__
// This will output the proper CUDA error strings in the event
// that a CUDA host call returns an error
#define checkCudaErrors(val) check((val), #val, __FILE__, __LINE__)
#define checkCudaErrors(val) ::helper_cuda::detail::check((val), #val, __FILE__, __LINE__)

// This will output the proper error string when calling cudaGetLastError
#define getLastCudaError(msg) __getLastCudaError(msg, __FILE__, __LINE__)
Expand Down