From 8c7fc0cb22fb7feec54feb2dcd05092deb6b1ee7 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Wed, 3 Apr 2024 12:58:27 -0400 Subject: [PATCH] SPMM: add Boost::graph as dependency Signed-off-by: Joseph Schuchart --- cmake/modules/FindOrFetchBoost.cmake | 1 + examples/CMakeLists.txt | 8 +++++--- examples/spmm/spmm.cc | 6 +++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cmake/modules/FindOrFetchBoost.cmake b/cmake/modules/FindOrFetchBoost.cmake index 1e133eee0..34550ecac 100644 --- a/cmake/modules/FindOrFetchBoost.cmake +++ b/cmake/modules/FindOrFetchBoost.cmake @@ -23,6 +23,7 @@ if (TTG_PARSEC_USE_BOOST_SERIALIZATION) list(APPEND optional_components serialization iostreams + graph ) endif() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 10b808540..bbcc0e9e0 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -7,10 +7,12 @@ add_ttg_executable(t9-streaming t9/t9_streaming.cc) # sparse matmul need Eigen ... it's always provided by TA if (TARGET tiledarray) # MADworld used for MADNESS serialization - add_ttg_executable(spmm spmm/spmm.cc LINK_LIBRARIES TiledArray_Eigen) + add_ttg_executable(spmm spmm/spmm.cc LINK_LIBRARIES TiledArray_Eigen $ + COMPILE_DEFINITIONS $<$:HAVE_BOOST_GRAPH=1>) # block-sparse needs BTAS ... it's always provided by TA # since only need to use matrices, limit BTAS_TARGET_MAX_INDEX_RANK to 2 - add_ttg_executable(bspmm spmm/spmm.cc LINK_LIBRARIES tiledarray TiledArray_Eigen BTAS COMPILE_DEFINITIONS BLOCK_SPARSE_GEMM=1;BTAS_TARGET_MAX_INDEX_RANK=2) + add_ttg_executable(bspmm spmm/spmm.cc LINK_LIBRARIES tiledarray TiledArray_Eigen BTAS + COMPILE_DEFINITIONS BLOCK_SPARSE_GEMM=1;BTAS_TARGET_MAX_INDEX_RANK=2) add_ttg_executable(testing_dpotrf potrf/testing_dpotrf.cc LINK_LIBRARIES tiledarray lapackpp) add_ttg_executable(testing_dtrtri potrf/testing_dtrtri.cc LINK_LIBRARIES tiledarray lapackpp) @@ -37,7 +39,7 @@ if (TARGET tiledarray) if (TARGET roc::hipsolver) add_ttg_executable(testing_dpotrf_hip potrf/testing_dpotrf.cc LINK_LIBRARIES lapackpp tiledarray roc::hipblas roc::hipsolver - COMPILE_DEFINITIONS TTG_ENABLE_HIP=1;DEBUG_TILES_VALUES=1 + COMPILE_DEFINITIONS TTG_ENABLE_HIP=1 #;DEBUG_TILES_VALUES=1 RUNTIMES "parsec") endif(TARGET roc::hipsolver) elseif (TARGET MKL::MKL_DPCPP) diff --git a/examples/spmm/spmm.cc b/examples/spmm/spmm.cc index 0c85eb3d4..e61bbffa3 100644 --- a/examples/spmm/spmm.cc +++ b/examples/spmm/spmm.cc @@ -21,8 +21,8 @@ #endif #include -#include #if !defined(BLOCK_SPARSE_GEMM) +#include #include #include #include @@ -1104,6 +1104,7 @@ static void initSpMatrixMarket(const std::function &)> &keymap, K = (int)A.cols(); } +#ifdef HAVE_BOOST_GRAPH static void initSpRmat(const std::function &)> &keymap, const char *opt, SpMatrix<> &A, SpMatrix<> &B, SpMatrix<> &C, int &M, int &N, int &K, unsigned long seed) { int E; @@ -1160,6 +1161,7 @@ static void initSpRmat(const std::function &)> &keymap, const c std::cout << "#R-MAT: " << E << " nonzero elements, density: " << (double)nnz / (double)N / (double)N << std::endl; } } +#endif // HAVE_BOOST_GRAPH static void initSpHardCoded(const std::function &)> &keymap, SpMatrix<> &A, SpMatrix<> &B, SpMatrix<> &C, int &m, int &n, int &k) { @@ -1802,10 +1804,12 @@ int main(int argc, char **argv) { char *filename = getCmdOption(argv, argv + argc, "-mm"); tiling_type = filename; initSpMatrixMarket(ij_keymap, filename, A, B, C, M, N, K); +#ifdef HAVE_BOOST_GRAPH } else if (cmdOptionExists(argv, argv + argc, "-rmat")) { char *opt = getCmdOption(argv, argv + argc, "-rmat"); tiling_type = "RandomSparseMatrix"; initSpRmat(ij_keymap, opt, A, B, C, M, N, K, seed); +#endif // HAVE_BOOST_GRAPH } else { tiling_type = "HardCodedSparseMatrix"; initSpHardCoded(ij_keymap, A, B, C, M, N, K);