simplify access to PETSc/backend parameters
(with reference to https://answers.launchpad.net/dolfin/+question/225891)
The mechanism of handing parameters to the linear backends currently uses a FEniCS-style dictionary that is parsed and translated into a PETSc/Epetra set of parameters. This parsing methods have grown more and more complex over the years to satisfy the ever evolving backends. There are still many parameters that are not accessible from Dolfin since the parameter interface wasn't updated accordingly (e.g., https://bugs.launchpad.net/dolfin/+bug/1159384).
A more maintainable approach to the problem would be useful. The obvious suggestion is to allow for any input parameters in Dolfin, and have the backend figure out whether or not they make sense. This would completely remove the burden of keeping the lists of possible parameters (and with it the documentation) in sync. The code base of Dolfin would get smaller. One downside of this is that most options would not be portable between the backends, e.g., using a Jacobian solver on the coarsest level of AMG would require a different setting in PETSc than in Epetra. One could argue though that switching the backend and thus using an entirely different implementation naturally requires some user interaction anyways.
Comments (8)
-
-
- changed status to resolved
Interface now exists to set PETSc option, see https://bitbucket.org/fenics-project/dolfin/commits/36860144ca08b0379d24eb5d83049f3265f19193
-
reporter Hm, not working for me in Python. The symbols are there,
$ nm --dynamic ~/Work/FEniCS/lib/libdolfin.so | grep PETScOptions 0000000000b948c0 T _ZN6dolfin12PETScOptions3setESs 0000000000b94bf0 T _ZN6dolfin12PETScOptions3setESsb 0000000000b95210 T _ZN6dolfin12PETScOptions3setESsd 0000000000b956c0 T _ZN6dolfin12PETScOptions3setESsi 0000000000b94ef0 T _ZN6dolfin12PETScOptions3setESsSs 0000000000b94710 T _ZN6dolfin12PETScOptions5clearESs
so maybe something is missing in the SWIG interface.
-
@nico : could you please be more specific of what is not working, maybe provide a minimal example that does not work?
Also it might help triggering regeneration of SWIG interface by running:
make generate_swig_files
from your build directory.
-
See
demo/undocumented/mixed-poisson-sphere/python/demo_mixed-poisson-sphere.py
for a usage example.
-
reporter This very example fails for me with
Traceback (most recent call last): File "demo_mixed-poisson-sphere.py", line 56, in <module> PETScOptions.set("mat_mumps_icntl_14", 40.0) NameError: name 'PETScOptions' is not defined
If it works for everyone else, I suppose we could consider this a configuration error that will likely be gone with a fresh install(tm).
-
Works fine here. Have you tried regenerating the swig interface?
You can also clean your source directory from old generated files by:
git clean -fdx
triggering the automatic generation of the SWIG interface.
-
reporter Still not working. Meh, let's just let it sit there for a while; sooner or later I'll wipe everything and with it the problematic cache.
- Log in to comment
"Core" parameters should be backend-independent (make easy things easy), but I agree a mechanism for injecting more esoteric backend-specific parameters would be a good thing (make hard things possible).