Merge remote-tracking branch 'origin/release'
Merge branch 'jose/fix-hipsparse-csrmv-trans' into 'release'hipSPARSE: workaround for issue with transpose matmult in ROCm 7.2.0See merge request petsc/petsc!9056
HIPSPARSE: workaround for issue with transpose matmult in ROCm 7.2.0When built with ROCm 7.2.0 MatMultTranspose() fails with:[0]PETSC ERROR: --------------------- Error Message ------------------
HIPSPARSE: workaround for issue with transpose matmult in ROCm 7.2.0When built with ROCm 7.2.0 MatMultTranspose() fails with:[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------[0]PETSC ERROR: GPU error[0]PETSC ERROR: hipSPARSE errorcode 3 (HIPSPARSE_STATUS_INVALID_VALUE)[0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.[0]PETSC ERROR: PETSc Development Git Revision: v3.24.4-488-g2c105492db5 Git Date: 2026-02-19 16:00:40 +0000[0]PETSC ERROR: ../test1 with 1 MPI process(es) and PETSC_ARCH arch-gnu-c-opt-hip Fri Feb 20 16:47:04 2026[0]PETSC ERROR: Configure options: --with-hip --with-debugging=0 COPTFLAGS=-O FOPTFLAGS=-O CXXOPTFLAGS=-O HIPOPTFLAGS=-O[0]PETSC ERROR: #1 MatMultAddKernel_SeqAIJHIPSPARSE() at petsc/src/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.cxx:3116[0]PETSC ERROR: #2 MatMultTranspose_SeqAIJHIPSPARSE() at petsc/src/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.cxx:3010[0]PETSC ERROR: #3 MatMultTranspose() at petsc/src/mat/interface/matrix.c:2741[0]PETSC ERROR: #4 MatMult_Transpose() at petsc/src/mat/impls/transpose/transm.c:9The issue can be attributed to ROCm 7.2.0 using four minimal examplesfor CSR mat-vec: level2 and generic interfaces, both transpose andnon-transpose. The generic-transpose version does not work, it failswith code: 10, reason: function is not implemented. The workaround inPETSc is to fall back to the level2 interface if ROCm version is 7.2.0.The second change is to avoid a compile warning.
show more ...
Fix compile warning with recent version of ROCmsrc/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.cpp:4199:27: warning: 'identity<int>' is deprecated: use ::internal::identity instead [-Wdeprecate
Fix compile warning with recent version of ROCmsrc/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.cpp:4199:27: warning: 'identity<int>' is deprecated: use ::internal::identity instead [-Wdeprecated-declarations] 4199 | auto pred = thrust::identity<int>(); | ^/opt/rocm-7.2.0/include/thrust/functional.h:1182:8: note: 'identity<int>' has been explicitly marked deprecated here 1182 | struct THRUST_DEPRECATED_BECAUSE("use ::internal::identity instead") identity | ^/opt/rocm-7.2.0/include/thrust/detail/config/deprecated.h:41:44: note: expanded from macro 'THRUST_DEPRECATED_BECAUSE' 41 | # define THRUST_DEPRECATED_BECAUSE(MSG) [[deprecated(MSG)]] | ^
Change *.cpp to *.cxx
Add automatic generated fortran support for setting and returning contextsMajor cleanup of the code for setting and returning application (previously called user) contexts - PetscCtx ctx is now t
Add automatic generated fortran support for setting and returning contextsMajor cleanup of the code for setting and returning application (previously called user) contexts - PetscCtx ctx is now the standard for passing in contexts - PetscCtxRt ctx is the standard for passing out contexts, including context destroy routines based on PetscCtxDestroyFnBoth of these are typedef to void*Also removed most use of user and userctx for context arguments now consistently named ctxImproved documentation on PetscCtx and PetscCtxRt and on how to use contexts (including getting them) from Fortran
MatAssemblyEnd(): fix missing space in -info
Fix HIP compile warningsrc/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.cpp:1401:15: error: unused variable 'i' [-Werror,-Wunused-variable] 1401 | PetscInt i; | ^src/m
Fix HIP compile warningsrc/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.cpp:1401:15: error: unused variable 'i' [-Werror,-Wunused-variable] 1401 | PetscInt i; | ^src/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.cpp:1647:15: error: unused variable 'i' [-Werror,-Wunused-variable] 1647 | PetscInt i; | ^
- Replace MatMissingDiagonal() and MatMarkDiagonals_SeqXXX() with MatGetDiagonalMarkers_SeqXXX() - Mat_SeqXXX->diag is not automatically created during MatAssemblyEnd() saving memory and time
- Replace MatMissingDiagonal() and MatMarkDiagonals_SeqXXX() with MatGetDiagonalMarkers_SeqXXX() - Mat_SeqXXX->diag is not automatically created during MatAssemblyEnd() saving memory and time - Accessing Mat_SeqXXX->diag now requires the use of MatGetDiagonalMarkers_SeqXXX() except when the current values are known to be correct; for example during numerical factorizations and solves - Mat_SeqXXX->diag is now never shared among matrices; hence the free_diag flag is gone. That was always a risky proposition since any of the owning matrices could chang the values thus making them incorrect for other owners.
This MR optimize some MAT[SB]AIJ operations related to the diagonalThe longer term goal is to refactor some Mat_SeqXXX non-numeric code to make it easier to also implement it on GPUs. For example,
This MR optimize some MAT[SB]AIJ operations related to the diagonalThe longer term goal is to refactor some Mat_SeqXXX non-numeric code to make it easier to also implement it on GPUs. For example, MatGetDiagonal() and friendsThis commit- MatMarkDiagonal_SeqAIJ/ELL() - now use change in mat->nonzerostate to determine if it needs to recheck the diagonal locations - sets diagDense flag for a complete diagonal- MatInvertDiagonal_SeqAIJ/ELL() - now uses change in mat->state to determine if diagonal entries and inverses need to be recomputed - name changed to MatInvertDiagonalForSOR_SeqAIJ/ELL() for code clarity- Added MatInvertDiagonal_SeqAIJ_Inode() for use by MatSOR_SeqAIJ_Inode() - now uses change in mat->state to determine if block diagonal entries and inverses need to be recomputed
Change names of Mat_XXX product contexts to MatProductCtx_XXX for code maintainabilityUpdate destroy callback of all MatProductCtx and MatShellSetMatProductOperation() to use PetscCtxDestroyFn
Remove unnecessary braces around one-linersgit grep -lE "[ ]*(if|for|while) \(.*\) {[^;]*;[^;]*}$" -- '*.c' '*.cxx' '*.cu' '*.h' '*.hpp' '*.cpp' | xargs sed -i '' -E 's#([ ]*)(if|for|while) \((.*)\
Remove unnecessary braces around one-linersgit grep -lE "[ ]*(if|for|while) \(.*\) {[^;]*;[^;]*}$" -- '*.c' '*.cxx' '*.cu' '*.h' '*.hpp' '*.cpp' | xargs sed -i '' -E 's#([ ]*)(if|for|while) \((.*)\) {([^;]*);([^;]*)}$#\1\2 \(\3\)\4;\5#'
One-liners from petsc/petsc!5344 and petsc/petsc!5557Slightly reworked regular expressiongit ls-files -z -- '*.c' '*.cxx' '*.cu' '*.h' '*.hpp' '*.cpp' | while IFS= read -r -d '' file; do cat
One-liners from petsc/petsc!5344 and petsc/petsc!5557Slightly reworked regular expressiongit ls-files -z -- '*.c' '*.cxx' '*.cu' '*.h' '*.hpp' '*.cpp' | while IFS= read -r -d '' file; do cat $file | tr '\n' '\r' | sed -E 's/\r([ ]*)(for|if|while|else) ([^\r]*)\{\r[ ]*Petsc([a-zA-Z]*)\(([^\r]*)\);\r[ ]*\}\r/\r\1\2 \3Petsc\4(\5);\r/g' | tr '\r' '\n' > ${file}.joe; mv ${file}.joe ${file}done
Fix compile warningsrc/mat/impls/aij/seq/seqcusparse/aijcusparse.cu: In function ‘PetscErrorCode MatGetCurrentMemType_SeqAIJCUSPARSE(Mat, PetscMemType*)’:src/mat/impls/aij/seq/seqcusparse/aijcuspa
Fix compile warningsrc/mat/impls/aij/seq/seqcusparse/aijcusparse.cu: In function ‘PetscErrorCode MatGetCurrentMemType_SeqAIJCUSPARSE(Mat, PetscMemType*)’:src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu:3979:63: error: unused parameter ‘A’ [-Werror=unused-parameter] 3979 | static PetscErrorCode MatGetCurrentMemType_SeqAIJCUSPARSE(Mat A, PetscMemType *m) | ~~~~^
Make MatGetCurrentMemType first class API
Mat: rename inode.size and change it to csr format to facilitate parallel computing
Mat: change -mat_factor_bind_factorization <host | device> to -pc_factor_mat_factor_on_host <bool>Also add an option -pc_factor_mat_solve_on_host
Fortran 90: fully embrace After 34 years!- deprecate use of 'F90' in Fortran function names- use Fortran pointers when appropriate- the new Fortran API is not backward compatible with previous ve
Fortran 90: fully embrace After 34 years!- deprecate use of 'F90' in Fortran function names- use Fortran pointers when appropriate- the new Fortran API is not backward compatible with previous versions!- also clean up inconsistent PETSc code detected by new Fortran generation tools- drop use of bfort- automatically generate all the Fortran PETSc objects, enums etc from the include files- generate most of the Fortran interface definitions and functions from the source code- simplify the number and organization of Fortran modulesCo-authored-by: Jose E. Roman <jroman@dsic.upv.es>
Improve some manual pages in KSP/SNES
Unifies all context destructors to have a form of PetscCtxDestroyFn == PetscErrorCode (*)(void **)Changes the previous subset of destructor APIs that used PetscErrorCode (*)(void *) (mostly those t
Unifies all context destructors to have a form of PetscCtxDestroyFn == PetscErrorCode (*)(void **)Changes the previous subset of destructor APIs that used PetscErrorCode (*)(void *) (mostly those thatused PetscContainer- Now allows any context to be a PetscObject- Will provide a cleaner mapping to bindings in other languages- Simplifies the maintenance of PETSc source code; improves clarityNot backward compatible, compiler warnings will tell users what functions need to be updated
Use PetscObjectContainerCompose() when applicable
CI: update checkclangformat to use clang-format-19.1.0
Add shared memory support for PCMPI using both shmget() and MPI_Win_allocate_shared()
This requires some changes to user FORTRAN codePass PETSC_NULL_XXX_ARRAY when passing a NULL as an argument that is expecting an arrayPass PETSC_NULL_ENUM when argument returns an enum instead of
This requires some changes to user FORTRAN codePass PETSC_NULL_XXX_ARRAY when passing a NULL as an argument that is expecting an arrayPass PETSC_NULL_ENUM when argument returns an enum instead of PETSC_NULL_INTEGERPass arrays (and not scalar values) when the argument is expecting an array; this means replace, for example, the argument v with [v]Use PetscObjectIsNull(obj) to check if the object is NULL, instead of obj == PETSC_NULL_XXXThe compiler will now automatically prevent you from using the wrong argument type for the first three bullets aboveThis will also require an update sowing with the new sowing branch this MR is using.
1234