37 #ifdef BUILD_CUDA_MODULE 40 #include <cuda_runtime.h> 42 #define OPEN3D_HOST_DEVICE __host__ __device__ 43 #define OPEN3D_DEVICE __device__ 44 #define OPEN3D_ASSERT_HOST_DEVICE_LAMBDA(type) \ 45 static_assert(__nv_is_extended_host_device_lambda_closure_type(type), \ 46 #type " must be a __host__ __device__ lambda") 47 #define OPEN3D_CUDA_CHECK(err) \ 48 open3d::core::__OPEN3D_CUDA_CHECK(err, __FILE__, __LINE__) 49 #define OPEN3D_GET_LAST_CUDA_ERROR(message) \ 50 __OPEN3D_GET_LAST_CUDA_ERROR(message, __FILE__, __LINE__) 52 #define CUDA_CALL(cuda_function, ...) cuda_function(__VA_ARGS__); 54 #else // #ifdef BUILD_CUDA_MODULE 56 #define OPEN3D_HOST_DEVICE 58 #define OPEN3D_ASSERT_HOST_DEVICE_LAMBDA(type) 59 #define OPEN3D_CUDA_CHECK(err) 60 #define OPEN3D_GET_LAST_CUDA_ERROR(message) 61 #define CUDA_CALL(cuda_function, ...) \ 62 utility::LogError("Not built with CUDA, cannot call " #cuda_function); 64 #endif // #ifdef BUILD_CUDA_MODULE 69 #ifdef BUILD_CUDA_MODULE 70 inline void __OPEN3D_CUDA_CHECK(cudaError_t err,
73 if (err != cudaSuccess) {
75 cudaGetErrorString(err));
79 inline void __OPEN3D_GET_LAST_CUDA_ERROR(
const char* message,
82 cudaError_t err = cudaGetLastError();
83 if (err != cudaSuccess) {
85 line, message, cudaGetErrorString(err));
90 inline int GetCUDACurrentDeviceTextureAlignment() {
92 cudaError_t err = cudaGetDevice(&device);
93 if (err != cudaSuccess) {
95 "GetCUDACurrentDeviceTextureAlignment(): cudaGetDevice failed " 97 cudaGetErrorString(err));
101 err = cudaDeviceGetAttribute(&value, cudaDevAttrTextureAlignment, device);
102 if (err != cudaSuccess) {
104 "GetCUDACurrentDeviceTextureAlignment(): " 105 "cudaDeviceGetAttribute failed with {}",
106 cudaGetErrorString(err));
void ReleaseCache()
Definition: CUDAUtils.cpp:56
#define LogError(...)
Definition: Console.h:79
int DeviceCount()
Definition: CUDAUtils.cpp:41
bool IsAvailable()
Definition: CUDAUtils.cpp:54
Definition: PinholeCameraIntrinsic.cpp:35