Skip to content

Commit 1525b30

Browse files
committed
Make lower n to 1k instead of 2k to fit in 8GB. Try-catch for gpumem
1 parent 42fee27 commit 1525b30

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

perf/recurrent.jl

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,40 @@
11

22
println("RNN")
3-
for n in [2, 20, 200, 2000], T in [1, 8, 16, 64]
3+
for n in [2, 20, 200, 1000], T in [1, 8, 16, 64]
44
x = [randn(Float32, n, n) for t in 1:T]
55
model = RNN(n, n)
66
println("CPU n=$n, t=$T")
77
run_benchmark(model, x, cuda=false)
88
println("CUDA n=$n, t=$T")
9-
run_benchmark(model, x, cuda=true)
9+
try
10+
run_benchmark(model, x, cuda=true)
11+
catch ex
12+
@show typeof(ex)
13+
if ex isa OutOfGPUMemoryError
14+
@warn "Not enough GPU memory to run test"
15+
else
16+
rethrow(ex)
17+
end
18+
end
1019
end
1120

1221
println("RNN-3d")
13-
for n in [2, 20, 200, 2000], T in [1, 8, 16, 64]
22+
for n in [2, 20, 200, 1000], T in [1, 8, 16, 64]
1423
x = randn(Float32, n, n, T)
1524
model = RNN(n, n)
1625
println("CPU n=$n, t=$T")
1726
run_benchmark(model, x, cuda=false)
1827
println("CUDA n=$n, t=$T")
19-
run_benchmark(model, x, cuda=true)
28+
try
29+
run_benchmark(model, x, cuda=true)
30+
catch ex
31+
@show typeof(ex)
32+
if ex isa OutOfGPUMemoryError
33+
@warn "Not enough GPU memory to run test"
34+
else
35+
rethrow(ex)
36+
end
37+
end
2038
end
2139

2240

0 commit comments

Comments
 (0)