Skip to content

Commit

Permalink
Merge pull request #280 from iblis17/build-cudnn
Browse files Browse the repository at this point in the history
build with CuDNN support
  • Loading branch information
vchuravy committed Sep 25, 2017
2 parents bb88d79 + dcba690 commit 3595403
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ if is_unix()
end

HAS_CUDA = false
HAS_CUDNN = false
cudnnver = -1
let cudalib = Libdl.find_library(["libcuda", "nvcuda.dll"], CUDAPATHS)
HAS_CUDA = !isempty(cudalib) && Libdl.dlopen_e(cudalib) != C_NULL
end
Expand All @@ -48,8 +50,21 @@ if !HAS_CUDA && is_windows()
end
end

if HAS_CUDA # then check cudnn
let cudnnlib = Libdl.find_library("libcudnn", CUDAPATHS)
HAS_CUDNN = !isempty(cudnnlib) && Libdl.dlopen_e(cudnnlib) != C_NULL
if HAS_CUDNN
# TODO: do more version check?
cudnnver = dec(ccall((:cudnnGetVersion, cudnnlib), Csize_t, ()))
end
end
end

if HAS_CUDA
info("Found a CUDA installation.")
if HAS_CUDNN
info("Found a CuDNN installation (version -> $cudnnver).")
end
else
info("Did not find a CUDA installation, using CPU-only version of MXNet.")
end
Expand Down Expand Up @@ -180,6 +195,9 @@ if !libmxnet_detected
if haskey(ENV, "CUDA_HOME")
`sed -i -s "s@USE_CUDA_PATH = NONE@USE_CUDA_PATH = $(ENV["CUDA_HOME"])@" config.mk`
end
if HAS_CUDNN
`sed -i -s 's/USE_CUDNN = 0/USE_CUDNN = 1/' config.mk`
end
end
end

Expand Down

0 comments on commit 3595403

Please sign in to comment.