Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with uw_options if petsc4py/petsc imported before #210

Open
bknight1 opened this issue Jun 25, 2024 · 4 comments
Open

Issue with uw_options if petsc4py/petsc imported before #210

bknight1 opened this issue Jun 25, 2024 · 4 comments

Comments

@bknight1
Copy link
Member

Describe the bug

unable to use/read uw options if from petsc4py import PETSc is imported first

What version of underworld3 are you running and how to reproduce the bug.

Current dev branch

@lmoresi
Copy link
Member

lmoresi commented Jun 25, 2024

This one is for @julesghub - we have this problem of conda / mpi needing imports in one order and the petsc command line tools needing another.

@julesghub
Copy link
Member

Interesting. I think the uw version of the petsc options DB is likely out of sync with petsc's. That's my hunch.
Can you post a short example of how you're using it? Thanks.

@lmoresi
Copy link
Member

lmoresi commented Jun 26, 2024

It is just a subset of the petsc one. The examples would be the ones that Ben showed in the meeting on Monday - initialising the benchmark models.

@bknight1
Copy link
Member Author

Here's a basic example that fails, if you comment out the first line it'll run fine.

from petsc4py import PETSc
import underworld3 as uw

res  = uw.options.getInt("res")

print(res)

The error is:

Traceback (most recent call last):
  File "/Users/benknight/Documents/Research/Modelling/UW-models/UW3-dev/options_error.py", line 4, in <module>
    res  = uw.options.getInt("res")
  File "petsc4py/PETSc/Options.pyx", line 276, in petsc4py.PETSc.Options.getInt
  File "petsc4py/PETSc/petscopt.pxi", line 201, in petsc4py.PETSc.getopt
  File "petsc4py/PETSc/petscopt.pxi", line 96, in petsc4py.PETSc.getopt_Int
KeyError: '(prefix:uw_, name:res)'

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

No branches or pull requests

3 participants