ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cudacc.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <cuda_runtime.h>
11 
12 #include <string>
13 
14 #define CUDA_SAFE_CALL(error) CudaSafeCall(error, __FILE__, __LINE__)
15 #define CUDA_CHECK() CudaCheck(__FILE__, __LINE__)
16 #define CUDA_SYNC_AND_CHECK() CudaSyncAndCheck(__FILE__, __LINE__)
17 
18 namespace colmap {
19 
20 class CudaTimer {
21 public:
22  CudaTimer();
23  ~CudaTimer();
24 
25  void Print(const std::string& message);
26 
27 private:
28  cudaEvent_t start_;
29  cudaEvent_t stop_;
30  float elapsed_time_;
31 };
32 
33 void CudaSafeCall(const cudaError_t error,
34  const std::string& file,
35  const int line);
36 
37 void CudaCheck(const char* file, const int line);
38 void CudaSyncAndCheck(const char* file, const int line);
39 
40 } // namespace colmap
void Print(const std::string &message)
Definition: cudacc.cc:49
void CudaSyncAndCheck(const char *file, const int line)
Definition: cudacc.cc:78
void CudaCheck(const char *file, const int line)
Definition: cudacc.cc:68
void CudaSafeCall(const cudaError_t error, const std::string &file, const int line)
Definition: cudacc.cc:58