This repository has been archived by the owner on Mar 12, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 83
/
runtests.jl
78 lines (61 loc) · 1.84 KB
/
runtests.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using CuArrays, Test
include("util.jl")
using Random
Random.seed!(1)
using CUDAnative
using CUDAdrv
# GPUArrays has a testsuite that isn't part of the main package.
# Include it directly.
import GPUArrays
gpuarrays = pathof(GPUArrays)
gpuarrays_root = dirname(dirname(gpuarrays))
include(joinpath(gpuarrays_root, "test", "testsuite.jl"))
testf(f, xs...; kwargs...) = TestSuite.compare(f, CuArray, xs...; kwargs...)
# pick a suiteable device (by available memory,
# but also by capability if testing needs to be thorough)
candidates = [(device!(dev);
(dev=dev,
cap=capability(dev),
mem=CUDAdrv.available_memory()))
for dev in devices()]
thorough = parse(Bool, get(ENV, "CI_THOROUGH", "false"))
if thorough
sort!(candidates, by=x->(x.cap, x.mem))
else
sort!(candidates, by=x->x.mem)
end
pick = last(candidates)
@info("Testing using device $(name(pick.dev)) (compute capability $(pick.cap), $(Base.format_bytes(pick.mem)) available memory) on CUDA driver $(CUDAdrv.version()) and toolkit $(CUDAnative.version())")
device!(pick.dev)
@testset "CuArrays" begin
# ensure CI is using the requested version
if haskey(ENV, "CI") && haskey(ENV, "JULIA_CUDA_VERSION")
@test CuArrays.release() == VersionNumber(ENV["JULIA_CUDA_VERSION"])
end
CuArrays.allowscalar(false)
CuArrays.enable_timings()
@testset "GPUArrays test suite" begin
TestSuite.test(CuArray)
end
include("base.jl")
include("memory.jl")
include("blas.jl")
include("rand.jl")
include("fft.jl")
include("sparse.jl")
include("solver.jl")
include("sparse_solver.jl")
include("dnn.jl")
include("tensor.jl")
include("iterator.jl")
include("forwarddiff.jl")
include("nnlib.jl")
include("statistics.jl")
if haskey(ENV, "CI")
GC.gc(true)
CuArrays.memory_status()
CuArrays.pool_timings()
CuArrays.alloc_timings()
end
CuArrays.reset_timers!()
end