Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPMM: add Boost::graph as dependency #279

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/modules/FindOrFetchBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ if (TTG_PARSEC_USE_BOOST_SERIALIZATION)
list(APPEND optional_components
serialization
iostreams
graph
)
endif()

Expand Down
8 changes: 5 additions & 3 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<TARGET_NAME_IF_EXISTS:Boost::graph>
COMPILE_DEFINITIONS $<$<TARGET_EXISTS:Boost::graph>: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)
Expand All @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion examples/spmm/spmm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#endif

#include <sys/time.h>
#include <boost/graph/rmat_graph_generator.hpp>
#if !defined(BLOCK_SPARSE_GEMM)
#include <boost/graph/rmat_graph_generator.hpp>
#include <boost/graph/directed_graph.hpp>
#include <boost/random/linear_congruential.hpp>
#include <unsupported/Eigen/SparseExtra>
Expand Down Expand Up @@ -1104,6 +1104,7 @@ static void initSpMatrixMarket(const std::function<int(const Key<2> &)> &keymap,
K = (int)A.cols();
}

#ifdef HAVE_BOOST_GRAPH
static void initSpRmat(const std::function<int(const Key<2> &)> &keymap, const char *opt, SpMatrix<> &A, SpMatrix<> &B,
SpMatrix<> &C, int &M, int &N, int &K, unsigned long seed) {
int E;
Expand Down Expand Up @@ -1160,6 +1161,7 @@ static void initSpRmat(const std::function<int(const Key<2> &)> &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<int(const Key<2> &)> &keymap, SpMatrix<> &A, SpMatrix<> &B,
SpMatrix<> &C, int &m, int &n, int &k) {
Expand Down Expand Up @@ -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);
Expand Down
Loading