-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Use f2c translations of LAPACK when no Fortran compiler is available #3539
Conversation
This would already be very useful for the CLANG* build environments in MSYS2 in its current state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some comments on the existing changes. I hope this is helpful.
CMakeLists.txt
Outdated
if (NOT NOFORTRAN AND NOT NO_LAPACK) | ||
include("${PROJECT_SOURCE_DIR}/cmake/lapack.cmake") | ||
if (NOT NO_LAPACK) | ||
include("${PROJECT_SOURCE_DIR}/cmake/lapack.cmake") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Should the whitespace change in line 181 be reverted?
Makefile
Outdated
@@ -246,10 +249,10 @@ netlib : | |||
|
|||
else | |||
netlib : lapack_prebuild | |||
ifeq ($(NOFORTRAN), $(filter 0,$(NOFORTRAN))) | |||
#ifeq ($(NOFORTRAN), $(filter 0,$(NOFORTRAN))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this condition be better here?
-ifeq ($(NOFORTRAN), $(filter 0,$(NOFORTRAN)))
+ifneq ($(NO_LAPACK), 1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop the outer ifneq down there you mean ? Agree this should simplify things a bit.
cmake/f_check.cmake
Outdated
@@ -26,10 +26,15 @@ if(CMAKE_Fortran_COMPILER) | |||
enable_language(Fortran) | |||
else() | |||
if (NOT NO_LAPACK) | |||
message(STATUS "No Fortran compiler found, can build only BLAS but not LAPACK") | |||
message(STATUS "No Fortran compiler found, can build only BLAS and f2c-converted LAPACK") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Whitespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now fixed with the temporary exclusion of MSVC
cmake/system.cmake
Outdated
if (INTERFACE64) | ||
set (CCOMMON_OPT "${CCOMMON_OPT} -DLAPACK_ILP64") | ||
endif () | ||
set(TIMER "NONE") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Intent block by two spaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also fixed with the MSVC changes
Thanks for the recent changes regarding MSVC and C_LAPACK (or rather their mutual exclusivity for the time being). I noticed the last couple of changes were related to an issue with clang-cl (MSVC) & flang on Windows. IIUC, that is probably because some tests are run now (after #3595 has landed) that have been skipped previously. |
not a blocker, i just noticed them in the context and wanted to make sure they are unrelated. different pr for that now, will clean up here later when i have time |
…penMathLib#3539) * Add C equivalents of the Fortran routines from Reference-LAPACK as fallbacks, and C_LAPACK variable to trigger their use
@martin-frbg in case you still your modified f2clapack script easy accessible, I would be interested to take a look at it. I am guessing the PRIMME script you started from is https://github.com/primme/primme/blame/master/R/f2clapack.sh? In a Pyodide context I have been trying to use OpenBLAS (see pyodide/pyodide#3331 for more details). Being able to look at the f2c conversion script (or even run it if possible) you used for OpenBLAS, may help in some cases to reduce the discrepancy we are seeing between some f2c'ed scipy files and OpenBLAS. |
yes that is what I started from, need to clean up a few hacks that I hand-corrected in the converted files afterwards... mostly fixing some of the fortran function macros from the header part of the primme script that had bad variable types and adding implementations for some complex functions |
OK so you changed mostly the header part of the primme script and then modified the result by hand? I was wondering whether you changed the lex part too, in order to fix some signatures (full disclosure I don't understand what the lex part of the script does). |
This should be it - sorry for the delay. Obviously some of the changes are OpenBLAS-specific (like the "blasint" typedef) and some of the (complex function) declarations will lead to "unused function" warnings during compilation, so there is certainly still room for improvement |
Thanks a lot for the update! |
translations done with a modified version of the f2clapack script from PRIMME (which in turn based on the one from f2clapack)
and additional hand-editing to work around use of F90 idiom in current LAPACK.
LAPACK-TEST currently shows failures in ?gelsdonly observed with gcc7.5.0need to update most files to support INTERFACE64 - right now only the absolute minimum needed to run DGESVD (as used to prepare the DGEMM "kernel_regress" test in openblas_utest) is updated as a proof of conceptfixes clang64 flang compile failure #3509 and fixes When I compile OpenBLAS with NOFORTRAN=1 some LAPACK (e.g. dpotrf) routines are not available #1284