PASSIONLab / CombBLAS

The Combinatorial BLAS (CombBLAS) is an extensible distributed-memory parallel graph library offering a small but powerful set of linear algebra primitives specifically targeting graph analytics.
Other
59 stars 20 forks source link

CombBLAS causes multiple definition of GlobalMT and ThreadBuffLenForBinning in SuperLU-Dist #20

Open drew-parsons opened 11 months ago

drew-parsons commented 11 months ago

CombBLAS provides BipartiteMatchings as an Application. But SuperLU-Dist uses CombBLAS's BipartiteMatchings ApproxWeightPerfectMatching.h and BPMaximalMatching.h when built with CombBLAS support (c2cpp_GetHWPM.cpp).

CombBLAS uses a handful of global definitions in these headers. This means that when linked in a library the way SuperLU-Dist uses, these definitions are exposed and triggered a multiple definition error, e.g. https://buildd.debian.org/status/fetch.php?pkg=superlu-dist&arch=s390x&ver=8.1.2%2Bdfsg1-1%2Bb2&stamp=1691085601&raw=0

CMakeFiles/superlu_dist.dir/z_c2cpp_GetHWPM.cpp.o:/usr/include/CombBLAS/BipartiteMatchings/BPMaximalMatching.h:17: multiple definition of `GlobalMT'; CMakeFiles/superlu_dist.dir/d_c2cpp_GetHWPM.cpp.o:/usr/include/CombBLAS/BipartiteMatchings/BPMaximalMatching.h:17: first defined here
/usr/bin/ld: CMakeFiles/superlu_dist.dir/z_c2cpp_GetHWPM.cpp.o: in function `combblas::ThreadBuffLenForBinning(int, int)':
/usr/include/CombBLAS/BipartiteMatchings/ApproxWeightPerfectMatching.h:401: multiple definition of `combblas::ThreadBuffLenForBinning(int, int)'; CMakeFiles/superlu_dist.dir/d_c2cpp_GetHWPM.cpp.o:/usr/include/CombBLAS/BipartiteMatchings/ApproxWeightPerfectMatching.h:401: first defined here
collect2: error: ld returned 1 exit status
make[3]: *** [SRC/CMakeFiles/superlu_dist.dir/build.make:2995: SRC/libsuperlu_dist.so.8.1.2] Error 1

The problem was previously raised for SuperLU-Dist at https://github.com/xiaoyeli/superlu_dist/issues/40 and https://github.com/xiaoyeli/superlu_dist/issues/60 . In Issue#60 a patch was suggested for CombBLAS 1.6 used by GNU at https://github.com/guix-mirror/guix/blob/master/gnu/packages/patches/combinatorial-blas-awpm.patch

Some elements of this patch have now been applied in CombBLAS 2.0.0. The "../" path to CombBLAS.h is fixed and t1Comp definitions removed. But other parts of the patch still need to be applied, as shown by the error message above. GlobalMT needs to be moved to a local definition and ThreadBuffLenForBinning needs to be inlined.

A debian version of the patch is https://salsa.debian.org/science-team/combblas/-/blob/master/debian/patches/AWPM_library_38dd27e.patch