diff --git a/docs/src/tutorials/snes_ex2.md b/docs/src/tutorials/snes_ex2.md index 37c73c613..e93d30c19 100644 --- a/docs/src/tutorials/snes_ex2.md +++ b/docs/src/tutorials/snes_ex2.md @@ -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 diff --git a/ext/NonlinearSolvePETScExt.jl b/ext/NonlinearSolvePETScExt.jl index a09301c74..9146c0b61 100644 --- a/ext/NonlinearSolvePETScExt.jl +++ b/ext/NonlinearSolvePETScExt.jl @@ -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!") diff --git a/test/wrappers/rootfind_tests.jl b/test/wrappers/rootfind_tests.jl index 94720f382..852368ae3 100644 --- a/test/wrappers/rootfind_tests.jl +++ b/test/wrappers/rootfind_tests.jl @@ -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 @@ -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] @@ -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) @@ -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) @@ -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 @@ -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]