Proteus
Programmable JIT compilation and optimization for C/C++ using LLVM
Loading...
Searching...
No Matches
UtilsCUDA.h
Go to the documentation of this file.
1//===-- UtilsCUDA.h -- Utilities header for CUDA --===//
2//
3// Part of the Proteus Project, under the Apache License v2.0 with LLVM
4// Exceptions. See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef PROTEUS_UTILS_CUDA_H
12#define PROTEUS_UTILS_CUDA_H
13
14#include <cuda.h>
15#include <cuda_runtime.h>
16#include <nvPTXCompiler.h>
17
18#define proteusCudaErrCheck(CALL) \
19 { \
20 cudaError_t err = CALL; \
21 if (err != cudaSuccess) { \
22 printf("ERROR @ %s:%d -> %s\n", __FILE__, __LINE__, \
23 cudaGetErrorString(err)); \
24 abort(); \
25 } \
26 }
27
28#define proteusCuErrCheck(CALL) \
29 { \
30 CUresult err = CALL; \
31 if (err != CUDA_SUCCESS) { \
32 const char *ErrStr; \
33 cuGetErrorString(err, &ErrStr); \
34 printf("ERROR @ %s:%d -> %s\n", __FILE__, __LINE__, ErrStr); \
35 abort(); \
36 } \
37 }
38
39#define proteusNvPTXCompilerErrCheck(CALL) \
40 { \
41 nvPTXCompileResult err = CALL; \
42 if (err != NVPTXCOMPILE_SUCCESS) { \
43 printf("ERROR @ %s:%d -> %d\n", __FILE__, __LINE__, err); \
44 abort(); \
45 } \
46 }
47
48#endif