Merge pull request #924 from FluxML/tb/cuda_init
CUDA package initialization improvements
This commit is contained in:
commit
2fa3e5673e
|
@ -94,9 +94,9 @@ version = "1.3.0"
|
|||
|
||||
[[CuArrays]]
|
||||
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"
|
||||
version = "1.4.6"
|
||||
version = "1.4.7"
|
||||
|
||||
[[DataAPI]]
|
||||
git-tree-sha1 = "674b67f344687a88310213ddfa8a2b3c76cc4252"
|
||||
|
@ -141,9 +141,9 @@ version = "1.0.1"
|
|||
|
||||
[[FillArrays]]
|
||||
deps = ["LinearAlgebra", "Random", "SparseArrays"]
|
||||
git-tree-sha1 = "6827a8f73ff12707f209c920d204238a16892b55"
|
||||
git-tree-sha1 = "b2cf74f09216cfe3c241e8484178ec0ea941870f"
|
||||
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
|
||||
[[FixedPointNumbers]]
|
||||
git-tree-sha1 = "d14a6fa5890ea3a7e5dcab6811114f132fec2b4b"
|
||||
|
@ -335,9 +335,9 @@ uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
|||
|
||||
[[TimerOutputs]]
|
||||
deps = ["Printf"]
|
||||
git-tree-sha1 = "8f22dc0c23e1cd4ab8070a01ba32285926f104f1"
|
||||
git-tree-sha1 = "311765af81bbb48d7bad01fb016d9c328c6ede03"
|
||||
uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
|
||||
version = "0.5.2"
|
||||
version = "0.5.3"
|
||||
|
||||
[[TranscodingStreams]]
|
||||
deps = ["Random", "Test"]
|
||||
|
|
|
@ -5,7 +5,6 @@ version = "0.9.0"
|
|||
[deps]
|
||||
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
|
||||
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
|
||||
CUDAdrv = "c5f51814-7f29-56b8-a69c-e4d8f6be1fde"
|
||||
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
|
||||
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
|
||||
CuArrays = "3a865a2d-5b23-5a0f-bc46-62713ec82fae"
|
||||
|
@ -25,8 +24,7 @@ ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
|
|||
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
|
||||
|
||||
[compat]
|
||||
CUDAdrv = "4.0.1"
|
||||
CuArrays = "1.4.2"
|
||||
CuArrays = "1.4.3"
|
||||
NNlib = "0.6"
|
||||
Zygote = "0.4"
|
||||
julia = "1"
|
||||
|
|
13
src/Flux.jl
13
src/Flux.jl
|
@ -21,8 +21,7 @@ export SGD, Descent, ADAM, Momentum, Nesterov, RMSProp,
|
|||
ADAMW, RADAM, InvDecay, ExpDecay, WeightDecay
|
||||
|
||||
|
||||
ENV["CUDA_INIT_SILENT"] = true
|
||||
using CUDAdrv, CuArrays
|
||||
using CuArrays
|
||||
const use_cuda = Ref(false)
|
||||
|
||||
include("utils.jl")
|
||||
|
@ -40,12 +39,8 @@ include("data/Data.jl")
|
|||
include("deprecations.jl")
|
||||
|
||||
function __init__()
|
||||
if !CUDAdrv.functional()
|
||||
@warn "CUDA available, but CUDAdrv.jl failed to load"
|
||||
elseif length(devices()) == 0
|
||||
@warn "CUDA available, but no GPU detected"
|
||||
elseif !CuArrays.functional()
|
||||
@warn "CUDA GPU available, but CuArrays.jl failed to load"
|
||||
if !CuArrays.functional()
|
||||
# nothing to do here, and either CuArrays or one of its dependencies will have warned
|
||||
else
|
||||
use_cuda[] = true
|
||||
|
||||
|
@ -54,7 +49,7 @@ function __init__()
|
|||
if CuArrays.has_cudnn()
|
||||
include(joinpath(@__DIR__, "cuda/cuda.jl"))
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue