1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
5 #ifndef OPENCV_DNN_SRC_CUDA4DNN_CSL_ERROR_HPP
6 #define OPENCV_DNN_SRC_CUDA4DNN_CSL_ERROR_HPP
8 #include <opencv2/core.hpp>
10 #include <cuda_runtime_api.h>
12 #define CUDA4DNN_CHECK_CUDA(call) \
13 ::cv::dnn::cuda4dnn::csl::detail::check((call), CV_Func, __FILE__, __LINE__)
15 namespace cv { namespace dnn { namespace cuda4dnn { namespace csl {
16 /** @brief exception class for errors thrown by the CUDA APIs */
17 class CUDAException : public cv::Exception {
19 using cv::Exception::Exception;
23 inline void check(cudaError_t err, const char* func, const char* file, int line) {
24 if (err != cudaSuccess)
25 throw CUDAException(Error::GpuApiCallError, cudaGetErrorString(err), func, file, line);
28 }}}} /* namespace cv::dnn::cuda4dnn::csl */
30 #endif /* OPENCV_DNN_SRC_CUDA4DNN_CSL_ERROR_HPP */