Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

NVRTC_SAFE_CALL_LOG #106

Merged
merged 1 commit into from
Dec 23, 2019
Merged
Show file tree
Hide file tree
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
15 changes: 15 additions & 0 deletions include/yacx/Exception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@ inline void __checkNvrtcResultError(const nvrtcResult error, const char *file,
}
}

//! throws a nvrtcResultException if something went wrong
#define NVRTC_SAFE_CALL_LOG(error, m_log) \
__checkNvrtcResultError_LOG(error, m_log, __FILE__, __LINE__);
inline void __checkNvrtcResultError_LOG(const nvrtcResult error, std::__cxx11::basic_string<char> m_log,
const char *file, const int line) {
if (NVRTC_SUCCESS != error) {
// create string for exception
std::string exception =
nvrtcGetErrorString(error); // method to get the error name from NVIDIA
exception = exception + "\n->occoured in file <" + file + " in line " +
std::to_string(line) + "\n m_log: "+ m_log + "\n\n";
throw nvrtcResultException(error, exception);
}
}

//! throws a CUresultException if something went wrong
#define CUDA_SAFE_CALL(error) __checkCUresultError(error, __FILE__, __LINE__);
inline void __checkCUresultError(const CUresult error, const char *file,
Expand Down
4 changes: 2 additions & 2 deletions src/Program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ Kernel Program::compile(const Options &options) {
m_log = clog.get();

if (compileResult != NVRTC_SUCCESS) {
logger(loglevel::ERROR) << m_log;
NVRTC_SAFE_CALL(compileResult);
//logger(loglevel::ERROR) << m_log;
NVRTC_SAFE_CALL_LOG(compileResult, m_log);
}

size_t ptxSize;
Expand Down