diff options
| author | Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> | 2020-05-08 03:35:22 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-07 12:35:22 -0700 |
| commit | 164284d86be7590f0162a18f9189eded1caa5374 (patch) | |
| tree | 811ff88ab72648342ce25498179b5046f1f0e579 | |
| parent | 5890810241c4c7f95ecac433245a01ed1cf014e8 (diff) | |
| download | vcpkg-164284d86be7590f0162a18f9189eded1caa5374.tar.gz vcpkg-164284d86be7590f0162a18f9189eded1caa5374.zip | |
[cuda] Fix find cuda in UNIX (#10838)
* [cuda] Fix find cuda in UNIX
* update baseline
* [cuda] Add homepage
* add newline to end of CONTROL
* Update ports/cuda/portfile.cmake
Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
| -rw-r--r-- | ports/cuda/CONTROL | 3 | ||||
| -rw-r--r-- | ports/cuda/portfile.cmake | 58 | ||||
| -rw-r--r-- | scripts/ci.baseline.txt | 1 |
3 files changed, 48 insertions, 14 deletions
diff --git a/ports/cuda/CONTROL b/ports/cuda/CONTROL index ba5208c2f..cf909e0ce 100644 --- a/ports/cuda/CONTROL +++ b/ports/cuda/CONTROL @@ -1,3 +1,4 @@ Source: cuda -Version: 10.1 +Version: 10.1-1 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 63e3f9cee..63c761a1a 100644 --- a/ports/cuda/portfile.cmake +++ b/ports/cuda/portfile.cmake @@ -2,14 +2,50 @@ # Other packages can depend on this package to declare a dependency on CUDA. # If this package is installed, we assume that CUDA is properly installed. -find_program(NVCC - NAMES nvcc nvcc.exe - PATHS - ENV CUDA_PATH - ENV CUDA_BIN_PATH - PATH_SUFFIXES bin bin64 - DOC "Toolkit location." - NO_DEFAULT_PATH) +#note: this port must be kept in sync with CUDNN port: every time one is upgraded, the other must be too +set(CUDA_REQUIRED_VERSION "10.1.0") + +if (VCPKG_TARGET_IS_WINDOWS) + find_program(NVCC + NAMES nvcc.exe + PATHS + ENV CUDA_PATH + ENV CUDA_BIN_PATH + PATH_SUFFIXES bin bin64 + DOC "Toolkit location." + NO_DEFAULT_PATH + ) +else() + if (VCPKG_TARGET_IS_LINUX) + set(platform_base "/usr/local/cuda-") + else() + set(platform_base "/Developer/NVIDIA/CUDA-") + endif() + + file(GLOB possible_paths "${platform_base}*") + set(FOUND_PATH ) + foreach (p ${possible_paths}) + # Extract version number from end of string + string(REGEX MATCH "[0-9][0-9]?\\.[0-9]$" p_version ${p}) + if (IS_DIRECTORY ${p} AND p_version) + if (p_version VERSION_GREATER_EQUAL CUDA_REQUIRED_VERSION) + set(FOUND_PATH ${p}) + break() + endif() + endif() + endforeach() + + find_program(NVCC + NAMES nvcc + PATHS + ENV CUDA_PATH + ENV CUDA_BIN_PATH + PATHS ${FOUND_PATH} + PATH_SUFFIXES bin bin64 + DOC "Toolkit location." + NO_DEFAULT_PATH + ) +endif() set(error_code 1) if (NVCC) @@ -19,11 +55,9 @@ if (NVCC) RESULT_VARIABLE error_code) endif() -#note: this port must be kept in sync with CUDNN port: every time one is upgraded, the other must be too -set(CUDA_REQUIRED_VERSION "V10.1.0") if (error_code) - message(FATAL_ERROR "Could not find CUDA. Before continuing, please download and install CUDA (${CUDA_REQUIRED_VERSION} or higher) from:" + message(FATAL_ERROR "Could not find CUDA. Before continuing, please download and install CUDA (v${CUDA_REQUIRED_VERSION} or higher) from:" "\n https://developer.nvidia.com/cuda-downloads\n") endif() @@ -39,7 +73,7 @@ set(CUDA_VERSION_MINOR ${CMAKE_MATCH_2}) set(CUDA_VERSION_PATCH ${CMAKE_MATCH_3}) if (CUDA_VERSION_MAJOR LESS 10 AND CUDA_VERSION_MINOR LESS 1) - message(FATAL_ERROR "CUDA ${CUDA_VERSION} found, but ${CUDA_REQUIRED_VERSION} is required. Please download and install a more recent version of CUDA from:" + 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:" "\n https://developer.nvidia.com/cuda-downloads\n") endif() diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 435dc8f49..7fcbbd9b5 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -301,7 +301,6 @@ ctemplate:arm64-windows=fail ctemplate:arm-uwp=fail
ctemplate:x64-linux=fail
ctemplate:x64-osx=fail
-cuda:x64-linux=fail
cuda:x64-osx=fail
cudnn:arm64-windows=fail
cudnn:arm-uwp=fail
|
