Skip to content

Commit a266d9f

Browse files
authored
test CUDSS
1 parent 2ae3e12 commit a266d9f

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

test/gpu/cuda.jl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1-
using CUDA
1+
using CUDSS, CUDA, SparseArrays, LinearAlgebra
2+
using CUDA.CUSPARSE
23
using ArrayInterface
34

45
using Test
56

7+
A_cpu = Float32[1 0; 0 1]
8+
A_dense = CuMatrix(A_cpu)
9+
A_sparse = CuSparseMatrixCSR(sparse(A_cpu))
10+
611
# Test whether lu_instance throws an error when invoked with an gpu array
7-
@test !isa(try ArrayInterface.lu_instance(CUDA.CuArray([1.f0 1.f0; 1.f0 1.f0])) catch ex ex end, Exception)
12+
lu_inst_dense = ArrayInterface.lu_instance(A_dense)
13+
lu_inst_sparse = ArrayInterface.lu_instance(A_sparse)
14+
15+
# test that lu! is valid when using the inst as scratch
16+
lu_sparse = lu!(lu_inst_sparse, A_sparse)
17+
18+
#test that the resulting lu works
19+
b = CuVector([1f0, 1f0])
20+
@test CUDA.@allowscalar lu_sparse \ b == [1, 1]

0 commit comments

Comments
 (0)