Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
13a6d0b9
Commit
13a6d0b9
authored
Jan 27, 2011
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed parsing GPU archs in BIN(PTX) format
parent
d70d2edc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
14 deletions
+24
-14
CMakeLists.txt
CMakeLists.txt
+14
-4
cvconfig.h.cmake
cvconfig.h.cmake
+4
-4
initialization.cpp
modules/gpu/src/initialization.cpp
+5
-5
precomp.hpp
modules/gpu/src/precomp.hpp
+1
-1
No files found.
CMakeLists.txt
View file @
13a6d0b9
...
...
@@ -712,24 +712,32 @@ if(WITH_CUDA)
set
(
CUDA_ARCH_PTX
"1.1 1.3"
CACHE STRING
"Specify 'virtual' PTX architectures to build PTX intermediate code for"
)
# These variables are used in config templates
string
(
REGEX REPLACE
"
\\
."
""
ARCH_
GPU
_NO_POINTS
"
${
CUDA_ARCH_BIN
}
"
)
string
(
REGEX REPLACE
"
\\
."
""
ARCH_
BIN
_NO_POINTS
"
${
CUDA_ARCH_BIN
}
"
)
string
(
REGEX REPLACE
"
\\
."
""
ARCH_PTX_NO_POINTS
"
${
CUDA_ARCH_PTX
}
"
)
# Ckeck if user specified 1.0 compute capability
string
(
REGEX MATCH
"1.0"
HAS_ARCH_10
"
${
CUDA_ARCH_BIN
}
${
CUDA_ARCH_PTX
}
"
)
set
(
CUDA_ARCH_BIN_OR_PTX_10 0
)
if
(
NOT
${
HAS_ARCH_10
}
STREQUAL
""
)
set
(
OPENCV_ARCH_GPU
_OR_PTX_10 1
)
set
(
CUDA_ARCH_BIN
_OR_PTX_10 1
)
endif
()
set
(
NVCC_FLAGS_EXTRA
""
)
# Flags to be set
set
(
NVCC_FLAGS_EXTRA
""
)
# These variables are passed into the template
set
(
OPENCV_CUDA_ARCH_BIN
""
)
set
(
OPENCV_CUDA_ARCH_PTX
""
)
# Tell nvcc to add binaries for the specified GPUs
string
(
REGEX MATCHALL
"[0-9()]+"
ARCH_LIST
"
${
ARCH_
GPU
_NO_POINTS
}
"
)
string
(
REGEX MATCHALL
"[0-9()]+"
ARCH_LIST
"
${
ARCH_
BIN
_NO_POINTS
}
"
)
foreach
(
ARCH IN LISTS ARCH_LIST
)
if
(
ARCH MATCHES
"([0-9]+)
\\
(([0-9]+)
\\
)"
)
set
(
NVCC_FLAGS_EXTRA
${
NVCC_FLAGS_EXTRA
}
-gencode arch=compute_
${
CMAKE_MATCH_2
}
,code=sm_
${
CMAKE_MATCH_1
}
)
set
(
OPENCV_CUDA_ARCH_BIN
"
${
OPENCV_CUDA_ARCH_BIN
}
${
CMAKE_MATCH_1
}
"
)
else
()
set
(
NVCC_FLAGS_EXTRA
${
NVCC_FLAGS_EXTRA
}
-gencode arch=compute_
${
ARCH
}
,code=sm_
${
ARCH
}
)
set
(
OPENCV_CUDA_ARCH_BIN
"
${
OPENCV_CUDA_ARCH_BIN
}
${
ARCH
}
"
)
endif
()
endforeach
()
...
...
@@ -737,8 +745,10 @@ if(WITH_CUDA)
string
(
REGEX MATCHALL
"[0-9]+"
ARCH_LIST
"
${
ARCH_PTX_NO_POINTS
}
"
)
foreach
(
ARCH IN LISTS ARCH_LIST
)
set
(
NVCC_FLAGS_EXTRA
${
NVCC_FLAGS_EXTRA
}
-gencode arch=compute_
${
ARCH
}
,code=compute_
${
ARCH
}
)
set
(
OPENCV_CUDA_ARCH_PTX
"
${
OPENCV_CUDA_ARCH_PTX
}
${
ARCH
}
"
)
endforeach
()
# Wil; be processed in other scripts
set
(
CUDA_NVCC_FLAGS
${
CUDA_NVCC_FLAGS
}
${
NVCC_FLAGS_EXTRA
}
)
set
(
OpenCV_CUDA_CC
"
${
NVCC_FLAGS_EXTRA
}
"
)
...
...
cvconfig.h.cmake
View file @
13a6d0b9
...
...
@@ -167,13 +167,13 @@
#cmakedefine HAVE_CUDA
/* Compile for 'real' NVIDIA GPU architectures */
#define
OPENCV_ARCH_GPU "${ARCH_GPU_NO_POINTS
}"
#define
CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN
}"
/* Compile for 'virtual' NVIDIA PTX architectures */
#define
OPENCV_ARCH_PTX "${ARCH_PTX_NO_POINTS
}"
#define
CUDA_ARCH_PTX "${OPENCV_CUDA_ARCH_PTX
}"
/* Create PTX or
CU
BIN for 1.0 compute capability */
#cmakedefine
OPENCV_ARCH_GPU
_OR_PTX_10
/* Create PTX or BIN for 1.0 compute capability */
#cmakedefine
CUDA_ARCH_BIN
_OR_PTX_10
/* VideoInput library */
#cmakedefine HAVE_VIDEOINPUT
...
...
modules/gpu/src/initialization.cpp
View file @
13a6d0b9
...
...
@@ -164,33 +164,33 @@ namespace
CV_EXPORTS
bool
cv
::
gpu
::
hasPtxVersion
(
int
major
,
int
minor
)
{
return
::
compare
(
OPENCV
_ARCH_PTX
,
major
*
10
+
minor
,
std
::
equal_to
<
int
>
());
return
::
compare
(
CUDA
_ARCH_PTX
,
major
*
10
+
minor
,
std
::
equal_to
<
int
>
());
}
CV_EXPORTS
bool
cv
::
gpu
::
hasLessOrEqualPtxVersion
(
int
major
,
int
minor
)
{
return
::
compare
(
OPENCV
_ARCH_PTX
,
major
*
10
+
minor
,
return
::
compare
(
CUDA
_ARCH_PTX
,
major
*
10
+
minor
,
std
::
less_equal
<
int
>
());
}
CV_EXPORTS
bool
cv
::
gpu
::
hasGreaterOrEqualPtxVersion
(
int
major
,
int
minor
)
{
return
::
compare
(
OPENCV
_ARCH_PTX
,
major
*
10
+
minor
,
return
::
compare
(
CUDA
_ARCH_PTX
,
major
*
10
+
minor
,
std
::
greater_equal
<
int
>
());
}
CV_EXPORTS
bool
cv
::
gpu
::
hasCubinVersion
(
int
major
,
int
minor
)
{
return
::
compare
(
OPENCV_ARCH_GPU
,
major
*
10
+
minor
,
std
::
equal_to
<
int
>
());
return
::
compare
(
CUDA_ARCH_BIN
,
major
*
10
+
minor
,
std
::
equal_to
<
int
>
());
}
CV_EXPORTS
bool
cv
::
gpu
::
hasGreaterOrEqualCubinVersion
(
int
major
,
int
minor
)
{
return
::
compare
(
OPENCV_ARCH_GPU
,
major
*
10
+
minor
,
return
::
compare
(
CUDA_ARCH_BIN
,
major
*
10
+
minor
,
std
::
greater_equal
<
int
>
());
}
...
...
modules/gpu/src/precomp.hpp
View file @
13a6d0b9
...
...
@@ -85,7 +85,7 @@
#error "Insufficient NPP version, please update it."
#endif
#if defined(
OPENCV_ARCH_GPU
_OR_PTX_10)
#if defined(
CUDA_ARCH_BIN
_OR_PTX_10)
#error "OpenCV GPU module doesn't support NVIDIA compute capability 1.0"
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment