Skip to content

Commit a54bffe

Browse files
author
Javier Velo
committed
Merge branch '535-interface-problem-for-newer-petsc-versions' into 'development'
Support for PETSc 3.24.x Closes #535 See merge request damask/DAMASK!1135
2 parents 8c0fcb7 + dc9aa42 commit a54bffe

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ variables:
1212
GIT_SUBMODULE_STRATEGY: normal
1313
# Shortcut names
1414
MARC_VERSION: '2024.1'
15-
PETSC_GCC_LATEST: '2025.05.27'
16-
PETSC_ONEAPI_LATEST: '2025.06.12'
15+
PETSC_GCC_LATEST: '2025.09.30'
16+
PETSC_ONEAPI_LATEST: '2025.09.30'
1717

1818

1919
####################################################################################################

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ endif()
1111
# Dummy project to determine compiler names and version
1212
project(Prerequisites LANGUAGES)
1313
set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
14-
pkg_check_modules(PETSC_MIN REQUIRED PETSc>=3.15.0 QUIET) #CMake does not support version range
15-
pkg_check_modules(PETSC REQUIRED PETSc<3.24.0)
14+
set(PETSC_VERSION_MINOR_MIN "15")
15+
set(PETSC_VERSION_MINOR_MAX "24")
16+
17+
pkg_check_modules(PETSC_MIN REQUIRED PETSc>=3.${PETSC_VERSION_MINOR_MIN}.0 QUIET) #CMake does not support version range
18+
pkg_check_modules(PETSC REQUIRED PETSc<=3.${PETSC_VERSION_MINOR_MAX}.99)
1619

1720
pkg_get_variable(CMAKE_Fortran_COMPILER PETSc fcompiler)
1821
pkg_get_variable(CMAKE_C_COMPILER PETSc ccompiler)

PRIVATE

src/CLI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ void CLI::init_print() {
186186
<< " https://doi.org/10.1016/j.commatsci.2018.04.030" << std::endl << std::endl;
187187

188188
#define PETSC_MINOR_MIN 15
189-
#define PETSC_MINOR_MAX 23
189+
#define PETSC_MINOR_MAX 24
190190
#if PETSC_VERSION_MAJOR != 3 || PETSC_VERSION_MINOR < PETSC_MINOR_MIN || PETSC_VERSION_MINOR > PETSC_MINOR_MAX
191191
#error "-- UNSUPPORTED PETSc VERSION --- UNSUPPORTED PETSc VERSION --- UNSUPPORTED PETSc VERSION ---"
192192
#else

src/CLI.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
!> @brief Parse command line interface for PETSc-based solvers
77
!--------------------------------------------------------------------------------------------------
88
#define PETSC_MINOR_MIN 15
9-
#define PETSC_MINOR_MAX 23
9+
#define PETSC_MINOR_MAX 24
1010

1111
module CLI
1212
use, intrinsic :: ISO_Fortran_env
@@ -70,8 +70,8 @@ end subroutine C_CLI_getParsedArgs
7070
contains
7171

7272
!--------------------------------------------------------------------------------------------------
73-
!> @brief Initialize the solver by interpreting the command line arguments. Write
74-
!! information on computation to screen
73+
!> @brief Initialize the solver by interpreting the command line arguments and write
74+
!! information on computation to screen.
7575
!--------------------------------------------------------------------------------------------------
7676
subroutine CLI_init()
7777
#include <petsc/finclude/petscsys.h>

src/grid/grid_mech_spectral_Galerkin.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,16 @@ subroutine MatShellSetOperation(mat,op_num,op_callback,ierr)
118118
PetscErrorCode :: ierr
119119
end subroutine MatShellSetOperation
120120

121+
#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR<24)
121122
subroutine SNESSetUpdate(snes_mech,upd_callback,ierr)
122123
use petscsnes
123124
SNES :: snes_mech
124125
external :: upd_callback
125126
PetscErrorCode :: ierr
126127
end subroutine SNESSetUpdate
127-
end interface
128+
#endif
128129

129130
#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR<23)
130-
interface
131131
subroutine MatShellSetContext(mat,ctx,ierr)
132132
use petscmat
133133
Mat :: mat
@@ -152,8 +152,8 @@ subroutine SNESSetJacobian(snes_mech,A,P,jac_callback,ctx,ierr)
152152
PetscErrorCode :: ierr
153153
end subroutine SNESSetJacobian
154154
#endif
155-
end interface
156155
#endif
156+
end interface
157157

158158
contains
159159

0 commit comments

Comments
 (0)