From af0fdf92344932af2c1807711f68f85a880533e3 Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Wed, 2 Jul 2025 13:16:45 -0400 Subject: [PATCH 1/2] Rationalize and try to fix failing ldiv tests --- test/libraries/cusparse/interfaces.jl | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/test/libraries/cusparse/interfaces.jl b/test/libraries/cusparse/interfaces.jl index 5e195d9029..e1a1674da5 100644 --- a/test/libraries/cusparse/interfaces.jl +++ b/test/libraries/cusparse/interfaces.jl @@ -214,7 +214,8 @@ nB = 2 ldiv!(triangle(opa(dA)), dz) @test z ≈ collect(dz) end - if SparseMatrixType != CuSparseMatrixBSR + # seems to be a library bug in CUDAs 12.0-12.2, only fp64 types are supported + if SparseMatrixType != CuSparseMatrixBSR || elty ∈ (Float64, ComplexF64) || CUSPARSE.version() < v"12.0" || v"12.2" < CUSPARSE.version() @testset "ldiv! -- (CuVector, CuVector)" begin z = rand(elty, m) dz = CuArray(z) @@ -222,9 +223,6 @@ nB = 2 ldiv!(dz, triangle(opa(dA)), dy) @test z ≈ collect(dz) end - end - # seems to be a library bug in CUDAs 12.0-12.2, only fp64 types are supported - if SparseMatrixType == CuSparseMatrixBSR || elty ∈ (Float64, ComplexF64) || CUSPARSE.version() < v"12.0" || v"12.2" < CUSPARSE.version() @testset "\\ -- CuVector" begin x = triangle(opa(A)) \ y dx = triangle(opa(dA)) \ dy @@ -248,7 +246,7 @@ nB = 2 @test_throws DimensionMismatch(error_str) ldiv!(triangle(opa(dA)), opb(dB_bad)) end end - if SparseMatrixType != CuSparseMatrixBSR + if SparseMatrixType != CuSparseMatrixBSR || elty ∈ (Float64, ComplexF64) || CUSPARSE.version() != v"12.0" @testset "ldiv! -- (CuMatrix, CuMatrix)" begin C = rand(elty, m, nB) dC = CuArray(C) @@ -259,13 +257,13 @@ nB = 2 @test_throws DimensionMismatch(error_str) ldiv!(triangle(opa(dA)), opb(dB_bad)) end end - end - @testset "\\ -- CuMatrix" begin - C = triangle(opa(A)) \ opb(B) - dC = triangle(opa(dA)) \ opb(dB) - @test C ≈ collect(dC) - if CUSPARSE.version() < v"12.0" - @test_throws DimensionMismatch(error_str) ldiv!(triangle(opa(dA)), opb(dB_bad)) + @testset "\\ -- CuMatrix" begin + C = triangle(opa(A)) \ opb(B) + dC = triangle(opa(dA)) \ opb(dB) + @test C ≈ collect(dC) + if CUSPARSE.version() < v"12.0" + @test_throws DimensionMismatch(error_str) ldiv!(triangle(opa(dA)), opb(dB_bad)) + end end end end From 5db6744ee1ea6e0f5dada4034eae76294a101693 Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Wed, 2 Jul 2025 15:35:20 -0400 Subject: [PATCH 2/2] Switch or for and --- test/libraries/cusparse/interfaces.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/libraries/cusparse/interfaces.jl b/test/libraries/cusparse/interfaces.jl index e1a1674da5..fa25d8330e 100644 --- a/test/libraries/cusparse/interfaces.jl +++ b/test/libraries/cusparse/interfaces.jl @@ -215,7 +215,7 @@ nB = 2 @test z ≈ collect(dz) end # seems to be a library bug in CUDAs 12.0-12.2, only fp64 types are supported - if SparseMatrixType != CuSparseMatrixBSR || elty ∈ (Float64, ComplexF64) || CUSPARSE.version() < v"12.0" || v"12.2" < CUSPARSE.version() + if SparseMatrixType != CuSparseMatrixBSR && (elty ∈ (Float64, ComplexF64) || CUSPARSE.version() < v"12.0" || v"12.2" < CUSPARSE.version()) @testset "ldiv! -- (CuVector, CuVector)" begin z = rand(elty, m) dz = CuArray(z) @@ -246,7 +246,7 @@ nB = 2 @test_throws DimensionMismatch(error_str) ldiv!(triangle(opa(dA)), opb(dB_bad)) end end - if SparseMatrixType != CuSparseMatrixBSR || elty ∈ (Float64, ComplexF64) || CUSPARSE.version() != v"12.0" + if SparseMatrixType != CuSparseMatrixBSR && (elty ∈ (Float64, ComplexF64) || CUSPARSE.version() != v"12.0") @testset "ldiv! -- (CuMatrix, CuMatrix)" begin C = rand(elty, m, nB) dC = CuArray(C)