Blame view

tsl_aiplatform/helpers/cuda_helper.h 731 Bytes
85cc8cb9   Hu Chunming   ๅŽŸ็‰ˆไปฃ็ 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  /*
   * @Author: yangzilong
   * @Date: 2021-12-14 16:41:18
   * @Last Modified by: yangzilong
   * @Email: yangzilong@objecteye.com
   * @Description:
   */
  
  #pragma once
  
  #include <cstdio>
  #include <cuda_runtime.h>
  #include "define.hpp"
  #include "logger.hpp"
  
  
  #define PRINT_CHECK(call) \
  {\
      const cudaError_t error_code = call;\
      if (cudaSuccess != error_code)\
          std::fprintf(stderr, "[%s:%d] %s error code: %d error reason: %s\n", __FILENAME__, __LINE__, __FUNCTION__, error_code, cudaGetErrorString(error_code));\
  }
  
  
  #define CHECK(call) \
  {\
      const cudaError_t error_code = call;\
      if (cudaSuccess != error_code)\
          LOG_ERROR("CUDA error, code: {} reason: {}", error_code, cudaGetErrorString(error_code));\
  }