From b39b0564c028a8d015b7547ac2d241c10c9379bb Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Wed, 23 Aug 2023 12:48:17 +1000 Subject: [PATCH 01/14] Updated compats and CI to include newer versions of petsc --- .github/workflows/ci_extra.yml | 7 +++++-- Project.toml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_extra.yml b/.github/workflows/ci_extra.yml index f193d37..851d409 100644 --- a/.github/workflows/ci_extra.yml +++ b/.github/workflows/ci_extra.yml @@ -5,7 +5,6 @@ jobs: name: Tests ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} env: - JULIA_MPI_BINARY: "system" JULIA_PETSC_LIBRARY: "/opt/petsc/3.15.4/lib/libpetsc" strategy: fail-fast: false @@ -16,6 +15,10 @@ jobs: - ubuntu-latest arch: - x64 + petsc_version: + - '3.15.4' + - '3.18.4' + - '3.19.4' steps: - uses: actions/checkout@v2 - name: Cache petsc @@ -41,7 +44,7 @@ jobs: run: | CURR_DIR=$(pwd) PACKAGE=petsc - VERSION=3.15.4 + VERSION=${{ matrix.petsc_version }} INSTALL_ROOT=/opt PETSC_INSTALL=$INSTALL_ROOT/$PACKAGE/$VERSION TAR_FILE=$PACKAGE-$VERSION.tar.gz diff --git a/Project.toml b/Project.toml index e4645e5..1dd8164 100644 --- a/Project.toml +++ b/Project.toml @@ -19,7 +19,7 @@ SparseMatricesCSR = "a0a7dd2c-ebf4-11e9-1f05-cf50bc540ca1" Gridap = "0.17" GridapDistributed = "0.3" MPI = "0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20" -PETSc_jll = "=3.13.4, =3.15.2" +PETSc_jll = "3.13.4" PartitionedArrays = "0.3" SparseMatricesCSR = "0.6.6" julia = "1.3" From c7520e1db931bb02b913455389ad70853a23090d Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Wed, 23 Aug 2023 12:52:24 +1000 Subject: [PATCH 02/14] Better name for CI_EXTRA tasks --- .github/workflows/ci_extra.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_extra.yml b/.github/workflows/ci_extra.yml index 851d409..74eecb8 100644 --- a/.github/workflows/ci_extra.yml +++ b/.github/workflows/ci_extra.yml @@ -2,7 +2,7 @@ name: CI_EXTRA on: [push, pull_request] jobs: test: - name: Tests ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + name: Tests ${{ matrix.version }} - petsc ${{ matrix.petsc_version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} env: JULIA_PETSC_LIBRARY: "/opt/petsc/3.15.4/lib/libpetsc" From 5eff1794b90ed45f08d2c6256a6f8146413a4d03 Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Wed, 23 Aug 2023 13:15:28 +1000 Subject: [PATCH 03/14] Minor bugfix in CI --- .github/workflows/ci_extra.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_extra.yml b/.github/workflows/ci_extra.yml index 74eecb8..ace06c6 100644 --- a/.github/workflows/ci_extra.yml +++ b/.github/workflows/ci_extra.yml @@ -5,7 +5,7 @@ jobs: name: Tests ${{ matrix.version }} - petsc ${{ matrix.petsc_version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} env: - JULIA_PETSC_LIBRARY: "/opt/petsc/3.15.4/lib/libpetsc" + JULIA_PETSC_LIBRARY: "/opt/petsc/${{ matrix.petsc_version }}/lib/libpetsc" strategy: fail-fast: false matrix: From f9fdb5ecb6220ab4001624cbd38ee06cc1a9aa71 Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Wed, 2 Oct 2024 09:27:35 +1000 Subject: [PATCH 04/14] Minor edits in tests to deactivate pscotch being used --- test/PLaplacianTests.jl | 7 +++++-- test/PoissonTests.jl | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/PLaplacianTests.jl b/test/PLaplacianTests.jl index 48ba984..78ff2eb 100644 --- a/test/PLaplacianTests.jl +++ b/test/PLaplacianTests.jl @@ -39,8 +39,11 @@ function mysnessetup(snes) @check_error_code GridapPETSc.PETSC.PCFactorSetUpMatSolverType(pc[]) @check_error_code GridapPETSc.PETSC.PCFactorGetMatrix(pc[],mumpsmat) @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 4, 2) - @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 28, 2) - @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 29, 2) + # Jordi: I've had to change to sequential ordering, since the jll binaries do not have pSCOTCH + # @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 28, 2) # 1-sequential,2-parallel + # @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 29, 2) # 1-parmetis, 2-pscotch + @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 28, 1) + @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 7, 0) @check_error_code GridapPETSc.PETSC.MatMumpsSetCntl(mumpsmat[], 3, 1.0e-6) end diff --git a/test/PoissonTests.jl b/test/PoissonTests.jl index 661b94a..78fe720 100644 --- a/test/PoissonTests.jl +++ b/test/PoissonTests.jl @@ -21,8 +21,11 @@ function mykspsetup(ksp) @check_error_code GridapPETSc.PETSC.PCFactorSetUpMatSolverType(pc[]) @check_error_code GridapPETSc.PETSC.PCFactorGetMatrix(pc[],mumpsmat) @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 4, 2) - @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 28, 2) - @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 29, 2) + # Jordi: I've had to change to sequential ordering, since the jll binaries do not have pSCOTCH + # @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 28, 2) # 1-sequential,2-parallel + # @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 29, 2) # 1-parmetis, 2-pscotch + @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 28, 1) + @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 7, 0) @check_error_code GridapPETSc.PETSC.MatMumpsSetCntl(mumpsmat[], 3, 1.0e-6) @check_error_code GridapPETSc.PETSC.KSPSetFromOptions(ksp[]) end From 055db2cecfb080807e3b7639aa5eef412efc65ba Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Wed, 2 Oct 2024 09:29:42 +1000 Subject: [PATCH 05/14] CIEXTRA now tests with PETSc 3.20.5 like the jll binaries --- .github/workflows/ci_extra.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci_extra.yml b/.github/workflows/ci_extra.yml index ace06c6..86fcf2a 100644 --- a/.github/workflows/ci_extra.yml +++ b/.github/workflows/ci_extra.yml @@ -17,8 +17,7 @@ jobs: - x64 petsc_version: - '3.15.4' - - '3.18.4' - - '3.19.4' + - '3.20.5' steps: - uses: actions/checkout@v2 - name: Cache petsc From a869e440da350a4f09b039403f342ea2c98b2498 Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Wed, 2 Oct 2024 09:38:04 +1000 Subject: [PATCH 06/14] Changed tarball repository for petsc --- .github/workflows/ci_extra.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_extra.yml b/.github/workflows/ci_extra.yml index 86fcf2a..f6d152c 100644 --- a/.github/workflows/ci_extra.yml +++ b/.github/workflows/ci_extra.yml @@ -47,7 +47,7 @@ jobs: INSTALL_ROOT=/opt PETSC_INSTALL=$INSTALL_ROOT/$PACKAGE/$VERSION TAR_FILE=$PACKAGE-$VERSION.tar.gz - URL="https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/" + URL="https://web.cels.anl.gov/projects/petsc/download/release-snapshots/" ROOT_DIR=/tmp SOURCES_DIR=$ROOT_DIR/$PACKAGE-$VERSION BUILD_DIR=$SOURCES_DIR/build From 83b247e7285e14333d0337b0fdf1832a877a79b9 Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Wed, 2 Oct 2024 12:35:22 +1000 Subject: [PATCH 07/14] Minor --- src/PETScLinearSolvers.jl | 4 ++-- test/PartitionedArraysTests.jl | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/PETScLinearSolvers.jl b/src/PETScLinearSolvers.jl index 291ad40..21ee559 100644 --- a/src/PETScLinearSolvers.jl +++ b/src/PETScLinearSolvers.jl @@ -88,8 +88,8 @@ function Algebra.solve!(x::AbstractVector,ns::PETScLinearSolverNS,b::AbstractVec end function Algebra.solve!(x::PVector,ns::PETScLinearSolverNS,b::PVector) - X = similar(b,(axes(ns.A)[2],)) - B = similar(b,(axes(ns.A)[2],)) + X = similar(b,(axes(ns.A,2),)) + B = similar(b,(axes(ns.A,1),)) copy!(X,x) copy!(B,b) Y = convert(PETScVector,X) diff --git a/test/PartitionedArraysTests.jl b/test/PartitionedArraysTests.jl index 10bc01d..f57d5d9 100644 --- a/test/PartitionedArraysTests.jl +++ b/test/PartitionedArraysTests.jl @@ -147,23 +147,22 @@ function partitioned_tests(distribute,nparts) function solve_system_and_check_solution(A::PSparseMatrix,B::PETScMatrix,v) solver = PETScLinearSolver() - ss = symbolic_setup(solver,A) - ns = numerical_setup(ss,A) + + ns = numerical_setup(symbolic_setup(solver,A),A) consistent!(v) |> fetch - y = pfill(0.0,partition(ids)) - z = pfill(0.0,partition(ids)) + y = pfill(0.0,partition(axes(A,1))) + z = pfill(0.0,partition(axes(A,2))) mul!(y,A,v) - consistent!(y) |> fetch z = solve!(z,ns,y) consistent!(z) |> fetch nspetsc = numerical_setup(symbolic_setup(PETScLinearSolver(),B),B) ypetsc = convert(PETScVector,y) - zpetsc = PETScVector(0.0,ids) + zpetsc = PETScVector(0.0,partition(axes(A,2))) zpetsc = solve!(zpetsc,nspetsc,ypetsc) - test_vectors(y,ypetsc,ids) - test_vectors(z,zpetsc,ids) + test_vectors(y,ypetsc,axes(A,1)) + test_vectors(z,zpetsc,axes(A,2)) map(parts,partition(z),partition(v)) do p,z,v @test maximum(abs.(z-v)) < 1e-5 From b9d8a66a385e7f0475046552573265e926eac4e2 Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Wed, 2 Oct 2024 13:02:42 +1000 Subject: [PATCH 08/14] Minor --- test/PartitionedArraysTests.jl | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/test/PartitionedArraysTests.jl b/test/PartitionedArraysTests.jl index f57d5d9..c643ab2 100644 --- a/test/PartitionedArraysTests.jl +++ b/test/PartitionedArraysTests.jl @@ -8,24 +8,6 @@ using LinearAlgebra using PartitionedArrays: assemble_coo! -function set_mumps_options(ksp) - pc = Ref{GridapPETSc.PETSC.PC}() - mumpsmat = Ref{GridapPETSc.PETSC.Mat}() - @check_error_code GridapPETSc.PETSC.KSPView(ksp[],C_NULL) - @check_error_code GridapPETSc.PETSC.KSPSetType(ksp[],GridapPETSc.PETSC.KSPPREONLY) - @check_error_code GridapPETSc.PETSC.KSPGetPC(ksp[],pc) - @check_error_code GridapPETSc.PETSC.PCSetType(pc[],GridapPETSc.PETSC.PCLU) - @check_error_code GridapPETSc.PETSC.PCFactorSetMatSolverType(pc[],GridapPETSc.PETSC.MATSOLVERMUMPS) - @check_error_code GridapPETSc.PETSC.PCFactorSetUpMatSolverType(pc[]) - @check_error_code GridapPETSc.PETSC.PCFactorGetMatrix(pc[],mumpsmat) - @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 4, 1) - # percentage increase in the estimated working space - @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 14, 1000) - @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 28, 2) - @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 29, 2) - @check_error_code GridapPETSc.PETSC.MatMumpsSetCntl(mumpsmat[], 3, 1.0e-6) -end - function partitioned_tests(distribute,nparts) parts = distribute(LinearIndices((prod(nparts),))) @@ -158,7 +140,7 @@ function partitioned_tests(distribute,nparts) nspetsc = numerical_setup(symbolic_setup(PETScLinearSolver(),B),B) ypetsc = convert(PETScVector,y) - zpetsc = PETScVector(0.0,partition(axes(A,2))) + zpetsc = PETScVector(0.0,axes(A,2)) zpetsc = solve!(zpetsc,nspetsc,ypetsc) test_vectors(y,ypetsc,axes(A,1)) @@ -181,3 +163,7 @@ function partitioned_tests(distribute,nparts) GridapPETSc.Finalize(x) GridapPETSc.Finalize() end + + +partitioned_tests(DebugArray,3) + From b1b9900039141dd654e6f7c65c88c1b23e6fe2fb Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Sun, 1 Dec 2024 23:46:15 +1100 Subject: [PATCH 09/14] Minor --- test/PartitionedArraysTests.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/PartitionedArraysTests.jl b/test/PartitionedArraysTests.jl index c643ab2..4f94ed4 100644 --- a/test/PartitionedArraysTests.jl +++ b/test/PartitionedArraysTests.jl @@ -135,7 +135,12 @@ function partitioned_tests(distribute,nparts) y = pfill(0.0,partition(axes(A,1))) z = pfill(0.0,partition(axes(A,2))) mul!(y,A,v) +<<<<<<< Updated upstream z = solve!(z,ns,y) +======= + consistent!(y) |> fetch + solve!(z,ns,y) +>>>>>>> Stashed changes consistent!(z) |> fetch nspetsc = numerical_setup(symbolic_setup(PETScLinearSolver(),B),B) @@ -146,7 +151,7 @@ function partitioned_tests(distribute,nparts) test_vectors(y,ypetsc,axes(A,1)) test_vectors(z,zpetsc,axes(A,2)) - map(parts,partition(z),partition(v)) do p,z,v + map(partition(z),partition(v)) do z,v @test maximum(abs.(z-v)) < 1e-5 end GridapPETSc.Finalize(ypetsc) From 7d723e3c4e70a28473da31492067e1e2aee02248 Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Sun, 1 Dec 2024 23:52:08 +1100 Subject: [PATCH 10/14] Minor --- test/PartitionedArraysTests.jl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/PartitionedArraysTests.jl b/test/PartitionedArraysTests.jl index 4f94ed4..c4f27d1 100644 --- a/test/PartitionedArraysTests.jl +++ b/test/PartitionedArraysTests.jl @@ -135,12 +135,8 @@ function partitioned_tests(distribute,nparts) y = pfill(0.0,partition(axes(A,1))) z = pfill(0.0,partition(axes(A,2))) mul!(y,A,v) -<<<<<<< Updated upstream - z = solve!(z,ns,y) -======= consistent!(y) |> fetch solve!(z,ns,y) ->>>>>>> Stashed changes consistent!(z) |> fetch nspetsc = numerical_setup(symbolic_setup(PETScLinearSolver(),B),B) From 9bab57af4d107f3d4ff768a5d994786f59571b91 Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Sun, 1 Dec 2024 23:53:54 +1100 Subject: [PATCH 11/14] Minor --- test/PartitionedArraysTests.jl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/PartitionedArraysTests.jl b/test/PartitionedArraysTests.jl index c4f27d1..68105bc 100644 --- a/test/PartitionedArraysTests.jl +++ b/test/PartitionedArraysTests.jl @@ -164,7 +164,3 @@ function partitioned_tests(distribute,nparts) GridapPETSc.Finalize(x) GridapPETSc.Finalize() end - - -partitioned_tests(DebugArray,3) - From b7d02224e78c80676de1dbfcc695a23a8c8317cd Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Mon, 2 Dec 2024 00:16:36 +1100 Subject: [PATCH 12/14] MInor --- test/PLaplacianTests.jl | 27 +++++----- test/PoissonTests.jl | 108 ++++++++++++++++++++-------------------- 2 files changed, 69 insertions(+), 66 deletions(-) diff --git a/test/PLaplacianTests.jl b/test/PLaplacianTests.jl index 78ff2eb..f2eed62 100644 --- a/test/PLaplacianTests.jl +++ b/test/PLaplacianTests.jl @@ -8,13 +8,15 @@ using Test using SparseMatricesCSR -function snes_convergence_test(snes::SNES, - it::PetscInt, - xnorm::PetscReal, - gnorm::PetscReal, - f::PetscReal, - reason::Ptr{PETSC.SNESConvergedReason}, - user::Ptr{Cvoid})::PetscInt +function snes_convergence_test( + snes::SNES, + it::PetscInt, + xnorm::PetscReal, + gnorm::PetscReal, + f::PetscReal, + reason::Ptr{PETSC.SNESConvergedReason}, + user::Ptr{Cvoid} +)::PetscInt PETSC.SNESConvergedDefault(snes, it, xnorm, gnorm, f, reason, user) end @@ -44,7 +46,7 @@ function mysnessetup(snes) # @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 29, 2) # 1-parmetis, 2-pscotch @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 28, 1) @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 7, 0) - @check_error_code GridapPETSc.PETSC.MatMumpsSetCntl(mumpsmat[], 3, 1.0e-6) + # @check_error_code GridapPETSc.PETSC.MatMumpsSetCntl(mumpsmat[], 3, 1.0e-6) end function main(distribute,nparts) @@ -63,8 +65,8 @@ function main(distribute,nparts,solver) error() end GridapPETSc.with(args=split(options)) do - main(distribute,nparts,solver,FullyAssembledRows()) - main(distribute,nparts,solver,SubAssembledRows()) + main(distribute,nparts,solver,FullyAssembledRows()) + main(distribute,nparts,solver,SubAssembledRows()) end end @@ -90,8 +92,9 @@ function main(distribute,nparts,solver,strategy) V = TestFESpace(model,reffe,dirichlet_tags="boundary") U = TrialFESpace(u,V) - assem = SparseMatrixAssembler(SparseMatrixCSR{0,PetscScalar,PetscInt}, - Vector{PetscScalar},U,V,strategy) + assem = SparseMatrixAssembler( + SparseMatrixCSR{0,PetscScalar,PetscInt},Vector{PetscScalar},U,V,strategy + ) op = FEOperator(r,j,U,V,assem) diff --git a/test/PoissonTests.jl b/test/PoissonTests.jl index 78fe720..e005376 100644 --- a/test/PoissonTests.jl +++ b/test/PoissonTests.jl @@ -27,7 +27,7 @@ function mykspsetup(ksp) @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 28, 1) @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 7, 0) @check_error_code GridapPETSc.PETSC.MatMumpsSetCntl(mumpsmat[], 3, 1.0e-6) - @check_error_code GridapPETSc.PETSC.KSPSetFromOptions(ksp[]) + # @check_error_code GridapPETSc.PETSC.KSPSetFromOptions(ksp[]) end function main(distribute,nparts) @@ -48,67 +48,67 @@ function main(distribute,nparts,solver) error() end GridapPETSc.with(args=split(options)) do - domain = (0,4,0,4) - cells = (4,4) - model = CartesianDiscreteModel(parts,nparts,domain,cells) + domain = (0,4,0,4) + cells = (4,4) + model = CartesianDiscreteModel(parts,nparts,domain,cells) - labels = get_face_labeling(model) - add_tag_from_tags!(labels,"dirichlet",[1,2,3,5,7]) - add_tag_from_tags!(labels,"neumann",[4,6,8]) + labels = get_face_labeling(model) + add_tag_from_tags!(labels,"dirichlet",[1,2,3,5,7]) + add_tag_from_tags!(labels,"neumann",[4,6,8]) - Ω = Triangulation(model) - Γn = Boundary(model,tags="neumann") - n_Γn = get_normal_vector(Γn) + Ω = Triangulation(model) + Γn = Boundary(model,tags="neumann") + n_Γn = get_normal_vector(Γn) - k = 2 - u((x,y)) = (x+y)^k - f(x) = -Δ(u,x) - g = n_Γn⋅∇(u) + k = 2 + u((x,y)) = (x+y)^k + f(x) = -Δ(u,x) + g = n_Γn⋅∇(u) - reffe = ReferenceFE(lagrangian,Float64,k) - V = TestFESpace(model,reffe,dirichlet_tags="dirichlet") - U = TrialFESpace(u,V) + reffe = ReferenceFE(lagrangian,Float64,k) + V = TestFESpace(model,reffe,dirichlet_tags="dirichlet") + U = TrialFESpace(u,V) - dΩ = Measure(Ω,2*k) - dΓn = Measure(Γn,2*k) + dΩ = Measure(Ω,2*k) + dΓn = Measure(Γn,2*k) - a(u,v) = ∫( ∇(v)⋅∇(u) )dΩ - l(v) = ∫( v*f )dΩ + ∫( v*g )dΓn + a(u,v) = ∫( ∇(v)⋅∇(u) )dΩ + l(v) = ∫( v*f )dΩ + ∫( v*g )dΓn - Tm = SparseMatrixCSR{0,PetscScalar,PetscInt} - Tv = Vector{PetscScalar} - assem = SparseMatrixAssembler(Tm,Tv,U,V) - op = AffineFEOperator(a,l,U,V,assem) + Tm = SparseMatrixCSR{0,PetscScalar,PetscInt} + Tv = Vector{PetscScalar} + assem = SparseMatrixAssembler(Tm,Tv,U,V) + op = AffineFEOperator(a,l,U,V,assem) - v_julia = get_vector(op) - v_petsc = convert(PETScVector,v_julia) - copy!(v_julia,v_petsc) - copy!(v_petsc,v_julia) + v_julia = get_vector(op) + v_petsc = convert(PETScVector,v_julia) + copy!(v_julia,v_petsc) + copy!(v_petsc,v_julia) - # Checking that convert performs deep copies and does not modify A - A = get_matrix(op) - vals_copy = map(partition(A)) do A - @test typeof(A)==SparseMatrixCSR{0,PetscScalar,PetscInt} - i = copy(A.rowptr) - j = copy(A.colval) - a = copy(A.nzval) - i,j,a - end - Apetsc = convert(PETScMatrix,A) - map(partition(A),vals_copy) do A, (i,j,a) - @test all(i .== A.rowptr) - @test all(j .== A.colval) - @test all(a .== A.nzval) - end + # Checking that convert performs deep copies and does not modify A + A = get_matrix(op) + vals_copy = map(partition(A)) do A + @test typeof(A)==SparseMatrixCSR{0,PetscScalar,PetscInt} + i = copy(A.rowptr) + j = copy(A.colval) + a = copy(A.nzval) + i,j,a + end + Apetsc = convert(PETScMatrix,A) + map(partition(A),vals_copy) do A, (i,j,a) + @test all(i .== A.rowptr) + @test all(j .== A.colval) + @test all(a .== A.nzval) + end - if solver == :mumps - ls = PETScLinearSolver(mykspsetup) - else - ls = PETScLinearSolver() - end - fels = LinearFESolver(ls) - uh = solve(fels,op) - eh = u - uh - @test sqrt(sum( ∫(abs2(eh))dΩ )) < 1.0e-9 + if solver == :mumps + ls = PETScLinearSolver(mykspsetup) + else + ls = PETScLinearSolver() + end + fels = LinearFESolver(ls) + uh = solve(fels,op) + eh = u - uh + @test sqrt(sum( ∫(abs2(eh))dΩ )) < 1.0e-9 end - end +end From 55ca27b2ce255583b922a3615742a0d052dfb060 Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Mon, 2 Dec 2024 08:55:13 +1100 Subject: [PATCH 13/14] More changes --- .github/workflows/ci.yml | 25 ++++++++----------------- .github/workflows/ci_extra.yml | 8 ++++---- test/PartitionedArraysTests.jl | 2 +- test/PoissonTests.jl | 4 ++-- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88ad2f6..10ab9cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,41 +8,32 @@ jobs: fail-fast: false matrix: version: - - '1.9' + - '1.10' os: - ubuntu-latest arch: - x64 steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v1 - env: - cache-name: cache-artifacts - with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- + - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v4 with: file: lcov.info docs: name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 with: - version: '1.9' + version: '1.10' - run: | julia --project=docs -e ' using Pkg diff --git a/.github/workflows/ci_extra.yml b/.github/workflows/ci_extra.yml index f6d152c..198424d 100644 --- a/.github/workflows/ci_extra.yml +++ b/.github/workflows/ci_extra.yml @@ -10,16 +10,16 @@ jobs: fail-fast: false matrix: version: - - '1.9' + - '1.10' os: - ubuntu-latest arch: - x64 petsc_version: - '3.15.4' - - '3.20.5' + - '3.22.0' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Cache petsc id: cache-petsc uses: actions/cache@v2 @@ -30,7 +30,7 @@ jobs: ${{ runner.os }}-build-${{ env.JULIA_PETSC_LIBRARY }}- ${{ runner.os }}-build- ${{ runner.os }}- - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} diff --git a/test/PartitionedArraysTests.jl b/test/PartitionedArraysTests.jl index 68105bc..b587ce7 100644 --- a/test/PartitionedArraysTests.jl +++ b/test/PartitionedArraysTests.jl @@ -136,7 +136,7 @@ function partitioned_tests(distribute,nparts) z = pfill(0.0,partition(axes(A,2))) mul!(y,A,v) consistent!(y) |> fetch - solve!(z,ns,y) + z = solve!(z,ns,y) consistent!(z) |> fetch nspetsc = numerical_setup(symbolic_setup(PETScLinearSolver(),B),B) diff --git a/test/PoissonTests.jl b/test/PoissonTests.jl index e005376..cf32352 100644 --- a/test/PoissonTests.jl +++ b/test/PoissonTests.jl @@ -26,8 +26,8 @@ function mykspsetup(ksp) # @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 29, 2) # 1-parmetis, 2-pscotch @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 28, 1) @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 7, 0) - @check_error_code GridapPETSc.PETSC.MatMumpsSetCntl(mumpsmat[], 3, 1.0e-6) - # @check_error_code GridapPETSc.PETSC.KSPSetFromOptions(ksp[]) + # @check_error_code GridapPETSc.PETSC.MatMumpsSetCntl(mumpsmat[], 3, 1.0e-6) + @check_error_code GridapPETSc.PETSC.KSPSetFromOptions(ksp[]) end function main(distribute,nparts) From 827eb0c880fdef7e34592f3d4d032bd386e5d56f Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Mon, 2 Dec 2024 09:27:35 +1100 Subject: [PATCH 14/14] Minor --- src/Environment.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Environment.jl b/src/Environment.jl index f642c75..d599a51 100644 --- a/src/Environment.jl +++ b/src/Environment.jl @@ -1,7 +1,7 @@ function Init(;args=String[],file="",help="",finalize_atexit=true) if !MPI.Initialized() - MPI.Init() + MPI.Init() end if finalize_atexit atexit(Finalize) @@ -23,7 +23,7 @@ const _NREFS = Ref(0) function Finalize() if Initialized() - GC.gc() # Finalize all object out of scope at this point + gridap_petsc_gc() # Finalize all object out of scope at this point if _NREFS[] != 0 @warn "$(_NREFS[]) objects still not finalized before calling GridapPETSc.Finalize()" end