Bug 279820 - math/suitesparse-cholmod do not build with math/atlas
Summary: math/suitesparse-cholmod do not build with math/atlas
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Thierry Thomas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-17 17:58 UTC by gja822
Modified: 2024-06-23 17:54 UTC (History)
3 users (show)

See Also:


Attachments
Try to avoid a mix of different BLAS/LAPACK libraries (1013 bytes, patch)
2024-06-19 11:35 UTC, Thierry Thomas
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description gja822 2024-06-17 17:58:04 UTC
Trying to build math/suitesparse-cholmod with ATLAS=ON (with math/atlas) ended with errors like these:

/usr/local/include/suitesparse/SuiteSparse_config.h:583:65: error: expected ')' before ',' token
  583 |     #define SUITESPARSE_BLAS(name,NAME) SUITESPARSE_FORTRAN(name,NAME)
      |                                                                 ^
/usr/local/include/suitesparse/SuiteSparse_config.h:619:37: note: in expansion of macro 'SUITESPARSE_BLAS'
  619 | #define SUITESPARSE_LAPACK_ZLARFG   SUITESPARSE_BLAS ( zlarfg , ZLARFG )
      |                                     ^~~~~~~~~~~~~~~~
/usr/local/include/suitesparse/SuiteSparse_config.h:2076:6: note: in expansion of macro 'SUITESPARSE_LAPACK_ZLARFG'
 2076 | void SUITESPARSE_LAPACK_ZLARFG
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/suitesparse/SuiteSparse_config.h:583:65: error: expected ')' before ',' token
  583 |     #define SUITESPARSE_BLAS(name,NAME) SUITESPARSE_FORTRAN(name,NAME)
      |                                                                 ^
/usr/local/include/suitesparse/SuiteSparse_config.h:651:37: note: in expansion of macro 'SUITESPARSE_BLAS'
  651 | #define SUITESPARSE_LAPACK_CLARFG   SUITESPARSE_BLAS ( clarfg , CLARFG )
      |                                     ^~~~~~~~~~~~~~~~
/usr/local/include/suitesparse/SuiteSparse_config.h:2100:6: note: in expansion of macro 'SUITESPARSE_LAPACK_CLARFG'
 2100 | void SUITESPARSE_LAPACK_CLARFG
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/suitesparse/SuiteSparse_config.h:583:65: error: expected ')' before ',' token
  583 |     #define SUITESPARSE_BLAS(name,NAME) SUITESPARSE_FORTRAN(name,NAME)
      |                                                                 ^
/usr/local/include/suitesparse/SuiteSparse_config.h:602:37: note: in expansion of macro 'SUITESPARSE_BLAS'
  602 | #define SUITESPARSE_LAPACK_DLARF    SUITESPARSE_BLAS ( dlarf  , DLARF  )
      |                                     ^~~~~~~~~~~~~~~~
/usr/local/include/suitesparse/SuiteSparse_config.h:2128:6: note: in expansion of macro 'SUITESPARSE_LAPACK_DLARF'
 2128 | void SUITESPARSE_LAPACK_DLARF
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/suitesparse/SuiteSparse_config.h:583:65: error: expected ')' before ',' token
  583 |     #define SUITESPARSE_BLAS(name,NAME) SUITESPARSE_FORTRAN(name,NAME)
      |                                                                 ^
/usr/local/include/suitesparse/SuiteSparse_config.h:634:37: note: in expansion of macro 'SUITESPARSE_BLAS'
  634 | #define SUITESPARSE_LAPACK_SLARF    SUITESPARSE_BLAS ( slarf  , SLARF  )
      |                                     ^~~~~~~~~~~~~~~~
/usr/local/include/suitesparse/SuiteSparse_config.h:2158:6: note: in expansion of macro 'SUITESPARSE_LAPACK_SLARF'
 2158 | void SUITESPARSE_LAPACK_SLARF
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/suitesparse/SuiteSparse_config.h:583:65: error: expected ')' before ',' token
  583 |     #define SUITESPARSE_BLAS(name,NAME) SUITESPARSE_FORTRAN(name,NAME)
      |                                                                 ^
/usr/local/include/suitesparse/SuiteSparse_config.h:618:37: note: in expansion of macro 'SUITESPARSE_BLAS'
  618 | #define SUITESPARSE_LAPACK_ZLARF    SUITESPARSE_BLAS ( zlarf  , ZLARF  )
      |                                     ^~~~~~~~~~~~~~~~
/usr/local/include/suitesparse/SuiteSparse_config.h:2188:6: note: in expansion of macro 'SUITESPARSE_LAPACK_ZLARF'
 2188 | void SUITESPARSE_LAPACK_ZLARF
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/suitesparse/SuiteSparse_config.h:583:65: error: expected ')' before ',' token
  583 |     #define SUITESPARSE_BLAS(name,NAME) SUITESPARSE_FORTRAN(name,NAME)
      |                                                                 ^
