Skip to content
This repository was archived by the owner on Mar 12, 2021. It is now read-only.

Commit 362f914

Browse files
author
Rodrigo Vargas
committed
Merge branch 'master' of https://github.com/vargonis/CuArrays.jl
2 parents f4d3243 + 739ff9a commit 362f914

27 files changed

+1687
-1729
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ flux:
111111
tags:
112112
- nvidia
113113
script:
114-
- export FLUX="$HOME/.julia/dev/Flux"
114+
- export FLUX=".julia/dev/Flux"
115115
- julia -e 'using Pkg;
116116
Pkg.develop("Flux");'
117117
- julia --project -e 'using Pkg;

Manifest.toml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ git-tree-sha1 = "ed2c4abadf84c53d9e58510b5fc48912c2336fbb"
5050
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
5151
version = "2.2.0"
5252

53-
[[Crayons]]
54-
deps = ["Test"]
55-
git-tree-sha1 = "f621b8ef51fd2004c7cf157ea47f027fdeac5523"
56-
uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
57-
version = "4.0.0"
58-
5953
[[DataStructures]]
6054
deps = ["InteractiveUtils", "OrderedCollections"]
6155
git-tree-sha1 = "0809951a1774dc724da22d26e4289bbaab77809a"
@@ -176,10 +170,10 @@ deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
176170
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
177171

178172
[[TimerOutputs]]
179-
deps = ["Crayons", "Printf", "Test", "Unicode"]
180-
git-tree-sha1 = "b80671c06f8f8bae08c55d67b5ce292c5ae2660c"
173+
deps = ["Printf"]
174+
git-tree-sha1 = "311765af81bbb48d7bad01fb016d9c328c6ede03"
181175
uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
182-
version = "0.5.0"
176+
version = "0.5.3"
183177

184178
[[Tokenize]]
185179
git-tree-sha1 = "dfcdbbfb2d0370716c815cbd6f8a364efb6f42cf"

src/CuArrays.jl

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ const __initialized__ = Ref(false)
5555
functional() = __initialized__[]
5656

5757
export has_cudnn, has_cutensor
58-
const libraries = Dict{String,Union{String,Nothing}}()
59-
has_cudnn() = libraries["cudnn"] !== nothing && CUDNN.libcudnn !== nothing
60-
has_cutensor() = libraries["cutensor"] !== nothing && CUTENSOR.libcutensor !== nothing
58+
has_cudnn() = Libdl.dlopen_e(CUDNN.libcudnn[]) !== C_NULL
59+
has_cutensor() = Libdl.dlopen_e(CUTENSOR.libcutensor[]) !== C_NULL
6160

6261
function __init__()
6362
precompiling = ccall(:jl_generating_output, Cint, ()) != 0
@@ -76,18 +75,20 @@ function __init__()
7675
for name in ("cublas", "cusparse", "cusolver", "cufft", "curand", "cudnn", "cutensor")
7776
mod = getfield(CuArrays, Symbol(uppercase(name)))
7877
lib = Symbol("lib$name")
79-
path = find_cuda_library(name, toolkit)
80-
libraries[name] = path
81-
82-
# only push the load path if we couldn't find the library
83-
if path !== nothing
84-
file = basename(path)
85-
handle = first(split(file,'.'))
86-
if Libdl.dlopen_e(handle) == C_NULL
87-
dir = dirname(path)
88-
if !(dir in Libdl.DL_LOAD_PATH)
89-
push!(Libdl.DL_LOAD_PATH, dir)
90-
end
78+
handle = getfield(mod, lib)
79+
80+
# on Windows, the library name is version dependent
81+
if Sys.iswindows()
82+
cuda = CUDAnative.version()
83+
suffix = cuda >= v"10.1" ? "$(cuda.major)" : "$(cuda.major)$(cuda.minor)"
84+
handle[] = "$(name)$(Sys.WORD_SIZE)_$(suffix)"
85+
end
86+
87+
# check if we can't find the library
88+
if Libdl.dlopen_e(handle[]) == C_NULL
89+
path = find_cuda_library(name, toolkit)
90+
if path !== nothing
91+
handle[] = path
9192
end
9293
end
9394
end

src/blas/CUBLAS.jl

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,7 @@ using LinearAlgebra
1313

1414
using CEnum
1515

16-
const libcublas = if Sys.iswindows()
17-
# no ccall by soname, we need the filename
18-
# NOTE: we discover the full path here, while only the wordsize and toolkit versions
19-
# would have been enough to construct "cublas64_10.dll"
20-
toolkit = find_toolkit()
21-
path = find_cuda_library("cublas", toolkit)
22-
if path === nothing
23-
error("Could not find libcublas")
24-
end
25-
const libcublas = basename(path)
26-
else
27-
# ccall by soname; CuArrays.__init__ will have populated Libdl.DL_LOAD_PATH
28-
const libcublas = "libcublas"
29-
end
16+
const libcublas = Ref("libcublas")
3017

3118
# core library
3219
include("libcublas_common.jl")

0 commit comments

Comments
 (0)