Apollo  6.0
Open source self driving car software
common.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2020 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 
17 /*
18  * Copyright 2018-2019 Autoware Foundation. All rights reserved.
19  *
20  * Licensed under the Apache License, Version 2.0 (the "License");
21  * you may not use this file except in compliance with the License.
22  * You may obtain a copy of the License at
23  *
24  * http://www.apache.org/licenses/LICENSE-2.0
25  *
26  * Unless required by applicable law or agreed to in writing, software
27  * distributed under the License is distributed on an "AS IS" BASIS,
28  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29  * See the License for the specific language governing permissions and
30  * limitations under the License.
31  */
32 
40 #pragma once
41 
42 // headers in STL
43 #include <stdio.h>
44 
45 // headers in CUDA
46 #include <cuda_runtime_api.h>
47 
48 namespace apollo {
49 namespace perception {
50 namespace lidar {
51 
52 // using MACRO to allocate memory inside CUDA kernel
53 #define NUM_3D_BOX_CORNERS_MACRO 8
54 #define NUM_2D_BOX_CORNERS_MACRO 4
55 #define NUM_THREADS_MACRO 64 // need to be changed when num_threads_ is changed
56 
57 #define DIVUP(m, n) ((m) / (n) + ((m) % (n) > 0))
58 
59 #define GPU_CHECK(ans) \
60  { GPUAssert((ans), __FILE__, __LINE__); }
61 inline void GPUAssert(cudaError_t code, const char* file, int line,
62  bool abort = true) {
63  if (code != cudaSuccess) {
64  fprintf(stderr, "GPUassert: %s %s %d\n", cudaGetErrorString(code), file,
65  line);
66  if (abort) exit(code);
67  }
68 }
69 
70 } // namespace lidar
71 } // namespace perception
72 } // namespace apollo
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
void GPUAssert(cudaError_t code, const char *file, int line, bool abort=true)
Definition: common.h:61