-
-
Notifications
You must be signed in to change notification settings - Fork 230
SuperLU_dist solver interface #4054
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
base: main
Are you sure you want to change the base?
Conversation
…enics/dolfinx into jhale/superlu-interface-deleters
python/test/unit/la/test_superlu.py
Outdated
| L = form(L, dtype=dtype) | ||
|
|
||
| u_bc = Function(V, dtype=dtype) | ||
| u_bc.interpolate(lambda x: x[1]**3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to define
def u_ex(x):
return x[1]**3
f = -div(grad(x))
u_bc.interpolate(u_ex)
so that if we ever change u_ex it is reflected everywhere at once.
…dolfinx into jhale/superlu-interface-deleters
| declare_superlu_solver<double>(m, "float64"); | ||
| declare_superlu_solver<float>(m, "float32"); | ||
| declare_superlu_solver<std::complex<double>>(m, "complex128"); | ||
| #endif // HAS_SUPERLU_DIST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should just put the #ifdef inside declare_superlu_solver() - it gets called, but does nothing - just looks neater with fewer #ifdefs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind the slight overuse of template ifs as long as they aren't nested.
|
|
||
| uh = Function(V, dtype=dtype) | ||
| solver = superlu_solver(A) | ||
| solver.solve(b._cpp_object, uh.x._cpp_object) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this supposed to work without ._cpp_object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, still TODO.
Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com>
| stype = _cpp.la.SuperLUSolver_complex128 | ||
| else: | ||
| raise NotImplementedError(f"Type {dtype} not supported.") | ||
| return stype(A._cpp_object) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be wrapped in SuperLUSolver above?
…enics/dolfinx into jhale/superlu-interface-deleters
| x = SpatialCoordinate(mesh) | ||
| u_exact = x[1] ** 3 | ||
| f = -div(grad(u_exact)) | ||
|
|
||
| L = inner(f, v) * dx | ||
| L = form(L, dtype=dtype) | ||
|
|
||
| u_bc = Function(V, dtype=dtype) | ||
| u_bc.interpolate(lambda x: x[1] ** 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| x = SpatialCoordinate(mesh) | |
| u_exact = x[1] ** 3 | |
| f = -div(grad(u_exact)) | |
| L = inner(f, v) * dx | |
| L = form(L, dtype=dtype) | |
| u_bc = Function(V, dtype=dtype) | |
| u_bc.interpolate(lambda x: x[1] ** 3) | |
| def u_ex(x): | |
| return x[1] ** 3 | |
| x = SpatialCoordinate(mesh) | |
| f = -div(grad(u_ex(x))) | |
| L = inner(f, v) * dx | |
| L = form(L, dtype=dtype) | |
| u_bc = Function(V, dtype=dtype) | |
| u_bc.interpolate(u_ex) |
Joint work with @chrisrichardson
This adds an optional SuperLU_dist interface to DOLFINx for solving systems constructed using MatrixCSR. The purpose of this is to provide a reasonable MPI-capable LU solver for DOLFINx builds without PETSc on all platforms.
The implementation is pretty light, and does not include SuperLU headers into our headers.
TODO:
In future PRs:
dolfinx.fem.LinearProblemclass for beginners.dolfinx.fem.NonlinearProblemclass for beginners.