Apollo 11.0
自动驾驶开放平台
planning_block.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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#if GPU_PLATFORM == NVIDIA
20 #include <cuda_runtime.h>
21#elif GPU_PLATFORM == AMD
22 #include <hip/hip_runtime.h>
23 #define cudaDeviceProp hipDeviceProp_t
24 #define cudaDeviceReset hipDeviceReset
25 #define cudaDeviceSynchronize hipDeviceSynchronize
26 #define cudaError_t hipError_t
27 #define cudaFree hipFree
28 #define cudaGetDeviceProperties hipGetDeviceProperties
29 #define cudaGetErrorString hipGetErrorString
30 #define cudaMalloc hipMalloc
31 #define cudaMemcpy hipMemcpy
32 #define cudaMemcpyDeviceToHost hipMemcpyDeviceToHost
33 #define cudaMemcpyHostToDevice hipMemcpyHostToDevice
34 #define cudaSetDevice hipSetDevice
35 #define cudaSuccess hipSuccess
36#endif
37
38namespace apollo {
39namespace planning {
40
41#define BLOCK_1 256
42
43#define TEMPLATE_ROUTINE_INSTANCE(ret, routine) template ret routine
44
45#define DATA_TRANSFER_INST(type) \
46 TEMPLATE_ROUTINE_INSTANCE( \
47 bool, data_transfer(type *dst, const type *src, const int size))
48
49#define CUDA_CHECK(call) \
50 { \
51 const cudaError_t error = call; \
52 if (error != cudaSuccess) { \
53 printf("Error: %s:%d, ", __FILE__, __LINE__); \
54 printf("code: %d, reasone: %s\n", error, cudaGetErrorString(error)); \
55 return false; \
56 } \
57 }
58
60
61__global__ void fill_lower_left_gpu(int *iRow, int *jCol, unsigned int *rind_L,
62 unsigned int *cind_L, const int nnz_L);
63
64template <typename T>
65__global__ void data_transfer_gpu(T *dst, const T *src, const int size);
66
67bool fill_lower_left(int *iRow, int *jCol, unsigned int *rind_L,
68 unsigned int *cind_L, const int nnz_L);
69template <typename T>
70bool data_transfer(T *dst, const T *src, const int size);
71
72} // namespace planning
73} // namespace apollo
Planning module main class.
bool fill_lower_left(int *iRow, int *jCol, unsigned int *rind_L, unsigned int *cind_L, const int nnz_L)
__global__ void data_transfer_gpu(T *dst, const T *src, const int size)
__global__ void fill_lower_left_gpu(int *iRow, int *jCol, unsigned int *rind_L, unsigned int *cind_L, const int nnz_L)
bool data_transfer(T *dst, const T *src, const int size)
class register implement
Definition arena_queue.h:37