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
957c85e9
Commit
957c85e9
authored
Oct 29, 2013
by
Roman Donchenko
Committed by
OpenCV Buildbot
Oct 29, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1670 from jet47:cuda-cmake-fix
parents
c5e8a9a2
06c1f9a3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
206 additions
and
46 deletions
+206
-46
FindCUDA.cmake
cmake/FindCUDA.cmake
+0
-0
make2cmake.cmake
cmake/FindCUDA/make2cmake.cmake
+93
-0
parse_cubin.cmake
cmake/FindCUDA/parse_cubin.cmake
+110
-0
run_nvcc.cmake
cmake/FindCUDA/run_nvcc.cmake
+0
-0
OpenCVDetectCUDA.cmake
cmake/OpenCVDetectCUDA.cmake
+3
-46
No files found.
cmake/FindCUDA.cmake
0 → 100644
View file @
957c85e9
This diff is collapsed.
Click to expand it.
cmake/FindCUDA/make2cmake.cmake
0 → 100644
View file @
957c85e9
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
#
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
#
# Copyright (c) 2007-2009
# Scientific Computing and Imaging Institute, University of Utah
#
# This code is licensed under the MIT License. See the FindCUDA.cmake script
# for the text of the license.
# The MIT License
#
# License for the specific language governing rights and limitations under
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
#######################################################################
# This converts a file written in makefile syntax into one that can be included
# by CMake.
file
(
READ
${
input_file
}
depend_text
)
if
(
${
depend_text
}
MATCHES
".+"
)
# message("FOUND DEPENDS")
# Remember, four backslashes is escaped to one backslash in the string.
string
(
REGEX REPLACE
"
\\\\
"
" "
depend_text
${
depend_text
}
)
# This works for the nvcc -M generated dependency files.
string
(
REGEX REPLACE
"^.* : "
""
depend_text
${
depend_text
}
)
string
(
REGEX REPLACE
"[
\\\\
]*
\n
"
";"
depend_text
${
depend_text
}
)
set
(
dependency_list
""
)
foreach
(
file
${
depend_text
}
)
string
(
REGEX REPLACE
"^ +"
""
file
${
file
}
)
# OK, now if we had a UNC path, nvcc has a tendency to only output the first '/'
# instead of '//'. Here we will test to see if the file exists, if it doesn't then
# try to prepend another '/' to the path and test again. If it still fails remove the
# path.
if
(
NOT EXISTS
"
${
file
}
"
)
if
(
EXISTS
"/
${
file
}
"
)
set
(
file
"/
${
file
}
"
)
else
()
message
(
WARNING
" Removing non-existent dependency file:
${
file
}
"
)
set
(
file
""
)
endif
()
endif
()
if
(
NOT IS_DIRECTORY
"
${
file
}
"
)
# If softlinks start to matter, we should change this to REALPATH. For now we need
# to flatten paths, because nvcc can generate stuff like /bin/../include instead of
# just /include.
get_filename_component
(
file_absolute
"
${
file
}
"
ABSOLUTE
)
list
(
APPEND dependency_list
"
${
file_absolute
}
"
)
endif
()
endforeach
()
else
()
# message("FOUND NO DEPENDS")
endif
()
# Remove the duplicate entries and sort them.
list
(
REMOVE_DUPLICATES dependency_list
)
list
(
SORT dependency_list
)
foreach
(
file
${
dependency_list
}
)
set
(
cuda_nvcc_depend
"
${
cuda_nvcc_depend
}
\"
${
file
}
\"\n
"
)
endforeach
()
file
(
WRITE
${
output_file
}
"# Generated by: make2cmake.cmake
\n
SET(CUDA_NVCC_DEPEND
\n
${
cuda_nvcc_depend
}
)
\n\n
"
)
cmake/FindCUDA/parse_cubin.cmake
0 → 100644
View file @
957c85e9
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
#
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
#
# Copyright (c) 2007-2009
# Scientific Computing and Imaging Institute, University of Utah
#
# This code is licensed under the MIT License. See the FindCUDA.cmake script
# for the text of the license.
# The MIT License
#
# License for the specific language governing rights and limitations under
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
#######################################################################
# Parses a .cubin file produced by nvcc and reports statistics about the file.
file
(
READ
${
input_file
}
file_text
)
if
(
${
file_text
}
MATCHES
".+"
)
# Remember, four backslashes is escaped to one backslash in the string.
string
(
REGEX REPLACE
";"
"
\\\\
;"
file_text
${
file_text
}
)
string
(
REGEX REPLACE
"
\n
code"
";code"
file_text
${
file_text
}
)
list
(
LENGTH file_text len
)
foreach
(
line
${
file_text
}
)
# Only look at "code { }" blocks.
if
(
line MATCHES
"^code"
)
# Break into individual lines.
string
(
REGEX REPLACE
"
\n
"
";"
line
${
line
}
)
foreach
(
entry
${
line
}
)
# Extract kernel names.
if
(
${
entry
}
MATCHES
"[^g]name = ([^ ]+)"
)
string
(
REGEX REPLACE
".* = ([^ ]+)"
"
\\
1"
entry
${
entry
}
)
# Check to see if the kernel name starts with "_"
set
(
skip FALSE
)
# if (${entry} MATCHES "^_")
# Skip the rest of this block.
# message("Skipping ${entry}")
# set(skip TRUE)
# else ()
message
(
"Kernel:
${
entry
}
"
)
# endif ()
endif
()
# Skip the rest of the block if necessary
if
(
NOT skip
)
# Registers
if
(
${
entry
}
MATCHES
"reg([ ]+)=([ ]+)([^ ]+)"
)
string
(
REGEX REPLACE
".*([ ]+)=([ ]+)([^ ]+)"
"
\\
3"
entry
${
entry
}
)
message
(
"Registers:
${
entry
}
"
)
endif
()
# Local memory
if
(
${
entry
}
MATCHES
"lmem([ ]+)=([ ]+)([^ ]+)"
)
string
(
REGEX REPLACE
".*([ ]+)=([ ]+)([^ ]+)"
"
\\
3"
entry
${
entry
}
)
message
(
"Local:
${
entry
}
"
)
endif
()
# Shared memory
if
(
${
entry
}
MATCHES
"smem([ ]+)=([ ]+)([^ ]+)"
)
string
(
REGEX REPLACE
".*([ ]+)=([ ]+)([^ ]+)"
"
\\
3"
entry
${
entry
}
)
message
(
"Shared:
${
entry
}
"
)
endif
()
if
(
${
entry
}
MATCHES
"^}"
)
message
(
""
)
endif
()
endif
()
endforeach
()
endif
()
endforeach
()
else
()
# message("FOUND NO DEPENDS")
endif
()
cmake/FindCUDA/run_nvcc.cmake
0 → 100644
View file @
957c85e9
This diff is collapsed.
Click to expand it.
cmake/OpenCVDetectCUDA.cmake
View file @
957c85e9
...
...
@@ -13,7 +13,9 @@ if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Cl
return
()
endif
()
find_package
(
CUDA 4.2 QUIET
)
set
(
CMAKE_MODULE_PATH
"
${
OpenCV_SOURCE_DIR
}
/cmake"
${
CMAKE_MODULE_PATH
}
)
find_host_package
(
CUDA 4.2 QUIET
)
if
(
CUDA_FOUND
)
set
(
HAVE_CUDA 1
)
...
...
@@ -26,47 +28,6 @@ if(CUDA_FOUND)
set
(
HAVE_CUBLAS 1
)
endif
()
if
(
${
CUDA_VERSION
}
VERSION_LESS
"5.5"
)
find_cuda_helper_libs
(
npp
)
else
()
# hack for CUDA 5.5
if
(
${
CMAKE_SYSTEM_PROCESSOR
}
STREQUAL
"arm"
)
unset
(
CUDA_TOOLKIT_INCLUDE CACHE
)
unset
(
CUDA_CUDART_LIBRARY CACHE
)
unset
(
CUDA_cublas_LIBRARY CACHE
)
unset
(
CUDA_cufft_LIBRARY CACHE
)
unset
(
CUDA_npp_LIBRARY CACHE
)
if
(
SOFTFP
)
set
(
cuda_arm_path
"
${
CUDA_TOOLKIT_ROOT_DIR
}
/targets/armv7-linux-gnueabi"
)
else
()
set
(
cuda_arm_path
"
${
CUDA_TOOLKIT_ROOT_DIR
}
/targets/armv7-linux-gnueabihf"
)
endif
()
set
(
CUDA_TOOLKIT_INCLUDE
"
${
cuda_arm_path
}
/include"
CACHE PATH
"include path"
)
set
(
CUDA_INCLUDE_DIRS
${
CUDA_TOOLKIT_INCLUDE
}
)
set
(
cuda_arm_library_path
"
${
cuda_arm_path
}
/lib"
)
set
(
CUDA_CUDART_LIBRARY
"
${
cuda_arm_library_path
}
/libcudart.so"
CACHE FILEPATH
"cudart library"
)
set
(
CUDA_LIBRARIES
${
CUDA_CUDART_LIBRARY
}
)
set
(
CUDA_cublas_LIBRARY
"
${
cuda_arm_library_path
}
/libcublas.so"
CACHE FILEPATH
"cublas library"
)
set
(
CUDA_cufft_LIBRARY
"
${
cuda_arm_library_path
}
/libcufft.so"
CACHE FILEPATH
"cufft library"
)
set
(
CUDA_nppc_LIBRARY
"
${
cuda_arm_library_path
}
/libnppc.so"
CACHE FILEPATH
"nppc library"
)
set
(
CUDA_nppi_LIBRARY
"
${
cuda_arm_library_path
}
/libnppi.so"
CACHE FILEPATH
"nppi library"
)
set
(
CUDA_npps_LIBRARY
"
${
cuda_arm_library_path
}
/libnpps.so"
CACHE FILEPATH
"npps library"
)
set
(
CUDA_npp_LIBRARY
"
${
CUDA_nppc_LIBRARY
}
;
${
CUDA_nppi_LIBRARY
}
;
${
CUDA_npps_LIBRARY
}
"
CACHE STRING
"npp library"
)
else
()
unset
(
CUDA_npp_LIBRARY CACHE
)
find_cuda_helper_libs
(
nppc
)
find_cuda_helper_libs
(
nppi
)
find_cuda_helper_libs
(
npps
)
set
(
CUDA_npp_LIBRARY
"
${
CUDA_nppc_LIBRARY
}
;
${
CUDA_nppi_LIBRARY
}
;
${
CUDA_npps_LIBRARY
}
"
CACHE STRING
"npp library"
)
endif
()
endif
()
if
(
WITH_NVCUVID
)
find_cuda_helper_libs
(
nvcuvid
)
set
(
HAVE_NVCUVID 1
)
...
...
@@ -168,10 +129,6 @@ if(CUDA_FOUND)
set
(
OPENCV_CUDA_ARCH_FEATURES
"
${
OPENCV_CUDA_ARCH_FEATURES
}
${
ARCH
}
"
)
endforeach
()
if
(
${
CMAKE_SYSTEM_PROCESSOR
}
STREQUAL
"arm"
)
set
(
CUDA_NVCC_FLAGS
"
${
CUDA_NVCC_FLAGS
}
--target-cpu-architecture=ARM"
)
endif
()
# 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
}
"
)
...
...
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