diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8cc7bc4c..aa67e0af 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,10 +1,12 @@ include: - 'https://raw.githubusercontent.com/JuliaGPU/gitlab-ci/master/templates/v6.yml' -image: nvidia/cuda:10.1-cudnn7-devel +image: ubuntu:bionic variables: JULIA_CUDA_VERBOSE: 'true' + NVIDIA_VISIBLE_DEVICES: 'all' + NVIDIA_DRIVER_CAPABILITIES: 'compute,utility' # Julia versions @@ -37,29 +39,56 @@ julia:nightly: # https://developer.nvidia.com/rdp/cudnn-archive cuda:10.1: - image: nvidia/cuda:10.1-cudnn7-devel extends: - .julia:1.3 - .test + variables: + JULIA_CUDA_VERSION: '10.1' tags: - nvidia cuda:10.0: - image: nvidia/cuda:10.0-cudnn7-devel extends: - .julia:1.3 - .test + variables: + JULIA_CUDA_VERSION: '10.0' tags: - nvidia cuda:9.2: - image: nvidia/cuda:9.2-cudnn7-devel extends: - .julia:1.3 - .test + variables: + JULIA_CUDA_VERSION: '9.2' tags: - nvidia +# NOTE: CUDA 9.0 is broken + +cuda:local: + extends: + - .julia:1.3 + - .test + image: nvidia/cuda:10.1-devel-ubuntu18.04 + variables: + JULIA_CUDA_USE_BINARYBUILDER: 'false' + tags: + - nvidia + +cuda:none: + extends: + - .julia:1.3 + - .test + variables: + JULIA_CUDA_USE_BINARYBUILDER: 'false' + script: + - julia --project -e 'using Pkg; + Pkg.instantiate(); + Pkg.build(); + Pkg.API.precompile()' + # hardware platforms @@ -101,17 +130,6 @@ pool:split: variables: CUARRAYS_MEMORY_POOL: 'split' -precompile: - extends: - - .julia:1.3 - - .test - image: ubuntu:bionic - script: - - julia --project -e 'using Pkg; - Pkg.instantiate(); - Pkg.build(); - Pkg.API.precompile()' - debug: extends: - .julia:1.3 diff --git a/Manifest.toml b/Manifest.toml index 1cc24d65..71f399b0 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -28,9 +28,9 @@ version = "0.2.0" [[CUDAapi]] deps = ["Libdl", "Logging"] -git-tree-sha1 = "d9614968b9a13df433870115acff20f41e7b400a" +git-tree-sha1 = "d7ceadd8f821177d05b897c0517e94633db535fe" uuid = "3895d2a7-ec45-59b8-82bb-cfc6a382f9b3" -version = "3.0.0" +version = "3.1.0" [[CUDAdrv]] deps = ["CEnum", "CUDAapi", "Printf"] @@ -39,10 +39,12 @@ uuid = "c5f51814-7f29-56b8-a69c-e4d8f6be1fde" version = "6.0.0" [[CUDAnative]] -deps = ["Adapt", "CEnum", "CUDAapi", "CUDAdrv", "DataStructures", "InteractiveUtils", "LLVM", "Libdl", "Printf", "TimerOutputs"] -git-tree-sha1 = "59d6c3e313b874abc718f7d6ad02ea604f96db14" +deps = ["Adapt", "BinaryProvider", "CEnum", "CUDAapi", "CUDAdrv", "DataStructures", "InteractiveUtils", "LLVM", "Libdl", "Pkg", "Printf", "TimerOutputs"] +git-tree-sha1 = "52884ca07509c515d12fddc94e82270a2766702a" +repo-rev = "tb/binarybuilder" +repo-url = "https://github.com/JuliaGPU/CUDAnative.jl.git" uuid = "be33ccc6-a3ff-5ff2-a52e-74243cff1e17" -version = "2.10.0" +version = "2.10.2" [[DataStructures]] deps = ["InteractiveUtils", "OrderedCollections"] diff --git a/src/CuArrays.jl b/src/CuArrays.jl index 97f9e159..d3b42c90 100644 --- a/src/CuArrays.jl +++ b/src/CuArrays.jl @@ -18,6 +18,8 @@ using Requires ## source code includes +include("bindeps.jl") + # core array functionality include("memory.jl") include("array.jl") @@ -66,62 +68,7 @@ function __init__() end try - # discover libraries - toolkit = find_toolkit() - for name in ("cublas", "cusparse", "cusolver", "cufft", "curand", "cudnn", "cutensor") - mod = getfield(CuArrays, Symbol(uppercase(name))) - lib = Symbol("lib$name") - handle = getfield(mod, lib) - - # on Windows, the library name is version dependent - if Sys.iswindows() - cuda = CUDAnative.version() - suffix = cuda >= v"10.1" ? "$(cuda.major)" : "$(cuda.major)$(cuda.minor)" - handle[] = "$(name)$(Sys.WORD_SIZE)_$(suffix)" - end - - # check if we can't find the library - if Libdl.dlopen_e(handle[]) == C_NULL - path = find_cuda_library(name, CUDAnative.prefix(), [CUDAnative.version()]) - if path !== nothing - handle[] = path - end - end - end - - # library dependencies - CUBLAS.version() - CUSPARSE.version() - CUSOLVER.version() - CUFFT.version() - CURAND.version() - # CUDNN and CUTENSOR are optional - - # library compatibility - if has_cutensor() - cutensor = CUTENSOR.version() - if cutensor < v"1" - silent || @warn("CuArrays.jl only supports CUTENSOR 1.0 or higher") - end - - cuda = CUDAnative.version() - cutensor_cuda = CUTENSOR.cuda_version() - if cutensor_cuda.major != cuda.major || cutensor_cuda.minor != cuda.minor - silent || @warn("You are using CUTENSOR $cutensor for CUDA $cutensor_cuda with CUDA toolkit $cuda; these might be incompatible.") - end - end - if has_cudnn() - cudnn = CUDNN.version() - if cudnn < v"7.6" - silent || @warn("CuArrays.jl only supports CUDNN v7.6 or higher") - end - - cuda = CUDAnative.version() - cudnn_cuda = CUDNN.cuda_version() - if cudnn_cuda.major != cuda.major || cudnn_cuda.minor != cuda.minor - silent || @warn("You are using CUDNN $cudnn for CUDA $cudnn_cuda with CUDA toolkit $cuda; these might be incompatible.") - end - end + __init_bindeps__(silent=silent, verbose=verbose) # package integrations @require ForwardDiff="f6369f11-7733-5829-9624-2563aa707210" include("forwarddiff.jl") diff --git a/src/bindeps.jl b/src/bindeps.jl new file mode 100644 index 00000000..0a8234a5 --- /dev/null +++ b/src/bindeps.jl @@ -0,0 +1,66 @@ +# discovering binary CUDA dependencies + +function __init_bindeps__(; silent=false, verbose=false) + # discover libraries + for (name,version) in (("cublas", CUDAnative.version()), + ("cusparse", CUDAnative.version()), + ("cusolver", CUDAnative.version()), + ("cufft", CUDAnative.version()), + ("curand", CUDAnative.version()), + ("cudnn", v"7"), + ("cutensor", v"1")) + mod = getfield(CuArrays, Symbol(uppercase(name))) + handle = getfield(mod, Symbol("lib$name")) + + # on Windows, the library name is version dependent + if Sys.iswindows() + cuda = CUDAnative.version() + suffix = cuda >= v"10.1" ? "$(cuda.major)" : "$(cuda.major)$(cuda.minor)" + handle[] = "$(name)$(Sys.WORD_SIZE)_$(suffix)" + end + + if CUDAnative.uses_artifacts[] + artifact = first(CUDAnative.prefix()) + handle[] = CUDAnative.get_library(Sys.iswindows() ? handle[] : name, artifact) + else + path = find_cuda_library(name, CUDAnative.prefix(), [version]) + if path !== nothing + handle[] = path + end + end + end + + # library dependencies + CUBLAS.version() + CUSPARSE.version() + CUSOLVER.version() + CUFFT.version() + CURAND.version() + # CUDNN and CUTENSOR are optional + + # library compatibility + if has_cutensor() + cutensor = CUTENSOR.version() + if cutensor < v"1" + silent || @warn("CuArrays.jl only supports CUTENSOR 1.0 or higher") + end + + cuda = CUDAnative.version() + cutensor_cuda = CUTENSOR.cuda_version() + if cutensor_cuda.major != cuda.major || cutensor_cuda.minor != cuda.minor + silent || @warn("You are using CUTENSOR $cutensor for CUDA $cutensor_cuda with CUDA toolkit $cuda; these might be incompatible.") + end + end + if has_cudnn() + cudnn = CUDNN.version() + if cudnn < v"7.6" + silent || @warn("CuArrays.jl only supports CUDNN v7.6 or higher") + end + + cuda = CUDAnative.version() + cudnn_cuda = CUDNN.cuda_version() + if cudnn_cuda.major != cuda.major || cudnn_cuda.minor != cuda.minor + silent || @warn("You are using CUDNN $cudnn for CUDA $cudnn_cuda with CUDA toolkit $cuda; these might be incompatible.") + end + end +end