<commit_before>/*!
 *  Copyright (c) 2017 by Contributors
 * \file cuda_common.h
 * \brief Common utilities for CUDA
 */
#ifndef TVM_RUNTIME_CUDA_CUDA_COMMON_H_
#define TVM_RUNTIME_CUDA_CUDA_COMMON_H_

#include <tvm/runtime/config.h>
#include <tvm/runtime/packed_func.h>
#include <string>

#if TVM_CUDA_RUNTIME
#include <cuda_runtime.h>

namespace tvm {
namespace runtime {

#define CUDA_DRIVER_CALL(x)                                             \
  {                                                                     \
    CUresult result = x;                                                \
    if (result != CUDA_SUCCESS) {                                       \
      const char *msg;                                                  \
      cuGetErrorName(result, &msg);                                     \
      LOG(FATAL)                                                        \
          << "CUDAError: " #x " failed with error: " << msg;            \
    }                                                                   \
  }

#define CUDA_CALL(func)                                            \
  {                                                                \
    cudaError_t e = (func);                                        \
    CHECK(e == cudaSuccess || e == cudaErrorCudartUnloading)       \
        << "CUDA: " << cudaGetErrorString(e);                      \
  }


/*!
 * \brief Compile code into ptx using NVRTC
 * \param code The cuda code.
 * \return The PTX code.
 */
std::string NVRTCCompile(const std::string& code);
}  // namespace runtime
}  // namespace tvm
#endif  // TVM_CUDA_RUNTIME
#endif  // TVM_RUNTIME_CUDA_CUDA_COMMON_H_<commit_msg>[RUNTIME/CUDA] Allow save exit when driver unload (#122)<commit_after>/*!
 *  Copyright (c) 2017 by Contributors
 * \file cuda_common.h
 * \brief Common utilities for CUDA
 */
#ifndef TVM_RUNTIME_CUDA_CUDA_COMMON_H_
#define TVM_RUNTIME_CUDA_CUDA_COMMON_H_

#include <tvm/runtime/config.h>
#include <tvm/runtime/packed_func.h>
#include <string>

#if TVM_CUDA_RUNTIME
#include <cuda_runtime.h>

namespace tvm {
namespace runtime {

#define CUDA_DRIVER_CALL(x)                                             \
  {                                                                     \
    CUresult result = x;                                                \
    if (result != CUDA_SUCCESS && result != CUDA_ERROR_DEINITIALIZED) { \
      const char *msg;                                                  \
      cuGetErrorName(result, &msg);                                     \
      LOG(FATAL)                                                        \
          << "CUDAError: " #x " failed with error: " << msg;            \
    }                                                                   \
  }

#define CUDA_CALL(func)                                            \
  {                                                                \
    cudaError_t e = (func);                                        \
    CHECK(e == cudaSuccess || e == cudaErrorCudartUnloading)       \
        << "CUDA: " << cudaGetErrorString(e);                      \
  }


/*!
 * \brief Compile code into ptx using NVRTC
 * \param code The cuda code.
 * \return The PTX code.
 */
std::string NVRTCCompile(const std::string& code);
}  // namespace runtime
}  // namespace tvm
#endif  // TVM_CUDA_RUNTIME
#endif  // TVM_RUNTIME_CUDA_CUDA_COMMON_H_
{'fraction_non_alphanumeric': 0.08986784140969163, 'fraction_numerical': 0.0032305433186490457, 'mean_word_length': 1.0310077519379846, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 41, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2861971', 'n_tokens_mistral': 919, 'n_tokens_neox': 879, 'n_words': 188}