Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
cuda_common.h
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
16 // under the License.
17 
18 // Non-public header
19 
20 #ifndef ARROW_GPU_CUDA_COMMON_H
21 #define ARROW_GPU_CUDA_COMMON_H
22 
23 #include <sstream>
24 
25 #include <cuda.h>
26 
27 namespace arrow {
28 namespace gpu {
29 
30 #define CUDA_DCHECK(STMT) \
31  do { \
32  int ret = (STMT); \
33  DCHECK_EQ(0, ret); \
34  (void)ret; \
35  } while (0)
36 
37 #define CU_RETURN_NOT_OK(STMT) \
38  do { \
39  CUresult ret = (STMT); \
40  if (ret != CUDA_SUCCESS) { \
41  std::stringstream ss; \
42  ss << "Cuda Driver API call in " << __FILE__ << " at line " << __LINE__ \
43  << " failed with code " << ret << ": " << #STMT; \
44  return Status::IOError(ss.str()); \
45  } \
46  } while (0)
47 
48 } // namespace gpu
49 } // namespace arrow
50 
51 #endif // ARROW_GPU_CUDA_COMMON_H
Top-level namespace for Apache Arrow C++ API.
Definition: allocator.h:29