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
e303b0dd
Commit
e303b0dd
authored
Feb 01, 2011
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added CUDA_ARCH_FEATUERS define (for correct handling of BIN(PTX) cases)
parent
5a166ca9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
CMakeLists.txt
CMakeLists.txt
+13
-8
initialization.cpp
modules/gpu/src/initialization.cpp
+2
-2
No files found.
CMakeLists.txt
View file @
e303b0dd
...
...
@@ -711,44 +711,49 @@ if(WITH_CUDA)
set
(
CUDA_ARCH_BIN
"1.3 2.0"
CACHE STRING
"Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported"
)
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_BIN_NO_POINTS
"
${
CUDA_ARCH_BIN
}
"
)
string
(
REGEX REPLACE
"
\\
."
""
ARCH_PTX_NO_POINTS
"
${
CUDA_ARCH_PTX
}
"
)
# Ckeck if user specified 1.0 compute capability
# Ckeck if user specified 1.0 compute capability
: we don't support it
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
(
CUDA_ARCH_BIN_OR_PTX_10 1
)
endif
()
#
F
lags to be set
#
NVCC f
lags to be set
set
(
NVCC_FLAGS_EXTRA
""
)
# These var
iables are passed into the template
# These var
s will be passed into the templates
set
(
OPENCV_CUDA_ARCH_BIN
""
)
set
(
OPENCV_CUDA_ARCH_PTX
""
)
set
(
OPENCV_CUDA_ARCH_FEATURES
""
)
# Tell
nvcc
to add binaries for the specified GPUs
# Tell
NVCC
to add binaries for the specified GPUs
string
(
REGEX MATCHALL
"[0-9()]+"
ARCH_LIST
"
${
ARCH_BIN_NO_POINTS
}
"
)
foreach
(
ARCH IN LISTS ARCH_LIST
)
if
(
ARCH MATCHES
"([0-9]+)
\\
(([0-9]+)
\\
)"
)
# User explicitly specified PTX for the concrete BIN
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
}
"
)
set
(
OPENCV_CUDA_ARCH_FEATURES
"
${
OPENCV_CUDA_ARCH_FEATURES
}
${
CMAKE_MATCH_2
}
"
)
else
()
# User didn't explicitly specify PTX for the concrete BIN, we assume PTX=BIN
set
(
NVCC_FLAGS_EXTRA
${
NVCC_FLAGS_EXTRA
}
-gencode arch=compute_
${
ARCH
}
,code=sm_
${
ARCH
}
)
set
(
OPENCV_CUDA_ARCH_BIN
"
${
OPENCV_CUDA_ARCH_BIN
}
${
ARCH
}
"
)
set
(
OPENCV_CUDA_ARCH_FEATURES
"
${
OPENCV_CUDA_ARCH_FEATURES
}
${
ARCH
}
"
)
endif
()
endforeach
()
# Tell
nvcc
to add PTX intermediate code for the specified architectures
# Tell
NVCC
to add PTX intermediate code for the specified architectures
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
()
set
(
OPENCV_CUDA_ARCH_FEATURES
"
${
OPENCV_CUDA_ARCH_FEATURES
}
${
ARCH
}
"
)
endforeach
()
#
Wil;
be processed in other scripts
#
These vars will
be processed in other scripts
set
(
CUDA_NVCC_FLAGS
${
CUDA_NVCC_FLAGS
}
${
NVCC_FLAGS_EXTRA
}
)
set
(
OpenCV_CUDA_CC
"
${
NVCC_FLAGS_EXTRA
}
"
)
...
...
modules/gpu/src/initialization.cpp
View file @
e303b0dd
...
...
@@ -72,9 +72,9 @@ namespace
CV_EXPORTS
bool
cv
::
gpu
::
TargetArchs
::
builtWith
(
cv
::
gpu
::
GpuFeature
feature
)
{
if
(
feature
==
NATIVE_DOUBLE
)
return
hasEqualOrGreater
(
1
,
3
);
return
::
compareToSet
(
CUDA_ARCH_FEATURES
,
13
,
std
::
greater_equal
<
int
>
()
);
if
(
feature
==
ATOMICS
)
return
hasEqualOrGreater
(
1
,
1
);
return
::
compareToSet
(
CUDA_ARCH_FEATURES
,
11
,
std
::
greater_equal
<
int
>
()
);
return
true
;
}
...
...
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