icl-utk-edu / lapackpp

LAPACK++ is a C++ wrapper around CPU and GPU LAPACK and LAPACK-like linear algebra libraries, developed as part of the SLATE project.
https://icl.utk.edu/slate/
BSD 3-Clause "New" or "Revised" License
51 stars 14 forks source link

LAPACK++ may fail to link with LAPACK 3.9.1 - 3.11.0 #44

Closed weslleyspereira closed 1 year ago

weslleyspereira commented 1 year ago

Since https://github.com/Reference-LAPACK/lapack/commit/628a2095c24021ab07904e036389ebc4feb3e67a#diff-1710d7e7dbbb424e47de31c4995c3decf85025b77051f0ed0cb835988aeebe92, LAPACK defines LAPACK_FORTRAN_STRLEN_END in the header file lapack.h. As a consequence of that, LAPACK_dpstrf() requires an additional parameter that indicates the size of the string uplo. This routine is used in config/lapack_pstrf.cc that is called in LAPACKFinder.cmake:

https://github.com/icl-utk-edu/lapackpp/blob/62680a16a9aba2a426e3d089dd13e18bfd140c74/cmake/LAPACKFinder.cmake#L121-L139

When trying to build with LAPACK 3.11.0, I got the error:

At line 141 of file /home/weslleyp/storage/lapack/SRC/dpstrf.f
Fortran runtime error: Actual string length is shorter than the declared one for dummy argument 'uplo' (-4096/1)

I am using a Ubuntu machine with:

Please, let me know if I can give you more details.

weslleyspereira commented 1 year ago

A related comment: Since now BLAS++ depends on LAPACK, maybe LAPACK++ does not need to search for the LAPACK package anymore.

mgates3 commented 1 year ago

Yes, we can fix this.

Pretty sure it's an issue with the Fortran compiler, not with LAPACK itself. Fortran has always required the string length, just very commonly when calling LAPACK from C we were ignoring it. Now the compiler is being more picky about it.

BLAS++ uses LAPACK only in the testers, and it requires a small subset of LAPACK, e.g., potrf but not pstrf. Though I feel like it would be better to move [cz]symv and [cz]syr to BLAS++, which would then make LAPACK a hard dependency.