Skip to content

Commit 3ee9201

Browse files
🤖 Format .jl files (#224)
Co-authored-by: tmigot <[email protected]>
1 parent 53a494c commit 3ee9201

File tree

7 files changed

+63
-19
lines changed

7 files changed

+63
-19
lines changed

src/sparse_sym.jl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,7 @@ struct SparseSymbolicsADHessian{T, H} <: ADBackend
9797
cfH::H
9898
end
9999

100-
function SparseSymbolicsADHessian(
101-
nvar,
102-
f,
103-
ncon,
104-
c!;
105-
x0::S = rand(nvar),
106-
kwargs...,
107-
) where {S}
100+
function SparseSymbolicsADHessian(nvar, f, ncon, c!; x0::S = rand(nvar), kwargs...) where {S}
108101
Symbolics.@variables xs[1:nvar], μs
109102
xsi = Symbolics.scalarize(xs)
110103
fun = μs * f(xsi)

test/gpu.jl

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,50 @@ end
1010

1111
@test CUDA.functional()
1212

13-
@testset "Checking NLPModelsTest (NLP) tests with $backend - GPU multiple precision" for backend in keys(ADNLPModels.predefined_backend)
14-
@testset "Checking GPU multiple precision on problem $problem" for problem in NLPModelsTest.nlp_problems
13+
@testset "Checking NLPModelsTest (NLP) tests with $backend - GPU multiple precision" for backend in
14+
keys(
15+
ADNLPModels.predefined_backend,
16+
)
17+
@testset "Checking GPU multiple precision on problem $problem" for problem in
18+
NLPModelsTest.nlp_problems
1519
nlp_from_T = eval(Meta.parse(lowercase(problem) * "_autodiff"))
1620
CUDA.allowscalar() do
1721
# sparse Jacobian/Hessian doesn't work here
18-
multiple_precision_nlp_array(T -> nlp_from_T(T; jacobian_backend = ADNLPModels.ForwardDiffADJacobian, hessian_backend = ADNLPModels.ForwardDiffADHessian), CuArray, exclude = [jth_hprod, hprod, jprod], linear_api = true)
22+
multiple_precision_nlp_array(
23+
T -> nlp_from_T(
24+
T;
25+
jacobian_backend = ADNLPModels.ForwardDiffADJacobian,
26+
hessian_backend = ADNLPModels.ForwardDiffADHessian,
27+
),
28+
CuArray,
29+
exclude = [jth_hprod, hprod, jprod],
30+
linear_api = true,
31+
)
1932
end
2033
end
2134
end
2235

23-
@testset "Checking NLPModelsTest (NLS) tests with $backend - GPU multiple precision" for backend in keys(ADNLPModels.predefined_backend)
24-
@testset "Checking GPU multiple precision on problem $problem" for problem in NLPModelsTest.nls_problems
36+
@testset "Checking NLPModelsTest (NLS) tests with $backend - GPU multiple precision" for backend in
37+
keys(
38+
ADNLPModels.predefined_backend,
39+
)
40+
@testset "Checking GPU multiple precision on problem $problem" for problem in
41+
NLPModelsTest.nls_problems
2542
nls_from_T = eval(Meta.parse(lowercase(problem) * "_autodiff"))
2643
CUDA.allowscalar() do
2744
# sparse Jacobian/Hessian doesn't work here
28-
multiple_precision_nls_array(T -> nls_from_T(T; jacobian_backend = ADNLPModels.ForwardDiffADJacobian, hessian_backend = ADNLPModels.ForwardDiffADHessian, jacobian_residual_backend = ADNLPModels.ForwardDiffADJacobian, hessian_residual_backend = ADNLPModels.ForwardDiffADHessian), CuArray, exclude = [jprod, jprod_residual, hprod_residual], linear_api = true)
45+
multiple_precision_nls_array(
46+
T -> nls_from_T(
47+
T;
48+
jacobian_backend = ADNLPModels.ForwardDiffADJacobian,
49+
hessian_backend = ADNLPModels.ForwardDiffADHessian,
50+
jacobian_residual_backend = ADNLPModels.ForwardDiffADJacobian,
51+
hessian_residual_backend = ADNLPModels.ForwardDiffADHessian,
52+
),
53+
CuArray,
54+
exclude = [jprod, jprod_residual, hprod_residual],
55+
linear_api = true,
56+
)
2957
end
3058
end
3159
end

test/nlp/nlpmodelstest.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,16 @@
2222
if CUDA.functional()
2323
CUDA.allowscalar() do
2424
# sparse Jacobian/Hessian doesn't work here
25-
multiple_precision_nlp_array(T -> nlp_from_T(T; jacobian_backend = ADNLPModels.ForwardDiffADJacobian, hessian_backend = ADNLPModels.ForwardDiffADHessian), CuArray, exclude = [jth_hprod, hprod, jprod], linear_api = true)
25+
multiple_precision_nlp_array(
26+
T -> nlp_from_T(
27+
T;
28+
jacobian_backend = ADNLPModels.ForwardDiffADJacobian,
29+
hessian_backend = ADNLPModels.ForwardDiffADHessian,
30+
),
31+
CuArray,
32+
exclude = [jth_hprod, hprod, jprod],
33+
linear_api = true,
34+
)
2635
end
2736
end
2837
end

test/nlp/problems/brownden.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export brownden_autodiff
22

3-
brownden_autodiff(::Type{T}; kwargs...) where {T <: Number} = brownden_autodiff(Vector{T}; kwargs...)
3+
brownden_autodiff(::Type{T}; kwargs...) where {T <: Number} =
4+
brownden_autodiff(Vector{T}; kwargs...)
45
function brownden_autodiff(::Type{S} = Vector{Float64}; kwargs...) where {S}
56
T = eltype(S)
67
x0 = S([25.0; 5.0; -5.0; -1.0])

test/nlp/problems/mgh01feas.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export mgh01feas_autodiff
22

3-
mgh01feas_autodiff(::Type{T}; kwargs...) where {T <: Number} = mgh01feas_autodiff(Vector{T}; kwargs...)
3+
mgh01feas_autodiff(::Type{T}; kwargs...) where {T <: Number} =
4+
mgh01feas_autodiff(Vector{T}; kwargs...)
45
function mgh01feas_autodiff(::Type{S} = Vector{Float64}; kwargs...) where {S}
56
x0 = S([-12 // 10; 1])
67
f(x) = zero(eltype(x))

test/nls/nlpmodelstest.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,18 @@
3939
if CUDA.functional()
4040
CUDA.allowscalar() do
4141
# sparse Jacobian/Hessian doesn't work here
42-
multiple_precision_nls_array(T -> nls_from_T(T; jacobian_backend = ADNLPModels.ForwardDiffADJacobian, hessian_backend = ADNLPModels.ForwardDiffADHessian, jacobian_residual_backend = ADNLPModels.ForwardDiffADJacobian, hessian_residual_backend = ADNLPModels.ForwardDiffADHessian), CuArray, exclude = [jprod, jprod_residual, hprod_residual], linear_api = true)
42+
multiple_precision_nls_array(
43+
T -> nls_from_T(
44+
T;
45+
jacobian_backend = ADNLPModels.ForwardDiffADJacobian,
46+
hessian_backend = ADNLPModels.ForwardDiffADHessian,
47+
jacobian_residual_backend = ADNLPModels.ForwardDiffADJacobian,
48+
hessian_residual_backend = ADNLPModels.ForwardDiffADHessian,
49+
),
50+
CuArray,
51+
exclude = [jprod, jprod_residual, hprod_residual],
52+
linear_api = true,
53+
)
4354
end
4455
end
4556
end

test/nls/problems/bndrosenbrock.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export bndrosenbrock_autodiff
22

3-
bndrosenbrock_autodiff(::Type{T}; kwargs...) where {T <: Number} = bndrosenbrock_autodiff(Vector{T}; kwargs...)
3+
bndrosenbrock_autodiff(::Type{T}; kwargs...) where {T <: Number} =
4+
bndrosenbrock_autodiff(Vector{T}; kwargs...)
45
function bndrosenbrock_autodiff(::Type{S} = Vector{Float64}; kwargs...) where {S}
56
x0 = S([-12 // 10; 1])
67
F(x) = [1 - x[1]; 10 * (x[2] - x[1]^2)]

0 commit comments

Comments
 (0)