Configure test for Fortran ISAMAX value is never used

I just discovered that the configuration variable ax_cv_blas_isamax_fcall_ok that is set in m4/octave_blas_f77_func.m4 is never used. I added this FIXME note to the code

# FIXME: This value is never used, so why do we calculate it?

If it were to be used, it seems it would be in this bit of code where the other calculated values are used.

# if any of the tests failed, reject the BLAS library
        if test $ax_cv_blas_lsame_fcall_ok = yes \
                -a $ax_cv_blas_sdot_fcall_ok = yes \
                -a $ax_cv_blas_ddot_fcall_ok = yes \
                -a $ax_cv_blas_cdotu_fcall_ok = yes \
                -a $ax_cv_blas_zdotu_fcall_ok = yes ; then
                ax_blas_f77_func_ok=yes;
                $1
        else
                ax_blas_f77_func_ok=no;
                $2
        fi

Does anyone have an opinion about just removing the test entirely? Or should we require ISAMAX before accepting the BLAS library?

Fortran compilers are not consistent in the way that they return values from FUNCTIONs. It looks like these tests were added in changeset 8136cb19fb7a with the idea that if the values are returned in the same way as for C functions, then we could avoid using SUBROUTINE wrappers for them. But sometime later, we just decided to simplify things by always using wrapper functions?

If they are not used, let’s remove the configure checks.

1 Like

This is beyond me since I don’t code Fortran. I’m happy to implement removing all of these checks if you think that is the correct thing to do, but I can’t tell whether that is the right path or not.

If they are removed, do we just fall back on using AX_BLAS Autoconf macro to determine whether we have a valid BLAS library?

1 Like

If none of the variables set by octave_blas_f77_func.m4 are used and it then reduces to only calling the AX_BLAS macro, then yes, I think we could just remove the octave_blas_f77_func.m4 file and replace

OCTAVE_BLAS_WITH_F77_FUNC([], [],
  [ax_blas_ok=yes
  AC_MSG_CHECKING([BLAS can be called from Fortran])
  AC_MSG_RESULT([yes assumed for cross compilation])])

in configure.ac with AX_BLAS but we also have to be careful to do the right thing when cross compiling. I think that means using

if test "$cross_compiling" = yes; then
  ax_blas_ok=yes
  AC_MSG_CHECKING([BLAS can be called from Fortran])
  AC_MSG_RESULT([yes assumed for cross compilation])])
else
  AX_BLAS
fi

but I haven’t tested it.

Currently the size testing for BLAS (8-byte or 4-byte) is done in octave_blas_f77_func.m4. I think that makes it easier to remove most of the file and slim down the macro, but still keep it. Probably it can be renamed octave_blas.m4 in analogy with ax_blas.m4.

Edit (7/8/22): I created the new macro in octave_blas.m4 and checked in this changeset: octave: 4dc326899f65

Now we wait and see how the Buildbots do with this change.

Keeping the macro in a separate file that includes the cross-compiling logic seems fine to me.