Support PETSc 3.23+ - #408
Open
sabakhshi wants to merge 18 commits into
Open
Conversation
Member
|
I'm getting this compiler error building with PETSc 3.25.4 |
`module utils` imported petscvec at module scope, so every file that imports `utils` transitively depended on `petscvec.mod`. The module has no default `private`, so it also re-exported all of petscvec to its two unqualified importers. Only `deallocDerivativeValues` needs it, for the `VecDestroy` calls at the end. Shrinks `utils.mod` from 272K to 7.0K. The regenerated Tapenade output drops the inherited import from `utils_d`, `utils_b` and `utils_fast_b`, none of which reference PETSc at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Same change as the previous commit. Here the module-scope `use petscvec` also sat outside the `#ifndef USE_TAPENADE` guard, so it leaked into the generated AD sources; the four procedures that touch PETSc are all inside that guard. No finclude is required, because the file declares no PETSc types of its own and PETSC_COPY_VALUES / PETSC_DETERMINE arrive through petscvec's re-export of petscis. Shrinks `walldistance.mod` from 266K to 19K. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`ADjointPETSc` does not declare PETSC_COMM_WORLD, KSP_NORM_NONE or PETSC_DEFAULT_REAL. It only passed them on from petscksp. Two files relied on that, which hides where the names come from and breaks as soon as the import in `ADjointPETSc` is narrowed. `module NKSolver` already imports petscksp at module scope, so those two names are host-associated and the borrowed copies can simply go. `initializePETSc` now takes PETSC_COMM_WORLD from petscsys, which is also the variable it assigns to. This follows the cleanup already started at preprocessingAPI.F90:1689 and adjointUtils.F90:733, where the same borrowed PETSc constants were commented out beside a direct `use petscvec`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
What was wrong with the Tapenade? All test were passing locally for both Meghna and I |
Member
The changes to the petsc imports changed the code generated by Tapenade, so the Tapenade CI check was failing, it passes now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
PetSC 3.23 introduced major breaking changes to the Fortran interface breaking a lot of code in ADflow.
This PR introduces compatibility with the changes in PetSC 3.23+.
Confirmed also working to PetSC 3.25.4.
Note this PR breaks compatibility with PetSC versions below 3.23
Expected time until merged
1 week
Type of change
Testing
All regression and units tests pass.
Checklist
ruff checkandruff formatto make sure the Python code adheres to PEP-8 and is consistently formattedfprettifyor C/C++ code withclang-formatas applicable