Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
65bf9c3
Enable the use of 0th order assembled newton polynomial form of gmres…
stevendargaville Jan 15, 2026
90ca1d1
Enable the use of 1st order assembled newton polynomial form of gmres…
stevendargaville Jan 15, 2026
aa688c2
Enable the use of not fixed sparsity assembled newton polynomial form…
stevendargaville Jan 15, 2026
f336df6
Rewrite the newton first order assembled so it doesn't compute theta_…
stevendargaville Jan 15, 2026
bf9a0da
Was accidently finishing an order early for the newton assembled not …
stevendargaville Jan 15, 2026
ad448b8
Tidy variable names and fix comment
stevendargaville Jan 16, 2026
4e94aff
Enable the use of 0th order fixed sparsity (diagonal) assembled newto…
stevendargaville Jan 16, 2026
784dcc7
Most of the work for the fixed sparsity Newton polynomials on CPUs is…
stevendargaville Jan 17, 2026
c163ec4
Partially finished higher order sparsity terms. The (r,r,r) and (c,c,…
stevendargaville Jan 29, 2026
fcbed54
High order terms with first order sparsity are now correct
stevendargaville Jan 29, 2026
f370c9d
Add in fixed sparsity order 1 assembled newton tests. The tests hit t…
stevendargaville Jan 29, 2026
ec58033
Add test that checks the difference between residuals for different t…
stevendargaville Jan 30, 2026
6c0f56b
Higher order terms are working for newton assembly. Still more testin…
stevendargaville Feb 5, 2026
ea31e5b
More careful about zero eigenvalues. Also saw a case where rounding i…
stevendargaville Feb 5, 2026
ff5b914
Higher order fixed sparsity is now correct. Still have to add more te…
stevendargaville Feb 9, 2026
e9e654a
Output was wrong in gmres polynomial comparison test
stevendargaville Feb 9, 2026
0aeed7e
Add tests for fixed sparsity
stevendargaville Feb 9, 2026
798b135
Fix 1st order sparsity
stevendargaville Feb 9, 2026
0bf4cd9
Fixed 1st order case where (r,r) but second is zero
stevendargaville Feb 9, 2026
bbbbac3
Added eigenvalue clustering to improve stbility of Newton form of GMR…
stevendargaville Feb 9, 2026
3675005
Fix bug in Newton where too little memorywas being allocated for the …
stevendargaville Feb 9, 2026
88d2c39
Add newton test for indefinite problem
stevendargaville Feb 9, 2026
54e02ff
Added 1138_bus test from matrix market and Loe's paper for Newton GMR…
stevendargaville Feb 9, 2026
d7ba683
Add higher order test that fails in Loe
stevendargaville Feb 9, 2026
0f15e4c
Add better comments for Newton GMRES polynomial
stevendargaville Feb 9, 2026
85015cf
Fix memory leaks
stevendargaville Feb 9, 2026
4b0d5dd
Add specific test with diagonal matrix for different GMRES polynomial…
stevendargaville Feb 10, 2026
ffccf78
64-bit fixes
stevendargaville Feb 10, 2026
725e974
64-bit fix for new diagonal test
stevendargaville Feb 10, 2026
385ea44
Fix coefficients access out of bounds in some circumstances
stevendargaville Feb 10, 2026
10328e9
Need to respect contiguous keyword when passing in coefficients below…
stevendargaville Feb 10, 2026
1da7e42
Failures in for loops in tests/Makefile weren't propogating through t…
stevendargaville Feb 10, 2026
30354dc
Detection of complex conjugate pairs was broken when imaginary parts …
stevendargaville Feb 10, 2026
38fba34
Fix memory leak
stevendargaville Feb 10, 2026
994a051
Iteration count change for CI
stevendargaville Feb 10, 2026
450d9bb
Intel CI is still broken with power basis, disable power basis compar…
stevendargaville Feb 10, 2026
dd15fcb
Update readme
stevendargaville Feb 10, 2026
85a3ab9
Some of the new tests exposed a bug in the Kokkos GMRES polynomial im…
stevendargaville Feb 10, 2026
9ddf8ee
Iteration count for test CI
stevendargaville Feb 10, 2026
d8f0022
Test that both matrix-free smoothing and assembled (to compute the re…
stevendargaville Feb 10, 2026
eb88540
Enable diagonal detection for Newton GMRES polynomial
stevendargaville Feb 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ OBJS := $(OBJS) $(SRCDIR)/PETSc_Helper.o \
$(SRCDIR)/PCPFLAREINV.o

# Define a variable containing all the tests
export TEST_TARGETS = ex12f ex6f ex6f_getcoeffs ex6 adv_1d adv_diff_2d ex6_cf_splitting adv_diff_cg_supg matrandom matrandom_check_reset
export TEST_TARGETS = ex12f ex6f ex6f_getcoeffs ex6 adv_1d adv_diff_2d ex6_cf_splitting adv_diff_cg_supg matrandom matrandom_check_reset ex12f_gmres_poly mat_diag
# Include kokkos examples
ifeq ($(PETSC_HAVE_KOKKOS),1)
export TEST_TARGETS := $(TEST_TARGETS) adv_1dk
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ PCPFLAREINV contains methods for computing approximate inverses, most of which c
| ------------- | -- | ------------- | -- |
| power | PFLAREINV_POWER | GMRES polynomial, applied as a mononomial, with coefficients computed with a power basis | Yes |
| arnoldi | PFLAREINV_ARNOLDI | GMRES polynomial, applied as a mononomial, with coefficients computed with an Arnoldi method | Yes |
| newton | PFLAREINV_NEWTON | GMRES polynomial, applied as a Newton polynomial, with roots computed with an Arnoldi method and with extra roots added for stability | Yes |
| newton_no_extra | PFLAREINV_NEWTON_NO_EXTRA | GMRES polynomial, applied as a Newton polynomial, with roots computed with an Arnoldi method and with no extra roots added | Yes |
| newton | PFLAREINV_NEWTON | GMRES polynomial, applied as a Newton polynomial, with roots computed with an Arnoldi method and with extra roots added for stability | Matrix-free: Yes Assembled: No |
| newton_no_extra | PFLAREINV_NEWTON_NO_EXTRA | GMRES polynomial, applied as a Newton polynomial, with roots computed with an Arnoldi method and with no extra roots added | Matrix-free: Yes Assembled: No |
| neumann | PFLAREINV_NEUMANN | Neumann polynomial | Yes |
| sai | PFLAREINV_SAI | Sparse approximate inverse | No |
| isai | PFLAREINV_ISAI | Incomplete sparse approximate inverse (equivalent to a one-level RAS) | No |
Expand Down
3 changes: 3 additions & 0 deletions dockerfiles/Dockerfile_intel
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ RUN source /opt/intel/oneapi/setvars.sh && \
sed -i '/^run_tests_load_parallel:/,/^run_tests_no_load_serial:/s/-pc_pflareinv_type power/-pc_pflareinv_type arnoldi/g' tests/Makefile && \
sed -i '/^run_tests_no_load_parallel:/,/^run_tests_medium_serial:/s/-pc_air_inverse_type power/-pc_air_inverse_type arnoldi/g' tests/Makefile && \
sed -i '/^run_tests_no_load_parallel:/,/^run_tests_medium_serial:/s/-pc_pflareinv_type power/-pc_pflareinv_type arnoldi/g' tests/Makefile && \
echo "Disabling power basis in parallel test ex12f_gmres_poly in tests/Makefile" && \
sed -i '/^run_tests_load_parallel:/,/^run_tests_no_load_serial:/s/ex12f_gmres_poly/ex12f_gmres_poly -no_power/g' tests/Makefile && \
sed -i '/^run_tests_no_load_parallel:/,/^run_tests_medium_serial:/s/ex12f_gmres_poly/ex12f_gmres_poly -no_power/g' tests/Makefile && \
make -j2 && make -j2 check && \
make -j2 tests

Expand Down
2 changes: 1 addition & 1 deletion src/AIR_MG_Setup.F90
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ subroutine setup_air_pcmg(amat, pmat, air_data, pcmg_input)
end if

! Convert Aff to a matdiagonal type
! Haven't rewritten sai to take advantage of matdiagonal
! Haven't rewritten some inverse types to take advantage of matdiagonal
if (aff_diag .AND. &
inverse_type_aff /= PFLAREINV_SAI .AND. &
inverse_type_aff /= PFLAREINV_ISAI) then
Expand Down
13 changes: 7 additions & 6 deletions src/Approx_Inverse_Setup.F90
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ subroutine calculate_and_build_approximate_inverse(matrix, inverse_type, &
allocate(coefficients(poly_order + 1, 1))
end if
else
coefficients => coefficients_stack
if (inverse_type == PFLAREINV_NEWTON .OR. inverse_type == PFLAREINV_NEWTON_NO_EXTRA) then
! Newton basis needs storage for real and imaginary roots
allocate(coefficients(poly_order + 1, 2))
else
coefficients => coefficients_stack
end if
end if

! This is diabolical - In petsc 3.22, they changed the way to test for
Expand Down Expand Up @@ -303,13 +308,9 @@ subroutine finish_approximate_inverse(matrix, inverse_type, &
! Gmres polynomial with newton basis
else if (inverse_type == PFLAREINV_NEWTON .OR. inverse_type == PFLAREINV_NEWTON_NO_EXTRA) then

if (.NOT. matrix_free) then
print *, "GMRES polynomial with Newton basis must be applied matrix-free"
call MPI_Abort(MPI_COMM_WORLD, MPI_ERR_OTHER, errorcode)
end if

call build_gmres_polynomial_newton_inverse(matrix, poly_order, &
coefficients, &
inverse_sparsity_order, matrix_free, reuse_mat, reuse_submatrices, &
inv_matrix)

! Neumann polynomial
Expand Down
19 changes: 9 additions & 10 deletions src/Gmres_Poly.F90
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,6 @@ subroutine mat_mult_powers_share_sparsity_cpu(matrix, poly_order, poly_sparsity_

! Compute matrix powers c = coeff(1) * I + coeff(2) * A + coeff(3) * A^2 + coeff(4) * A^3 + ...
! where a c and the powers all share the same sparsity as the power input in poly_sparsity_order
! Assuming cmat has not been built/allocated
! This also finishes the async comms required to compute the gmres poly coefficients if buffers%request is allocated

! ~~~~~~~~~~
Expand Down Expand Up @@ -1655,7 +1654,7 @@ subroutine build_gmres_polynomial_inverse_0th_order_sparsity(matrix, poly_order,
integer :: order
PetscErrorCode :: ierr
logical :: reuse_triggered
type(tVec) :: rhs_copy, diag_vec, power_vec
type(tVec) :: inv_vec, diag_vec, power_vec
! ~~~~~~

reuse_triggered = .NOT. PetscObjectIsNull(inv_matrix)
Expand All @@ -1666,9 +1665,9 @@ subroutine build_gmres_polynomial_inverse_0th_order_sparsity(matrix, poly_order,

! This stores D^order
if (.NOT. reuse_triggered) then
call VecDuplicate(diag_vec, rhs_copy, ierr)
call VecDuplicate(diag_vec, inv_vec, ierr)
else
call MatDiagonalGetDiagonal(inv_matrix, rhs_copy, ierr)
call MatDiagonalGetDiagonal(inv_matrix, inv_vec, ierr)
end if
call VecCopy(diag_vec, power_vec, ierr)

Expand All @@ -1678,22 +1677,22 @@ subroutine build_gmres_polynomial_inverse_0th_order_sparsity(matrix, poly_order,
call finish_gmres_polynomial_coefficients_power(poly_order, buffers, coefficients)

! Set: alpha_0 * I
call VecSet(rhs_copy, coefficients(1), ierr)
call VecSet(inv_vec, coefficients(1), ierr)

! Calculate: alpha_0 * I + alpha_1 * D + alpha_2 * D^2
do order = 1, poly_order
call VecAXPY(rhs_copy, coefficients(order+1), power_vec, ierr)
call VecAXPY(inv_vec, coefficients(order+1), power_vec, ierr)
! Compute power_vec = power_vec * D
if (order /= poly_order) call VecPointwiseMult(power_vec, power_vec, diag_vec, ierr)
end do

! We may be reusing with the same sparsity
if (.NOT. reuse_triggered) then
! The matrix takes ownership of rhs_copy and increases ref counter
call MatCreateDiagonal(rhs_copy, inv_matrix, ierr)
call VecDestroy(rhs_copy, ierr)
! The matrix takes ownership of inv_vec and increases ref counter
call MatCreateDiagonal(inv_vec, inv_matrix, ierr)
call VecDestroy(inv_vec, ierr)
else
call MatDiagonalRestoreDiagonal(inv_matrix, rhs_copy, ierr)
call MatDiagonalRestoreDiagonal(inv_matrix, inv_vec, ierr)
end if

call VecDestroy(diag_vec, ierr)
Expand Down
Loading
Loading