LLNL / libROM

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

Lwork overflow bug fix #116

Closed kevinhkhuynh closed 2 years ago

kevinhkhuynh commented 2 years ago

bestwork is such a large number that lwork is overflowing, leading to a negative value, which messes up the allocate for the work array, leading to a seg fault.

Without changing to another SVD algorithm, the best we can do is allow lwork to be at max MAX_INT.

kevinhkhuynh commented 2 years ago

Creating a custom long int parameter and setting lwork to that failed, since pdgesvd and the other lapack algorithms require lwork to be an INTEGER(4), and setting it to something like INTEGER(8) leads to a compilation error of incorrect Fortran type.

kevinhkhuynh commented 2 years ago

This bug fix of simply setting lwork to MAX_INT might lead to incorrect results when the lwork is so large that setting it to MAX_INT is below the required minimum lwork size (dependent on the particular scalapack function), leading to bad results. We could instead output a Fortran error across the board if bestwork is larger than MAX_INT, telling users the matrix is too large to work with, instead of seg faulting. But this wouldn't help Debo work around his seg fault issue.