simpeg / pymatsolver

Solve matrix equations in python.
https://pymatsolver.readthedocs.io/en/latest/
MIT License
33 stars 16 forks source link

Improve warning when not enough memory (output is all zero) #25

Closed prisae closed 2 years ago

prisae commented 6 years ago

Issue carried over from discussion on Slack with @lheagy, @grosenkj (also pinging @rowanc1).

Using Pardiso (it might or might not affect other solvers as well, I don't know), my output was all zeros (array of correct size, all with 0+0j). No error message printed, everything run smooth as usual. (You only note it when matplotlib complains about plotting it on log-scale "Data has no positive values, and therefore cannot be log-scaled" :smile:)

Turns out that there was not enough memory. Making the model smaller resolved it. However, while running the notebook the memory usage never went up, so it didn't occur to me that it could be a memory-related issue. I assume Pardiso checks how much memory is available with the model size, and doesn't even start if there is not sufficient.

The obvious solution might be to check output of Pardiso and pass it along. However, that might not be that straight forward or the output might be cryptic. In that case one could make a check at the end if the result is all 0's, and print a warning (related with some hints, as mkl-installation or mesh-size/memory-requirements).

rowanc1 commented 6 years ago

I think that this would be down in pyMKL. I think perhaps checking the error code: https://github.com/dwfmarchant/pyMKL/blob/master/pyMKL/pardisoSolver.py#L225

And seeing if that says something about memory? If that is the case we have access to it in pymatsolver. Might be that an upstream change in pyMKL is better though.

prisae commented 2 years ago

Out of curiosity: was it resolved (when/where/how) or is it closed because it is a wontfix (or is it considered to not be a bug)?