Apollo 10.0
自动驾驶开放平台
cuda_util.h
浏览该文件的文档.
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#include <vector>
18
19#if GPU_PLATFORM == NVIDIA
20 #include <cuda_runtime_api.h>
21 #include <cublas_v2.h>
22#elif GPU_PLATFORM == AMD
23 #include <hip/hip_runtime.h>
24 #include <hip/hip_runtime_api.h>
25 #include <hipblas.h>
26 #define cudaError_t hipError_t
27 #define cudaFree hipFree
28 #define cudaMalloc hipMalloc
29 #define cudaMemcpy hipMemcpy
30 #define cudaMemcpyHostToDevice hipMemcpyHostToDevice
31 #define cudaSuccess hipSuccess
32 #define CUBLAS_STATUS_SUCCESS HIPBLAS_STATUS_SUCCESS
33 #define cublasCreate hipblasCreate
34 #define cublasHandle_t hipblasHandle_t
35 #define cublasIdamin hipblasIdamin
36 #define cublasStatus_t hipblasStatus_t
37#endif
38
41
42namespace apollo {
43namespace pnc_map {
44
46 double x1;
47 double y1;
48 double x2;
49 double y2;
50};
51
53 public:
55
57 const std::vector<apollo::common::math::LineSegment2d>& segments);
58
59 int FindNearestSegment(double x, double y);
60
62
63 private:
64 std::size_t size_ = 0;
65 CudaLineSegment2d* host_seg_;
66 double* dev_dist_;
67 CudaLineSegment2d* dev_seg_;
68 cublasHandle_t handle_;
69};
70
71} // namespace pnc_map
72} // namespace apollo
bool UpdateLineSegment(const std::vector< apollo::common::math::LineSegment2d > &segments)
int FindNearestSegment(double x, double y)
Define the LineSegment2d class.
class register implement
Definition arena_queue.h:37
Defines the Vec2d class.