-
Notifications
You must be signed in to change notification settings - Fork 9
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
Replace Numerial Recipes LU decomp routines with LAPACK ones #227
Replace Numerial Recipes LU decomp routines with LAPACK ones #227
Conversation
de80959
to
e872b3e
Compare
e872b3e
to
b189b6c
Compare
0421d38
to
66ffdf8
Compare
@GeorgeGayno-NOAA this is my solution for what we discussed about those two lapack_gen routines, let me know if you have any comments/concerns as far as the added dependency. |
Are we sure this will not change results somewhere? |
I tested with random numbers and the results are near identical, and both pairs of calls are covered in the unit testing. That said, I'm going to try to find some more "real life" examples to validate with. |
If this changes the UFS baseline test data, for example, that's something we need to clear with Jun... |
These routines are not used directly by the forecast executable. As far as I know, these routines are used in:
So I think that's where I want to look in terms of making sure I don't break anything... Edit: Not sure about UFS WM, so I'm going to test it to be safe. |
Probably @GeorgeGayno-NOAA knows this is happening, right? |
Update: It appears these changes do affect UFS WM RT outputs, so definitely not merging this until everything is reconciled... |
Update/note to self: The issue with UFS WM is not these routines themselves (which don't appear to be used, at least in the RTs I've run), but having the LAPACK/OpenBLAS imported from ip creates numerical differences. There's probably a way to make this work, or, worst case scenario, copy and paste these two routines from Netlib LAPACK. |
0a26d7f
to
a39a1ab
Compare
6ea3e13
to
d97f7b9
Compare
357f409
to
15b80ac
Compare
@WenMeng-NOAA @HuiyaChuang-NOAA, can you please test these updates with UPP (long story short, |
This PR removes code copied/pasted from Numerical Recipes (Fortran) and replaces it with standard LAPACK routines. Specifically,
ludcmp
andlubksb
, which are routines for LU decomposition and subsequent linear equation solution, respectively, are replaced with{s,d}getrf
and{s,d}getrs
, respectively (s=single precision, d=double). For the CI, the Ubuntu workflows get these routines from OpenBLAS, the Intel one uses MKL routines, and the MacOS one uses the Apple-provided accelerate library. The BLAS/LAPACK provider can be specified to the CMake command with-DBLA_VENDOR=...
where the available values can be found at https://cmake.org/cmake/help/latest/module/FindBLAS.html. In spack-stack, the BLAS/LAPACK provider will be OpenBLAS, and this setting will get propagated to downstream packages through ip-config.cmake (this resolves the issue I ran into with ufs-weather-model).Tested on personal machine, Hera, and CI, including through updated Spack recipe.
Fixes #220
Test dependents: