Skip to content

Commit c38ce0a

Browse files
committed
hunt gc problems
1 parent a6e6608 commit c38ce0a

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

test/blas.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ using Base.Test
55
if GPUArrays.hasblas(GPUArrays.current_context())
66
@testset "matmul" begin
77
for T in (Float32, Float64) # TODO complex
8-
A, B = rand(T, 33, 33), rand(T, 33, 33)
9-
X = rand(T, 33)
8+
A, B = rand(T, 15, 15), rand(T, 15, 15)
9+
X = rand(T, 15)
1010
C = A * B
1111
D = A * X
1212
Agpu, Bgpu, Xgpu = GPUArray(A), GPUArray(B), GPUArray(X)
@@ -19,7 +19,7 @@ using Base.Test
1919
end
2020
for T in (Complex64, Float32)
2121
@testset "scale!" begin
22-
x = rand(T, 20, 77)
22+
x = rand(T, 13, 23)
2323
A = GPUArray(x)
2424

2525
scale!(A, 77f0)

test/cudanative.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ function cumap!(state, f, out, b)
9696
end
9797

9898
@testset "Custom kernel from Julia function" begin
99-
x = GPUArray(rand(Float32, 100))
100-
y = GPUArray(rand(Float32, 100))
99+
x = GPUArray(rand(Float32, 20))
100+
y = GPUArray(rand(Float32, 20))
101101
gpu_call(cumap!, x, (cu.sin, x, y))
102102
jy = Array(y)
103103
@test map!(sin, jy, jy) Array(x)

test/runtests.jl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ macro allbackends(title, backendname::Symbol, block)
1818
$(esc(backendname)) = backend
1919
$(esc(block))
2020
end
21+
if backend == :cudanative
22+
println("GPUMem: ", CUDAdrv.Mem.used() / 10^6)
23+
gc()
24+
println(" gc: ", CUDAdrv.Mem.used() / 10^6)
25+
end
2126
end
2227
end
2328
end
@@ -29,26 +34,29 @@ end
2934

3035
# Only test supported backends!
3136
for backend in supported_backends()
32-
if backend in (:opencl, :cudanative, :julia)
37+
if backend in (:opencl, :julia, :cudanative)
3338
@testset "$backend" begin
3439
include("$(backend).jl")
3540
end
41+
gc()
3642
end
3743
end
3844

3945
@testset "BLAS" begin
4046
include("blas.jl")
4147
end
48+
gc()
4249

4350
@testset "Shared" begin
4451
include("shared.jl")
4552
end
46-
53+
gc()
4754
@testset "Array/Vector Operations" begin
4855
include("indexing.jl")
4956
include("vector.jl")
5057
end
51-
58+
gc()
5259
@testset "FFT" begin
5360
include("fft.jl")
5461
end
62+
gc()

test/shared.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function cu_cndf2(x)
4141
end
4242

4343
for T in (Float32,)
44-
N = 1023
44+
N = 60
4545
sptprice = T[42.0 for i = 1:N]
4646
initStrike = T[40.0 + (i / N) for i = 1:N]
4747
rate = T[0.5 for i = 1:N]
@@ -67,8 +67,8 @@ for T in (Float32,)
6767
end
6868

6969
@allbackends "mapidx" backend begin
70-
a = rand(Complex64, 1025)
71-
b = rand(Complex64, 1025)
70+
a = rand(Complex64, 77)
71+
b = rand(Complex64, 77)
7272
A = GPUArray(a)
7373
B = GPUArray(b)
7474
off = Cuint(1)
@@ -128,7 +128,7 @@ end
128128
end
129129

130130
@allbackends "reinterpret" backend begin
131-
a = rand(Complex64, 1077)
131+
a = rand(Complex64, 22)
132132
A = GPUArray(a)
133133
af0 = reinterpret(Float32, a)
134134
Af0 = reinterpret(Float32, A)
@@ -156,17 +156,18 @@ end
156156

157157

158158
@allbackends "mapreduce" backend begin
159-
y = rand(Float32, 40, 40)
159+
N = 18
160+
y = rand(Float32, N, N)
160161
x = GPUArray(y)
161162
@test sum(y, 2) Array(sum(x, 2))
162163
@test sum(y, 1) Array(sum(x, 1))
163164

164-
y = rand(Float32, 40, 10)
165+
y = rand(Float32, N, 10)
165166
x = GPUArray(y)
166167
@test sum(y, 2) Array(sum(x, 2))
167168
@test sum(y, 1) Array(sum(x, 1))
168169

169-
y = rand(Float32, 10, 40)
170+
y = rand(Float32, 10, N)
170171
x = GPUArray(y)
171172
@test sum(y, 2) Array(sum(x, 2))
172173
@test sum(y, 1) Array(sum(x, 1))

0 commit comments

Comments
 (0)