Skip to content

Conversation

@ZoeLeibowitz
Copy link
Contributor

While developing on the petsc branch, this PR adds docker-petsc.yml to build and push Dockerfile.petsc on pushes to the petsc branch. This PR also updates Dockerfile.petsc so that it uses devitocodes/devito:cpu-dev as its base. Marked as a draft until PR #2778 is reviewed/merged.

@codecov
Copy link

codecov bot commented Oct 30, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.98%. Comparing base (9451510) to head (17cc296).

Files with missing lines Patch % Lines
devito/petsc/config.py 57.14% 3 Missing ⚠️
devito/petsc/solver_parameters.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            petsc    #2779      +/-   ##
==========================================
- Coverage   75.98%   75.98%   -0.01%     
==========================================
  Files         273      273              
  Lines       53844    53850       +6     
  Branches     4551     4551              
==========================================
+ Hits        40913    40917       +4     
- Misses      12106    12108       +2     
  Partials      825      825              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

try:
from petsctools import get_petscvariables, MissingPetscException
petsc_variables = get_petscvariables()
except ImportError:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JDBetteridge I moved the petsc imports from requirements.txt to requirements-petsc.txt as you advised. As a result, the petsc dependencies are no longer installed in Dockerfile.devito - which is preferred - but this leads to the following errors (this and this). I've addressed them by wrapping the imports in except ImportError blocks (see also petsc/solver_parameters.py below), in a similar way to how mpi4py is imported in distributed.py. Is this fine? What is best practice? Any suggestions for a longer term solution, particularly as requirements-petsc.txt grows?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you will need to import guard petsctools. And wherever possible you should avoid importing anything PETSc specific if PETSc isn't present on the system. Long term we may want to revisit the module structure, but for now this is fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants