forked from JuliaGPU/CUDA.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move CUDNN and CUTENSOR into separate packages (JuliaGPU#1624)
- Loading branch information
1 parent
6140d69
commit c3e25dc
Showing
92 changed files
with
1,816 additions
and
1,679 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
.vscode | ||
lcov.info | ||
build/ | ||
lib/**/Manifest.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name = "CUDNN" | ||
uuid = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd" | ||
authors = ["Tim Besard <tim.besard@gmail.com>"] | ||
version = "0.1.0" | ||
|
||
[deps] | ||
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82" | ||
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" | ||
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using CUDA.Deps: @initialize_ref, libcublas, cuda_artifact, artifact_library, find_library, | ||
LocalToolkit, ArtifactToolkit, toolkit | ||
|
||
import Libdl | ||
|
||
export libcudnn, has_cudnn | ||
|
||
const __libcudnn = Ref{Union{String,Nothing}}() | ||
function libcudnn(; throw_error::Bool=true) | ||
path = @initialize_ref __libcudnn begin | ||
# CUDNN depends on CUBLAS | ||
libcublas() | ||
|
||
find_cudnn(toolkit(), v"8") | ||
end __runtime_init__() | ||
if path === nothing && throw_error | ||
error("This functionality is unavailabe as CUDNN is missing.") | ||
end | ||
path | ||
end | ||
has_cudnn() = libcudnn(throw_error=false) !== nothing | ||
|
||
function find_cudnn(cuda::ArtifactToolkit, version) | ||
artifact_dir = cuda_artifact("CUDNN", cuda.release) | ||
if artifact_dir === nothing | ||
return nothing | ||
end | ||
path = artifact_library(artifact_dir, "cudnn", [version]) | ||
|
||
# HACK: eagerly open CUDNN sublibraries to avoid dlopen discoverability issues | ||
for sublibrary in ("ops_infer", "ops_train", | ||
"cnn_infer", "cnn_train", | ||
"adv_infer", "adv_train") | ||
sublibrary_path = artifact_library(artifact_dir, "cudnn_$(sublibrary)", [version]) | ||
Libdl.dlopen(sublibrary_path) | ||
end | ||
|
||
@debug "Using CUDNN from an artifact at $(artifact_dir)" | ||
Libdl.dlopen(path) | ||
return path | ||
end | ||
|
||
function find_cudnn(cuda::LocalToolkit, version) | ||
path = find_library("cudnn", [version]; locations=cuda.dirs) | ||
if path === nothing | ||
return nothing | ||
end | ||
|
||
# with a local CUDNN version, we shouldn't need to eagerly open sublibraries, | ||
# as they are expected to be globally discoverable next to libcudnn.so | ||
|
||
@debug "Using local CUDNN at $(path)" | ||
Libdl.dlopen(path) | ||
return path | ||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[deps] | ||
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" | ||
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" | ||
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" | ||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" |
Oops, something went wrong.