diff options
Diffstat (limited to 'openmp/libomptarget/plugins/cuda/src/rtl.cpp')
-rw-r--r-- | openmp/libomptarget/plugins/cuda/src/rtl.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/openmp/libomptarget/plugins/cuda/src/rtl.cpp b/openmp/libomptarget/plugins/cuda/src/rtl.cpp index 9981cf2f650..7f39ebce6a5 100644 --- a/openmp/libomptarget/plugins/cuda/src/rtl.cpp +++ b/openmp/libomptarget/plugins/cuda/src/rtl.cpp @@ -25,9 +25,20 @@ #define TARGET_NAME CUDA #endif +#ifdef OMPTARGET_DEBUG +static int DebugLevel = 0; + #define GETNAME2(name) #name #define GETNAME(name) GETNAME2(name) -#define DP(...) DEBUGP("Target " GETNAME(TARGET_NAME) " RTL", __VA_ARGS__) +#define DP(...) \ + do { \ + if (DebugLevel > 0) { \ + DEBUGP("Target " GETNAME(TARGET_NAME) " RTL", __VA_ARGS__); \ + } \ + } while (false) +#else // OMPTARGET_DEBUG +#define DP(...) {} +#endif // OMPTARGET_DEBUG #include "../../common/elf_common.c" @@ -157,6 +168,12 @@ public: } RTLDeviceInfoTy() { +#ifdef OMPTARGET_DEBUG + if (char *envStr = getenv("LIBOMPTARGET_DEBUG")) { + DebugLevel = std::stoi(envStr); + } +#endif // OMPTARGET_DEBUG + DP("Start initializing CUDA\n"); CUresult err = cuInit(0); |