Skip to content

Commit 3974de5

Browse files
authored
Even MORE tests and cov for CUBLAS (#2670)
1 parent 798741e commit 3974de5

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

lib/cublas/linalg.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ function LinearAlgebra.dot(x::AnyCuArray{T1}, y::AnyCuArray{T2}) where {T1,T2}
3838

3939
# custom kernel using simple linear indexing and atomic additions,
4040
# resulting in about 10% speed-up compared to a simple mapreduce.
41+
# COV_EXCL_START
4142
function kernel(x, y, res::AbstractArray{T}, shuffle) where {T}
4243
local_val = zero(T)
4344

@@ -56,6 +57,7 @@ function LinearAlgebra.dot(x::AnyCuArray{T1}, y::AnyCuArray{T2}) where {T1,T2}
5657

5758
return
5859
end
60+
# COV_EXCL_STOP
5961

6062
dev = device()
6163
let T = promote_type(T1, T2)

test/libraries/cublas/extensions.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,8 @@ k = 13
567567
d_X = Diagonal(d_x)
568568
mul!(d_AX, d_A', d_X)
569569
Array(d_AX) A' * Diagonal(x)
570+
571+
@test Array(d_X) == Diagonal(Array(d_x))
570572
end
571573
end # extensions
572574

test/libraries/cublas/level2.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,12 @@ k = 13
458458

459459
@testset "lmul!(::UpperTriangular)" begin
460460
dy = copy(dx)
461-
lmul!(UpperTriangular(dA), dy)
461+
utdA = UpperTriangular(dA)
462+
if VERSION >= v"1.11.2"
463+
@test istriu(utdA)
464+
@test !istril(utdA)
465+
end
466+
lmul!(utdA, dy)
462467
y = UpperTriangular(A) * x
463468
@test y Array(dy)
464469
end
@@ -476,7 +481,12 @@ k = 13
476481
end
477482
@testset "lmul!(::LowerTriangular)" begin
478483
dy = copy(dx)
479-
lmul!(LowerTriangular(dA), dy)
484+
ltdA = LowerTriangular(dA)
485+
if VERSION >= v"1.11.2"
486+
@test !istriu(ltdA)
487+
@test istril(ltdA)
488+
end
489+
lmul!(ltdA, dy)
480490
y = LowerTriangular(A) * x
481491
@test y Array(dy)
482492
end

test/libraries/cublas/level3.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,14 @@ k = 13
291291
dB = CuArray(B)
292292

293293
C = A / B
294+
d_C = dA / dB
295+
h_C = Array(d_C)
294296
rdiv!(dA, dB)
295297
@test C Array(dA)
298+
@test C h_C
299+
300+
B_bad = Diagonal(rand(elty, m+1))
301+
@test_throws DimensionMismatch("left hand side has $m columns but D is $(m+1) by $(m+1)") rdiv!(dA, B_bad)
296302
end
297303

298304
@testset "geam!" begin

0 commit comments

Comments
 (0)