Skip to content

Commit

Permalink
test: skip PETSc tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Oct 25, 2024
1 parent 370aa68 commit 05bbc79
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/src/tutorials/snes_ex2.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sol_dense_nr .- sol_dense_snes
```@example snes_ex2
sol_sparse_nr = solve(nlprob_sparse, NewtonRaphson(); abstol = 1e-8)
sol_sparse_snes = solve(nlprob_sparse, PETScSNES(); abstol = 1e-8)
@show sol_sparse_nr .- sol_sparse_snes
sol_sparse_nr .- sol_sparse_snes
```

As expected the solutions are the same (upto floating point error). Now let's compare the
Expand Down
2 changes: 0 additions & 2 deletions ext/NonlinearSolvePETScExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ function SciMLBase.__solve(
prob::NonlinearProblem, alg::PETScSNES, args...; abstol = nothing, reltol = nothing,
maxiters = 1000, alias_u0::Bool = false, termination_condition = nothing,
show_trace::Val{ShT} = Val(false), kwargs...) where {ShT}
!MPI.Initialized() && MPI.Init()

# XXX: https://petsc.org/release/manualpages/SNES/SNESSetConvergenceTest/
termination_condition === nothing ||
error("`PETScSNES` does not support termination conditions!")
Expand Down
17 changes: 12 additions & 5 deletions test/wrappers/rootfind_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ end
PETScSNES(; autodiff = missing)
]
alg isa CMINPACK && Sys.isapple() && continue
alg isa PETScSNES && Sys.iswindows() && continue
sol = solve(prob_iip, alg)
@test SciMLBase.successful_retcode(sol.retcode)
@test maximum(abs, sol.resid) < 1e-6
Expand All @@ -43,13 +44,15 @@ end
PETScSNES(; autodiff = missing)
]
alg isa CMINPACK && Sys.isapple() && continue
alg isa PETScSNES && Sys.iswindows() && continue
sol = solve(prob_oop, alg)
@test SciMLBase.successful_retcode(sol.retcode)
@test maximum(abs, sol.resid) < 1e-6
end
end

@testitem "Nonlinear Root Finding Problems" setup=[WrapperRootfindImports] tags=[:wrappers] begin
# Can lead to segfaults
@testitem "Nonlinear Root Finding Problems" setup=[WrapperRootfindImports] tags=[:wrappers] retries=3 begin
# IIP Tests
function f_iip(du, u, p)
du[1] = 2 - 2u[1]
Expand All @@ -67,6 +70,7 @@ end
PETScSNES(; autodiff = missing)
]
alg isa CMINPACK && Sys.isapple() && continue
alg isa PETScSNES && Sys.iswindows() && continue
local sol
sol = solve(prob_iip, alg)
@test SciMLBase.successful_retcode(sol.retcode)
Expand All @@ -86,6 +90,7 @@ end
PETScSNES(; autodiff = missing)
]
alg isa CMINPACK && Sys.isapple() && continue
alg isa PETScSNES && Sys.iswindows() && continue
local sol
sol = solve(prob_oop, alg)
@test SciMLBase.successful_retcode(sol.retcode)
Expand All @@ -108,7 +113,7 @@ end
]

alg isa CMINPACK && Sys.isapple() && continue

alg isa PETScSNES && Sys.iswindows() && continue
sol = solve(prob_tol, alg, abstol = tol)
@test abs(sol.u[1] - sqrt(2)) < tol
end
Expand Down Expand Up @@ -159,11 +164,13 @@ end
@test maximum(abs, sol.resid) < 1e-6
sol = solve(ProbN, SIAMFANLEquationsJL(; method = :pseudotransient); abstol = 1e-8)
@test maximum(abs, sol.resid) < 1e-6
sol = solve(ProbN, PETScSNES(); abstol = 1e-8)
@test maximum(abs, sol.resid) < 1e-6
if !Sys.iswindows()
sol = solve(ProbN, PETScSNES(); abstol = 1e-8)
@test maximum(abs, sol.resid) < 1e-6
end
end

@testitem "PETSc SNES Floating Points" setup=[WrapperRootfindImports] tags=[:wrappers] begin
@testitem "PETSc SNES Floating Points" setup=[WrapperRootfindImports] tags=[:wrappers] skip=:(Sys.iswindows()) begin
f(u, p) = u .* u .- 2

u0 = [1.0, 1.0]
Expand Down

0 comments on commit 05bbc79

Please sign in to comment.