Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0cf42b0

Browse files
committed
Update op_cuda.hpp
1 parentf503890 commit0cf42b0

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

‎modules/dnn/src/op_cuda.cpp‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespacecv {namespacednn {
1313
CV__DNN_INLINE_NS_BEGIN
1414

15-
1615
voidNet::Impl::initCUDABackend(const std::vector<LayerPin>& blobsToKeep_)
1716
{
1817
CV_Assert(preferableBackend == DNN_BACKEND_CUDA);
@@ -107,3 +106,18 @@ void Net::Impl::initCUDABackend(const std::vector<LayerPin>& blobsToKeep_)
107106
CV__DNN_INLINE_NS_END
108107
}}// namespace cv::dnn
109108
#endif// HAVE_CUDA
109+
110+
namespacecv {namespacednn {
111+
112+
boolhaveCUDA()
113+
{
114+
#ifdef HAVE_CUDA
115+
int dev =0;
116+
staticbool ret = (cudaGetDevice(&dev) == cudaSuccess);
117+
return ret;
118+
#else
119+
returnfalse;
120+
#endif
121+
}
122+
123+
}}// namespace cv::dnn

‎modules/dnn/src/op_cuda.hpp‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,7 @@ namespace cv { namespace dnn {
2929
return id == DNN_TARGET_CUDA_FP16 || id == DNN_TARGET_CUDA;
3030
}
3131

32-
constexprboolhaveCUDA() {
33-
#ifdef HAVE_CUDA
34-
returntrue;
35-
#else
36-
returnfalse;
37-
#endif
38-
}
32+
boolhaveCUDA();
3933

4034
#ifdef HAVE_CUDA
4135
namespacecuda4dnn {namespacecsl {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp