Merge pull request #924 from FluxML/tb/cuda_init

CUDA package initialization improvements
This commit is contained in:
Tim Besard 2019-11-19 16:48:45 +01:00 committed by GitHub
commit 2fa3e5673e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 18 deletions

View File

@ -94,9 +94,9 @@ version = "1.3.0"
[[CuArrays]] [[CuArrays]]
deps = ["AbstractFFTs", "Adapt", "CEnum", "CUDAapi", "CUDAdrv", "CUDAnative", "DataStructures", "GPUArrays", "Libdl", "LinearAlgebra", "MacroTools", "NNlib", "Printf", "Random", "Requires", "SparseArrays", "TimerOutputs"] deps = ["AbstractFFTs", "Adapt", "CEnum", "CUDAapi", "CUDAdrv", "CUDAnative", "DataStructures", "GPUArrays", "Libdl", "LinearAlgebra", "MacroTools", "NNlib", "Printf", "Random", "Requires", "SparseArrays", "TimerOutputs"]
git-tree-sha1 = "6a05c9e40b99a6e9a7973ca93397a38d3e8a7b4b" git-tree-sha1 = "4757376a85ffb27d4c4f6cdf9635261e6c3a5fec"
uuid = "3a865a2d-5b23-5a0f-bc46-62713ec82fae" uuid = "3a865a2d-5b23-5a0f-bc46-62713ec82fae"
version = "1.4.6" version = "1.4.7"
[[DataAPI]] [[DataAPI]]
git-tree-sha1 = "674b67f344687a88310213ddfa8a2b3c76cc4252" git-tree-sha1 = "674b67f344687a88310213ddfa8a2b3c76cc4252"
@ -141,9 +141,9 @@ version = "1.0.1"
[[FillArrays]] [[FillArrays]]
deps = ["LinearAlgebra", "Random", "SparseArrays"] deps = ["LinearAlgebra", "Random", "SparseArrays"]
git-tree-sha1 = "6827a8f73ff12707f209c920d204238a16892b55" git-tree-sha1 = "b2cf74f09216cfe3c241e8484178ec0ea941870f"
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b" uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
version = "0.8.0" version = "0.8.1"
[[FixedPointNumbers]] [[FixedPointNumbers]]
git-tree-sha1 = "d14a6fa5890ea3a7e5dcab6811114f132fec2b4b" git-tree-sha1 = "d14a6fa5890ea3a7e5dcab6811114f132fec2b4b"
@ -335,9 +335,9 @@ uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[[TimerOutputs]] [[TimerOutputs]]
deps = ["Printf"] deps = ["Printf"]
git-tree-sha1 = "8f22dc0c23e1cd4ab8070a01ba32285926f104f1" git-tree-sha1 = "311765af81bbb48d7bad01fb016d9c328c6ede03"
uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
version = "0.5.2" version = "0.5.3"
[[TranscodingStreams]] [[TranscodingStreams]]
deps = ["Random", "Test"] deps = ["Random", "Test"]

View File

@ -5,7 +5,6 @@ version = "0.9.0"
[deps] [deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
CUDAdrv = "c5f51814-7f29-56b8-a69c-e4d8f6be1fde"
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193" CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
CuArrays = "3a865a2d-5b23-5a0f-bc46-62713ec82fae" CuArrays = "3a865a2d-5b23-5a0f-bc46-62713ec82fae"
@ -25,8 +24,7 @@ ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
[compat] [compat]
CUDAdrv = "4.0.1" CuArrays = "1.4.3"
CuArrays = "1.4.2"
NNlib = "0.6" NNlib = "0.6"
Zygote = "0.4" Zygote = "0.4"
julia = "1" julia = "1"

View File

@ -21,8 +21,7 @@ export SGD, Descent, ADAM, Momentum, Nesterov, RMSProp,
ADAMW, RADAM, InvDecay, ExpDecay, WeightDecay ADAMW, RADAM, InvDecay, ExpDecay, WeightDecay
ENV["CUDA_INIT_SILENT"] = true using CuArrays
using CUDAdrv, CuArrays
const use_cuda = Ref(false) const use_cuda = Ref(false)
include("utils.jl") include("utils.jl")
@ -40,12 +39,8 @@ include("data/Data.jl")
include("deprecations.jl") include("deprecations.jl")
function __init__() function __init__()
if !CUDAdrv.functional() if !CuArrays.functional()
@warn "CUDA available, but CUDAdrv.jl failed to load" # nothing to do here, and either CuArrays or one of its dependencies will have warned
elseif length(devices()) == 0
@warn "CUDA available, but no GPU detected"
elseif !CuArrays.functional()
@warn "CUDA GPU available, but CuArrays.jl failed to load"
else else
use_cuda[] = true use_cuda[] = true
@ -54,7 +49,7 @@ function __init__()
if CuArrays.has_cudnn() if CuArrays.has_cudnn()
include(joinpath(@__DIR__, "cuda/cuda.jl")) include(joinpath(@__DIR__, "cuda/cuda.jl"))
else else
@warn "CUDA GPU available, but CuArrays.jl did not find libcudnn. Some functionality will not be available." @warn "CuArrays.jl did not find libcudnn. Some functionality will not be available."
end end
end end
end end