Flux.jl/src/cuda/cuda.jl

38 lines
897 B
Julia
Raw Normal View History

2018-01-24 18:45:24 +00:00
module CUDA
2018-08-20 12:08:04 +00:00
using ..CuArrays
2019-01-15 16:43:57 +00:00
using Pkg.TOML
function version_check()
minor_version = 9
project = joinpath(dirname(pathof(CuArrays)), "../Project.toml")
project = TOML.parse(String(read(project)))
version = VersionNumber(get(project, "version", "0.0.0"))
if !(version.major == 0 && version.minor == minor_version)
@warn """
Flux is only supported with CuArrays v0.$minor_version.
Try running `] pin CuArrays@0.$minor_version`.
"""
end
end
version_check()
2018-01-24 18:45:24 +00:00
2018-11-14 15:53:26 +00:00
if !applicable(CuArray{UInt8}, undef, 1)
(T::Type{<:CuArray})(::UndefInitializer, sz...) = T(sz...)
end
2018-10-23 16:23:29 +00:00
if CuArrays.libcudnn != nothing
2018-11-14 16:48:57 +00:00
if isdefined(CuArrays, :libcudnn_handle)
handle() = CuArrays.libcudnn_handle[]
else
handle() = CuArrays.CUDNN.handle()
end
include("curnn.jl")
2018-11-20 03:56:48 +00:00
include("cudnn.jl")
2018-11-01 04:07:16 +00:00
else
2018-11-06 12:39:54 +00:00
@warn("CUDNN is not installed, some functionality will not be available.")
2018-06-20 13:16:42 +00:00
end
2018-01-24 18:45:24 +00:00
end