Skip to content
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

Integer to real conversion in single precision scalapack gives wrong estimate of matrix size #99

Open
sangallidavide opened this issue Aug 23, 2024 · 5 comments

Comments

@sangallidavide
Copy link

AS the title says, when for example pcheevr is called in single precision, rwork(1) should contain the optimal size

*  RWORK    (local workspace/output) REAL  array,
*          dimension (LRWORK)
*          On return, RWORK(1) contains the optimal amount of
*          workspace required for efficient execution.

However the value is obtained from integer to real conversion
https://github.com/Reference-ScaLAPACK/scalapack/blob/master/SRC/pcheevr.f#L592
which gives rounding error for integers bigger than 10^6

If the rounded value is subsequently used in input for phceevr (after conversion back to integer), this may give an error.
See here the comment in a pull request of our code (and the following discussion):
yambo-code/yambo#117 (comment)

To fix this, it would be needed to change the above mentioned line (and other lines across the library) to a rounding procedure which always selects the closest bigger real number, e.g. rounding always done in excess.

@sangallidavide
Copy link
Author

Any feedback on this? Is anyone still working on scalapack?

@zerothi
Copy link
Contributor

zerothi commented Sep 10, 2024

Should ScaLAPACK force a newer LAPACK version, see e.g. Reference-LAPACK/lapack#605

@zerothi
Copy link
Contributor

zerothi commented Sep 10, 2024

Perhaps, until these things are settled, the methods should be duplicated in both codes (so scalapack can be linked with other lapack implementations).

@sangallidavide
Copy link
Author

@zerothi in my case I'm compiling ScaLapack 2.2.1 by linking Lapack 3.12.0

I understand the fix is inside Lapack 3.12.0, but the issue appears anyway in phcheev.
My understanding is that the call to https://github.com/Reference-LAPACK/lapack/blob/master/INSTALL/sroundup_lwork.f should be used in the scalapack source code as well.

@nchampag
Copy link

Please see issue #105 for some of our findings when computing LWORK with large matrices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants