LLNL / libROM

Model reduction library with an emphasis on large scale parallelism and linear subspace methods
https://www.librom.net
Other
198 stars 36 forks source link

Minor fix in mfem utility function + Hypre version change #237

Closed dreamer2368 closed 10 months ago

dreamer2368 commented 10 months ago

This PR is in support of pylibROM mfem binding PR.

When using mfem functions from python side, a strange seg-fault error happens when HypreParMatrix::GetNumRows() is used. This does not happen if the same function is used from c++ side.

Fortunately, there is HypreParMatrix::NumRows() which does the same job and does not cause a seg-fault issue on python end. This PR simply replaces GetNumRows() with NumRows().

Update

The seg-fault error in using Hypre functions on python end, turns out to be because of the version incompatibility between libROM and pymfem.

PyMFEM uses hypre v2.28.0, while libROM has been using v2.20.0. And when pylibrom accesses to some hypre functions compiled from pymfem (or the other way around), it causes the segmentation fault error.

This error is resolved when the hypre in libROM is updated to v2.28.0. So now the setup.sh and Dockerfile reflect this version change.

Another update

Further segmentation fault error is observed, and this was due to the version mismatch of c++ mfem between pylibROM and PyMFEM. To support their interface, we match the mfem version to that from PyMFEM.

dylan-copeland commented 10 months ago

The difference between these functions is that GetNumRows calls a hypre function, whereas NumRows simply returns height in the base class Operator. I guess the hypre call has some complication in the python version, and maybe that needs to be resolved in pymfem. It is not clear from the header files whether GetNumRows and NumRows should always return the same number, but it looks like the HypreParMatrix constructors set height to GetNumRows, so I think there should not be any difference. At least the regression tests passed.