On Wed, Feb 26, 2025 at 9:51 PM Dima Pasechnik <[email protected]> wrote: > > On Wed, Feb 26, 2025 at 1:26 PM Dima Pasechnik <[email protected]> wrote: > > > > On Wed, Feb 26, 2025 at 11:27 AM Marc Culler <[email protected]> wrote: > > > > > > What about just checking the return status of nm piped to grep, as we > > > were just doing? (Once you know which function you need to look for). > > > > the function name is correct, the mangled name is dgeqrf_, as reported > > by AC_FC_FUNC, > > with this value, AC_CHECK_FUNC passes. > > > > However, I found something that looks like an upstream (Homebrew?) > > error: "-fopenmp" is pushed into CFLAGS > > from the pkg-config, but this causes C compilations (with clang) fail, > > as Apple clang does not support openmp, > > as far as I can tell (and Sage's tests on gcc agree with me here). > > > > It's probably due to Homebrew using a compiler which can ignore such > > an unknown option. > > > > % pkg-config -cflags openblas > > -I/opt/homebrew/Cellar/openblas/0.3.29/include -fopenmp > > > > Note that without OpenMP openblas is much, much less performant than with > > it. > > According to the great R project: https://mac.r-project.org/openmp/, > > on XCode clang openmp is supported with > > -Xclang -fopenmp > > and one also needs an openmp dylib - which Apple doesn't ship (thanks > > Apple, as usual - of course they want us to use their propriatory > > stuff), > > but it is available from R project at the URL above, or from > > https://formulae.brew.sh/formula/libomp > > > > I have yet to try the latter. Probably the flags in openblas.pc still > > need to be corrected. > > I have filed https://github.com/Homebrew/homebrew-core/issues/209091 > to report incorrect CFLAGS in openblas.pc > > Here is a patch for build/pkgs/openblas/spkg-configure.m4 I came up with: > > --- a/build/pkgs/openblas/spkg-configure.m4 > +++ b/build/pkgs/openblas/spkg-configure.m4 > @@ -23,12 +23,11 @@ SAGE_SPKG_CONFIGURE([openblas], [dnl CHECK > ]) > dnl Check all name manglings that AC_FC_FUNC could check based on the > dnl characteristics of the Fortran compiler > - m4_foreach([dgeqrf_mangled], [dgeqrf, dgeqrf_, DGEQRF, DGEQRF_], [dnl > - AC_CHECK_FUNC(dgeqrf_mangled, [dnl > - AS_VAR_SET([HAVE_DGEQRF], [yes]) > - ]) > - ]) > - AS_IF([test x$HAVE_DGEQRF = xyes], [dnl openblas works as lapack > + > + AC_MSG_CHECKING([for the mangled name for dgeqrf]) > + AC_FC_FUNC([dgeqrf]) > + AC_MSG_RESULT($dgeqrf) > + AC_CHECK_FUNC($dgeqrf, [dnl openblas works as lapack > sage_install_lapack_pc=yes > ], [dnl openblas does not work as lapack; try to use system > lapack as is > PKG_CHECK_MODULES([LAPACK], [lapack], [], > [sage_spkg_install_openblas=yes]) > > But it won't work on Homebrew, without fixing openblas.pc > > I've tried adding the correct -Xclang prefix to -fopenmp in openblas.pc, > but it led to trouble building fflas_ffpack. > > Then I just removed -fopenmp from openblas.pc, and everything builds > (with openblas from Homebrew) > > I'll report test results...
It works great, with Homebrew openblas just 3 failed tests, not related to openblas. Actually, the patch of spkg-configure.m4 above is not needed, it was merely the broken openblas.pc that caused the issue. (although with the patch ./configure is less chatty, and probably a tiny bit faster) By the way, there is now a Homebrew fricas, which I tested along the way, it all works nicely. Please review a trivial PR adding the corresponding record: https://github.com/sagemath/sage/pull/39595 Dima -- You received this message because you are subscribed to the Google Groups "sage-release" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/sage-release/CAAWYfq3Bo-4%2BSU-24puR-45sap%3D6bo0arNJ9GDewVTs3aHi3iQ%40mail.gmail.com.
