aboutsummaryrefslogtreecommitdiff
path: root/ports/cuda
diff options
context:
space:
mode:
authorStefano Sinigardi <stesinigardi@hotmail.com>2021-04-14 00:15:32 +0200
committerGitHub <noreply@github.com>2021-04-13 15:15:32 -0700
commite3fee6ed406125f0a1dd1ea4b58e43315cb0284f (patch)
tree08505be2568541df2abe0ad69c62832f3ac13933 /ports/cuda
parent047525cc0442b06ef56bee7c63d731560d3bb375 (diff)
downloadvcpkg-e3fee6ed406125f0a1dd1ea4b58e43315cb0284f.tar.gz
vcpkg-e3fee6ed406125f0a1dd1ea4b58e43315cb0284f.zip
[cudnn] auto-download only if cuda version matches (#16413)
* [cudnn] auto-download only if cuda version matches * [cudnn] auto download also for cuda 10.2 * [cudnn] update version ref * Update ports/cuda/vcpkg_find_cuda.cmake Co-authored-by: Robert Schumacher <roschuma@microsoft.com> * Update ports/cuda/vcpkg_find_cuda.cmake Co-authored-by: Robert Schumacher <roschuma@microsoft.com> * Update ports/cudnn/portfile.cmake Co-authored-by: Robert Schumacher <roschuma@microsoft.com> * apply review fixes * fix baseline refs Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
Diffstat (limited to 'ports/cuda')
-rw-r--r--ports/cuda/CONTROL2
-rw-r--r--ports/cuda/portfile.cmake2
-rw-r--r--ports/cuda/vcpkg_find_cuda.cmake25
3 files changed, 15 insertions, 14 deletions
diff --git a/ports/cuda/CONTROL b/ports/cuda/CONTROL
index 8b0c0a671..d9719ab40 100644
--- a/ports/cuda/CONTROL
+++ b/ports/cuda/CONTROL
@@ -1,5 +1,5 @@
Source: cuda
Version: 10.1
-Port-Version: 5
+Port-Version: 7
Description: A parallel computing platform and programming model
Homepage: https://developer.nvidia.com/cuda-toolkit
diff --git a/ports/cuda/portfile.cmake b/ports/cuda/portfile.cmake
index ecdce4cfb..a4b202cd9 100644
--- a/ports/cuda/portfile.cmake
+++ b/ports/cuda/portfile.cmake
@@ -8,6 +8,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/vcpkg_find_cuda.cmake)
vcpkg_find_cuda(OUT_CUDA_TOOLKIT_ROOT CUDA_TOOLKIT_ROOT)
-file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg_find_cuda.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/vcpkg_find_cuda)
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg_find_cuda.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
diff --git a/ports/cuda/vcpkg_find_cuda.cmake b/ports/cuda/vcpkg_find_cuda.cmake
index f04d50983..64b758540 100644
--- a/ports/cuda/vcpkg_find_cuda.cmake
+++ b/ports/cuda/vcpkg_find_cuda.cmake
@@ -1,5 +1,5 @@
function(vcpkg_find_cuda)
- cmake_parse_arguments(PARSE_ARGV 0 vfc "" "OUT_CUDA_TOOLKIT_ROOT" "")
+ cmake_parse_arguments(PARSE_ARGV 0 vfc "" "OUT_CUDA_TOOLKIT_ROOT;OUT_CUDA_VERSION" "")
if(NOT vfc_OUT_CUDA_TOOLKIT_ROOT)
message(FATAL_ERROR "vcpkg_find_cuda() requres an OUT_CUDA_TOOLKIT_ROOT argument")
@@ -7,13 +7,11 @@ function(vcpkg_find_cuda)
set(CUDA_REQUIRED_VERSION "10.1.0")
- set(CUDA_PATHS
+ set(CUDA_PATHS
ENV CUDA_PATH
ENV CUDA_HOME
ENV CUDA_BIN_PATH
- ENV CUDA_PATH_V11_0
- ENV CUDA_PATH_V10_2
- ENV CUDA_PATH_V10_1)
+ ENV CUDA_TOOLKIT_ROOT_DIR)
if (VCPKG_TARGET_IS_WINDOWS)
find_program(NVCC
@@ -30,7 +28,7 @@ function(vcpkg_find_cuda)
else()
set(platform_base "/Developer/NVIDIA/CUDA-")
endif()
-
+
file(GLOB possible_paths "${platform_base}*")
set(FOUND_PATH )
foreach (p ${possible_paths})
@@ -43,7 +41,7 @@ function(vcpkg_find_cuda)
endif()
endif()
endforeach()
-
+
find_program(NVCC
NAMES nvcc
PATHS
@@ -77,16 +75,19 @@ function(vcpkg_find_cuda)
# Cuda compilation tools, release 8.0, V8.0.44
string(REGEX MATCH "V([0-9]+)\\.([0-9]+)\\.([0-9]+)" CUDA_VERSION ${NVCC_OUTPUT})
message(STATUS "Found CUDA ${CUDA_VERSION}")
- set(CUDA_VERSION_MAJOR ${CMAKE_MATCH_1})
- set(CUDA_VERSION_MINOR ${CMAKE_MATCH_2})
- set(CUDA_VERSION_PATCH ${CMAKE_MATCH_3})
+ set(CUDA_VERSION_MAJOR "${CMAKE_MATCH_1}")
+ set(CUDA_VERSION_MINOR "${CMAKE_MATCH_2}")
+ set(CUDA_VERSION_MAJOR_MINOR "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}")
- if ("${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}." VERSION_LESS ${CUDA_REQUIRED_VERSION})
- message(FATAL_ERROR "CUDA ${CUDA_VERSION} found, but v${CUDA_REQUIRED_VERSION} is required. Please download and install a more recent version of CUDA from:"
+ if (CUDA_VERSION_MAJOR_MINOR VERSION_LESS CUDA_REQUIRED_VERSION)
+ message(FATAL_ERROR "CUDA v${CUDA_VERSION_MAJOR_MINOR} found, but v${CUDA_REQUIRED_VERSION} is required. Please download and install a more recent version of CUDA from:"
"\n https://developer.nvidia.com/cuda-downloads\n")
endif()
get_filename_component(CUDA_TOOLKIT_ROOT "${NVCC}" DIRECTORY)
get_filename_component(CUDA_TOOLKIT_ROOT "${CUDA_TOOLKIT_ROOT}" DIRECTORY)
set(${vfc_OUT_CUDA_TOOLKIT_ROOT} "${CUDA_TOOLKIT_ROOT}" PARENT_SCOPE)
+ if(DEFINED vfc_OUT_CUDA_VERSION)
+ set(${vfc_OUT_CUDA_VERSION} "${CUDA_VERSION_MAJOR_MINOR}" PARENT_SCOPE)
+ endif()
endfunction()