Apollo
v5.5.0
Open source self driving car software
modules
perception
base
common.h
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright 2018 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
#pragma once
18
19
#ifndef PERCEPTION_CPU_ONLY
20
21
#include <cublas_v2.h>
22
#include <cuda_runtime.h>
23
24
#endif
25
26
namespace
apollo
{
27
namespace
perception {
28
namespace
base {
29
30
#ifndef NO_GPU
31
#define NO_GPU assert(false)
32
#endif
33
34
#ifndef PERCEPTION_CPU_ONLY
35
36
#define BASE_CUDA_CHECK(condition) \
37
{ apollo::perception::base::GPUAssert((condition), __FILE__, __LINE__); }
38
39
inline
void
GPUAssert
(cudaError_t code,
const
char
*file,
int
line,
40
bool
abort =
true
) {
41
if
(code != cudaSuccess) {
42
fprintf(stderr,
"GPUassert: %s %s %d\n"
, cudaGetErrorString(code), file,
43
line);
44
if
(abort) {
45
exit(code);
46
}
47
}
48
}
49
50
#endif
51
52
}
// namespace base
53
}
// namespace perception
54
}
// namespace apollo
apollo
Definition:
blob.h:72
apollo::perception::base::GPUAssert
void GPUAssert(cudaError_t code, const char *file, int line, bool abort=true)
Definition:
common.h:39
Generated by
1.8.13