Skip to content

Commit

Permalink
Add GPU tests to LLSModels
Browse files Browse the repository at this point in the history
  • Loading branch information
tmigot committed May 3, 2024
1 parent 04b8081 commit ed32f46
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ SparseMatricesCOO = "0.1, 0.2"
julia = "^1.6.0"

[extras]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Krylov = "ba0b0d4f-ebba-5204-a429-3ac8c609bfb7"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NLPModelsTest = "7998695d-6960-4d3a-85c4-e1bceb8cd856"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Krylov", "LinearAlgebra", "NLPModelsTest", "Test"]
test = ["CUDA", "Krylov", "LinearAlgebra", "NLPModelsTest", "Test"]
22 changes: 15 additions & 7 deletions test/nls_testutils.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
@testset "Checking TestUtils tests on problem LLS" begin
lls_from_T(::Type{T} = Float64) where {T} = LLSModel(
T[1 -1; 1 1; 0 1],
T[0; 2; 2],
x0 = zeros(T, 2),
C = T[1 1],
lcon = T[0],
ucon = T[Inf],
lls_from_T(::Type{T} = Float64) where {T <: Number} = lls_from_T(Vector{Float64}, Matrix{Float64})
lls_from_T(::Type{S}, ::Type{Mat}) where {Mat, S} = LLSModel(
Mat([1 -1; 1 1; 0 1]),
S([0; 2; 2]),
x0 = fill!(S(undef, 2), 0),
C = Mat([1 1]),
lcon = fill!(S(undef, 1), 0),
ucon = fill!(S(undef, 1), Inf),
name = "lls_LLSModel",
)
lls = lls_from_T()
Expand All @@ -27,6 +28,13 @@
@testset "Multiple precision support" begin
multiple_precision_nls(lls_from_T, linear_api = true)
end
if CUDA.functional()
@testset "GPU Multiple precision support" begin
CUDA.allowscalar() do
multiple_precision_nls_array(lls_from_T, CuArray, linear_api = true)
end
end
end
@testset "Check view subarray" begin
view_subarray_nls(lls)
end
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#stdlib
using LinearAlgebra, SparseArrays, Test
using CUDA
#jso
using LinearOperators, NLPModels, LLSModels, NLPModelsTest, NLPModelsModifiers

Expand Down

0 comments on commit ed32f46

Please sign in to comment.