diff options
author | Sergey Dmitriev <serguei.n.dmitriev@intel.com> | 2017-08-14 15:09:59 +0000 |
---|---|---|
committer | Sergey Dmitriev <serguei.n.dmitriev@intel.com> | 2017-08-14 15:09:59 +0000 |
commit | b305d26b57623a54ddd0ce3f534f416b67c9abed (patch) | |
tree | 2b3e90e415d2e8672554282459df75fd82499da5 /openmp/libomptarget/plugins/cuda/src/rtl.cpp | |
parent | 3c595a6b2c58a23c42a6270bddca8ae99108b5be (diff) | |
download | bcm5719-llvm-b305d26b57623a54ddd0ce3f534f416b67c9abed.tar.gz bcm5719-llvm-b305d26b57623a54ddd0ce3f534f416b67c9abed.zip |
[OpenMP] libomptarget: move debugging dumps under control of env var LIBOMPTARGET_DEBUG
Disable default debugging dumps for libomptarget and plugins and move dumps
under control of environment variable LIBOMPTARGET_DEBUG=<integer>. Dumps
are enabled when LIBOMPTARGET_DEBUG is set to a positive integer value.
Debugging dumps are available only in debug build; release build does not
support it.
Differential Revision: https://reviews.llvm.org/D33227
llvm-svn: 310841
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); |