lapack icon indicating copy to clipboard operation
lapack copied to clipboard

make.inc FFLAGS_NOOPT vs the CMAKE build

Open martin-frbg opened this issue 3 years ago • 3 comments

Prompted by https://github.com/xianyi/OpenBLAS/pull/3478 I had a look at the significance of the LAPACK_NOOPT macro in the build system. (Setting compiler options to "-O0" or equivalent, presumably to work around cases of miscompilation/overoptimization in the past). As far as I can tell, its only "users" are the LAPACK helper functions SLARUF/DLARUF and ?LA_WWADW , as well as slaran/dlaran in MATGEN/TMGLIB. However, this option is only present in Makefile builds, at least I did not see any equivalent in the CMakeLists.txt etc. I wonder if this is historic baggage in the gmake build files, or an actual deficiency in the CMAKE setup ? (All affected files appear to be from pre-3.2 releases)

martin-frbg avatar Dec 15 '21 18:12 martin-frbg

( this is a comment and this does not answer @martin-frbg question )

As far as I remember, the NOOPT was needed for compiling LAMCH. https://github.com/Reference-LAPACK/lapack/blob/master/INSTALL/dlamchf77.f

But this code is not used as far as I know. We left it in the git repository for some kind of nostalgia, memory of the past, etc. reason.

Now that we changed LAMCH to a F90 counterpart with intrinsics, I am not sure why, where NOOPT is needed in LAPACK.

@martin-frbg: Thanks for going in the source code and looking at what routines are using NOOPT for their compilation.

langou avatar Dec 15 '21 19:12 langou

not sure I get the connection to LAMCH, but see end of SRC/Makefile (that part of the file is basically unchanged since the start of the git history in 2008) - the ?LA_WWADW stuff is ultimately needed by ?GBRFSX and ?GBSVXX So most likely just a harmless forgotten fix for 2.95 or the like, but a small risk of this being a potential source of differences in accuracy between gmake and cmake builds

martin-frbg avatar Dec 15 '21 20:12 martin-frbg

Hi. I am not sure if we want to keep the NOOPT or not, but I agree that there is no similar behavior in the CMake build system. For example, I see in SRC/CMakeLists.txt that we build slaruv.f and sla_wwaddw.f together with all other routines in the library, so no special flag is added.

Let me list all routines using the NOOPT flags currently:

  • xLARUV: returns a vector of n random real numbers from a uniform distribution.
  • xLA_WWADDW: adds a vector into a doubled-single vector.
  • xLAMCH: determines double precision machine parameters.
  • xROUNDUP_LWORK: deals with a subtle bug with returning LWORK as a Float.
  • xLARAN returns a random real number from a uniform (0,1) distribution.

weslleyspereira avatar Dec 20 '21 18:12 weslleyspereira