underworldcode / underworld3

https://underworldcode.github.io/underworld3/
Other
21 stars 10 forks source link

Issue with uw_options if petsc4py/petsc imported before #210

Open bknight1 opened 5 months ago

bknight1 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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)'