SuiteSparse icon indicating copy to clipboard operation
SuiteSparse copied to clipboard

GraphBLAS needs to be linked to libatomic on some platforms

Open svillemot opened this issue 4 years ago • 4 comments

In SuiteSparse 5.7, a call to __atomic_compare_exchange was introduced in GraphBLAS/Source/Template/GB_AxB_saxpy3_template.h.

Under some circumstances, the compiler turns those __atomic statements into a call to a function provided by the libatomic library. However, the GraphBLAS build system does not link executables to libatomic in that case, resulting in a build failure (occurring in reduce_demo).

In Debian, the problem manifests at least with the ARM 32-bit (little endian) and MIPS 32-bit (little endian) architectures, see the respective build logs: https://buildd.debian.org/status/fetch.php?pkg=suitesparse&arch=armel&ver=1%3A5.7.1%2Bdfsg-1&stamp=1582754466&raw=0 https://buildd.debian.org/status/fetch.php?pkg=suitesparse&arch=mipsel&ver=1%3A5.7.1%2Bdfsg-1&stamp=1582758238&raw=0

svillemot avatar Feb 28 '20 16:02 svillemot

Thanks for the heads up. Not sure how to fix it though. Looking around for possible issues elsewhere, I see that LLVM has a solution ... but a fairly complex one: https://sources.debian.org/patches/qtox/1.16.3-2/0001-chore-cmake-check-for-libatomic-support.patch/ for example, and https://github.com/llvm-mirror/llvm/blob/master/cmake/modules/CheckAtomic.cmake . I'll see what I can do.

DrTimothyAldenDavis avatar Feb 28 '20 17:02 DrTimothyAldenDavis

For the Debian package, I simply unconditionally added -latomic to GraphBLAS.

See the patch: https://salsa.debian.org/science-team/suitesparse/-/blob/master/debian/patches/libatomic.patch

svillemot avatar Feb 29 '20 13:02 svillemot

OK. But that might break systems that don't have libatomic, right?

On Sat, Feb 29, 2020 at 7:20 AM Sébastien Villemot [email protected] wrote:

For the Debian package, I simply unconditionally added -latomic to GraphBLAS.

See the patch: https://salsa.debian.org/science-team/suitesparse/-/blob/master/debian/patches/libatomic.patch

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/DrTimothyAldenDavis/SuiteSparse/issues/21?email_source=notifications&email_token=AEYIIOIZOIRLOIU5FBMYJO3RFEFTDA5CNFSM4K5TTRLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENLZ6QY#issuecomment-592944963, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYIIOL2ILF2C67G6R2YSNDRFEFTDANCNFSM4K5TTRLA .

DrTimothyAldenDavis avatar Mar 04 '20 00:03 DrTimothyAldenDavis

Yes, for sure. So this patch is not a fix ready to be incorporated, I just mentioned it for your information. It is enough on Debian though because all architectures have libatomic there.

svillemot avatar Mar 04 '20 07:03 svillemot

I've just finished a beta version of SuiteSparse v6.0.0 (soon to be tagged as a pre-release), which has an entirely new CMake build system. Is this something that the CheckAtomic.cmake can work with?

DrTimothyAldenDavis avatar Nov 03 '22 12:11 DrTimothyAldenDavis

See my latest attempt on the dev2 branch: https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev2 . This draft version of CMake (with a draft GraphBLAS v7.3.3) checks to see if -latomic is required or not. See also the discussion here: https://github.com/DrTimothyAldenDavis/GraphBLAS/issues/178

DrTimothyAldenDavis avatar Nov 26 '22 23:11 DrTimothyAldenDavis

Can you try GraphBLAS v7.3.3.beta3 to see if it correctly detects when -latomic is needed? I think this should resolve the problem. https://github.com/DrTimothyAldenDavis/GraphBLAS/releases/tag/v7.3.3.beta3

DrTimothyAldenDavis avatar Dec 08 '22 15:12 DrTimothyAldenDavis

Fixed in v7.3.3.

DrTimothyAldenDavis avatar Dec 11 '22 03:12 DrTimothyAldenDavis