From 9d56807bcd32461547dc8c4c0b3e8ef90057c2b8 Mon Sep 17 00:00:00 2001 From: Mike J Innes Date: Tue, 15 Jan 2019 11:43:57 -0500 Subject: [PATCH] cuarrays version check --- Project.toml | 1 + src/cuda/cuda.jl | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Project.toml b/Project.toml index c34c5717..f1545010 100644 --- a/Project.toml +++ b/Project.toml @@ -13,6 +13,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" +Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" diff --git a/src/cuda/cuda.jl b/src/cuda/cuda.jl index 82982180..070c9228 100644 --- a/src/cuda/cuda.jl +++ b/src/cuda/cuda.jl @@ -1,6 +1,22 @@ module CUDA using ..CuArrays +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() if !applicable(CuArray{UInt8}, undef, 1) (T::Type{<:CuArray})(::UndefInitializer, sz...) = T(sz...)