/usr/local/include/suitesparse/SuiteSparse_config.h:650:37: note: in expansion of macro 'SUITESPARSE_BLAS'
  650 | #define SUITESPARSE_LAPACK_CLARF    SUITESPARSE_BLAS ( clarf  , CLARF  )
      |                                     ^~~~~~~~~~~~~~~~
/usr/local/include/suitesparse/SuiteSparse_config.h:2218:6: note: in expansion of macro 'SUITESPARSE_LAPACK_CLARF'
 2218 | void SUITESPARSE_LAPACK_CLARF
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/math/suitesparse-cholmod
*** Error code 1

Stop.
make: stopped in /usr/ports/math/suitesparse-cholmod
Comment 1 Thierry Thomas freebsd_committer freebsd_triage 2024-06-19 11:35:07 UTC
Created attachment 251567 [details]
Try to avoid a mix of different BLAS/LAPACK libraries

When math/blas and math/atlas are installed on the same machine, it seems that they can be mixed, causing a CHOLMOD failure.

The attached patch fixes the problem, at least on my work-station. Could you please check if it works for you?
Comment 2 gja822 2024-06-19 20:42:39 UTC
(In reply to Thierry Thomas from comment #1)
with your patch it compiles now. I do not see a way to leave only math/atlas, other ports pull in blas, lapack etc. Without an option to choose.

(By the way, after splitting suitesparse, one should deinstall all in a bunch and then reinstall the components, as I can see it, after any version change, and simple portupgrade approach when ports are upgraded one by one could not always give expected results. Am I right?)
Comment 3 Thierry Thomas freebsd_committer freebsd_triage 2024-06-21 20:15:26 UTC
Thanks for your feedback!

What is your CPU? Actually ATLAS is almost abandoned, because it does not support recent CPU. Do you really measure better performance with ATLAS?

If yes, you could send PRs for the ports where you need an ATLAS option: it is usually simple to add, and it is not a good thing to link a program with different implementations.
Comment 4 Thierry Thomas freebsd_committer freebsd_triage 2024-06-21 20:19:17 UTC
Patch committed.
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-06-21 20:19:35 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=62af3b140f21f4f1eaf7adb3b469d1d276927602

commit 62af3b140f21f4f1eaf7adb3b469d1d276927602
Author:     Thierry Thomas <thierry@FreeBSD.org>
AuthorDate: 2024-06-19 11:26:46 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2024-06-21 20:18:10 +0000

    math/suitesparse: avoid mixing various BLAS/LAPACK libraries

    When math/blas and math/atlas are installed on the same machine, it
    seems that they can be mixed, causing a CHOLMOD failure.

    PR:             279820
    Reported by:    gja822@narod.ru

 math/suitesparse/bsd.suitesparse.mk | 2 ++
 1 file changed, 2 insertions(+)
Comment 6 gja822 2024-06-22 02:46:15 UTC
(In reply to Thierry Thomas from comment #3)
Thank you, I'll consider migrating to some other LA library. Not sure I know their differences, I stuck with ATLAS from a long time ago, when it was the main choice.
By the way I do not see any other LA libraries to perform such an exhaustive tuning in order to find of optimal parameters during build like ATLAS do.
Comment 7 gja822 2024-06-22 02:53:36 UTC
(In reply to gja822 from comment #6)
(I have AMD FX-8300, that is bdver2 in terms of GCC.)
Comment 8 Thierry Thomas freebsd_committer freebsd_triage 2024-06-22 07:24:50 UTC
(In reply to gja822 from comment #6)
OpenBLAS does this sort of tuning although less advanced than ATLAS.
Comment 9 Dima Pasechnik 2024-06-22 08:53:24 UTC
More and more frequent hardware patches (mitigations of hardware bugs such as Spectre, Meltdown, and similar) are rendering CPU tuning much harder to maintain, as such patches might require not only re-tuning of the patched host, but changes in the tuning code. 

Atlas is not only project affected, another one I know is MPIR (a fork of GMP with these sorts of tuning).
Comment 10 gja822 2024-06-23 17:54:34 UTC
(In reply to Thierry Thomas from comment #3)
It was math/ipopt that pulled "plain" math/blas and math/lapack (and coin-or-metis and coin-or-mumps) for me. I'm almost sure that Ipopt also was some automatic dependency. So, LinAl libraries give some kind of mess. Now I've deleted Ipopt, blas, lapack and substituted openblas for atlas. Shall see.
Thank you for you advice.