From 3ff3149eea05bf724ce43ef68b963ab7738f1dcf Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Mon, 23 May 2022 23:22:01 +0200 Subject: [PATCH] sys-cluster/Graph500: new package, add 1.2 Signed-off-by: Alessandro Barbieri --- sys-cluster/Graph500/Graph500-1.2.ebuild | 57 ++++++++ sys-cluster/Graph500/Manifest | 1 + .../files/Graph500-1.2-CMakeLists.txt | 135 ++++++++++++++++++ .../Graph500-1.2-MPI_Type_create_struct.patch | 11 ++ .../files/Graph500-1.2-static-inline.patch | 11 ++ sys-cluster/Graph500/metadata.xml | 12 ++ 6 files changed, 227 insertions(+) create mode 100644 sys-cluster/Graph500/Graph500-1.2.ebuild create mode 100644 sys-cluster/Graph500/Manifest create mode 100644 sys-cluster/Graph500/files/Graph500-1.2-CMakeLists.txt create mode 100644 sys-cluster/Graph500/files/Graph500-1.2-MPI_Type_create_struct.patch create mode 100644 sys-cluster/Graph500/files/Graph500-1.2-static-inline.patch create mode 100644 sys-cluster/Graph500/metadata.xml diff --git a/sys-cluster/Graph500/Graph500-1.2.ebuild b/sys-cluster/Graph500/Graph500-1.2.ebuild new file mode 100644 index 0000000000..dae92c7d67 --- /dev/null +++ b/sys-cluster/Graph500/Graph500-1.2.ebuild @@ -0,0 +1,57 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake + +MYPN="${PN,,}" +MYP="${MYPN}-${PV}" + +DESCRIPTION="Graph500 reference implementations" +HOMEPAGE="https://github.com/Graph500/graph500" +SRC_URI="https://github.com/${PN}/${PN}/archive/refs/tags/${MYP}.tar.gz" +S="${WORKDIR}/${MYPN}-${MYP}" + +KEYWORDS="~amd64" +LICENSE="MIT Boost-1.0" +SLOT="0" +IUSE="mpi openmp" + +RDEPEND=" + sys-libs/binutils-libs + mpi? ( virtual/mpi ) +" +DEPEND="${RDEPEND}" +BDEPEND="app-admin/chrpath" + +PATCHES=( + "${FILESDIR}/${P}-MPI_Type_create_struct.patch" + "${FILESDIR}/${P}-static-inline.patch" +) + +src_prepare() { + cp "${FILESDIR}/${P}-CMakeLists.txt" CMakeLists.txt || die + cmake_src_prepare +} + +src_configure() { + local mycmakeargs=( + -DBUILD_MPI=$(usex mpi) + -DBUILD_OPENMP=$(usex openmp) + ) + cmake_src_configure +} + +src_install() { + cmake_src_install + dosym ./libgenerator-seq.so "/usr/$(get_libdir)/libGraphGenlib.so" + dodoc README Graph500.org + insinto "/usr/share/doc/${PF}/html" + doins *.html + insinto "/usr/share/octave/site/m/${PN}" + doins -r octave/* + chrpath -d "${ED}/usr/bin/graph500_mpi_one_sided" || die + chrpath -d "${ED}/usr/bin/graph500_mpi_simple" || die + chrpath -d "${ED}/usr/bin/generator_test_mpi" || die +} diff --git a/sys-cluster/Graph500/Manifest b/sys-cluster/Graph500/Manifest new file mode 100644 index 0000000000..70c9f8dbf4 --- /dev/null +++ b/sys-cluster/Graph500/Manifest @@ -0,0 +1 @@ +DIST graph500-1.2.tar.gz 368889 BLAKE2B f0afe4b89edab710b4c0149d5e726ba5758d2cc1852a8837ee7ffbc87dae23ce212b39b27e2301908f652c5dc7ea07525125decdb559e6585df4a80e68ff0686 SHA512 f62d5f4c1144234baf619a7e3f05eed5bfc2c6b7c9b8bd317cceb9652fbdba057976cb83d06e58d8290fe8caf79b113d5ab8ba9122d79f71c12e04af410b3afc diff --git a/sys-cluster/Graph500/files/Graph500-1.2-CMakeLists.txt b/sys-cluster/Graph500/files/Graph500-1.2-CMakeLists.txt new file mode 100644 index 0000000000..f9ed407399 --- /dev/null +++ b/sys-cluster/Graph500/files/Graph500-1.2-CMakeLists.txt @@ -0,0 +1,135 @@ +cmake_minimum_required(VERSION 3.15) +project(graph500 LANGUAGES C) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +include(GNUInstallDirs) + +SET(GRAPH500_SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/options.c" + "${CMAKE_CURRENT_SOURCE_DIR}/rmat.c" + "${CMAKE_CURRENT_SOURCE_DIR}/kronecker.c" + "${CMAKE_CURRENT_SOURCE_DIR}/verify.c" + "${CMAKE_CURRENT_SOURCE_DIR}/prng.c" + "${CMAKE_CURRENT_SOURCE_DIR}/xalloc.c" + "${CMAKE_CURRENT_SOURCE_DIR}/timer.c" +) +ADD_LIBRARY(GRAPH500_OBJECTS OBJECT ${GRAPH500_SOURCES}) +target_include_directories(GRAPH500_OBJECTS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") + +SET(GENERATOR_SRC + "${CMAKE_CURRENT_SOURCE_DIR}/generator/btrd_binomial_distribution.c" + "${CMAKE_CURRENT_SOURCE_DIR}/generator/splittable_mrg.c" + "${CMAKE_CURRENT_SOURCE_DIR}/generator/mrg_transitions.c" + "${CMAKE_CURRENT_SOURCE_DIR}/generator/graph_generator.c" + "${CMAKE_CURRENT_SOURCE_DIR}/generator/permutation_gen.c" + "${CMAKE_CURRENT_SOURCE_DIR}/generator/make_graph.c" + "${CMAKE_CURRENT_SOURCE_DIR}/generator/utils.c" + "${CMAKE_CURRENT_SOURCE_DIR}/generator/scramble_edges.c" +) + +ADD_LIBRARY(generator-seq SHARED ${GENERATOR_SRC} $) +target_compile_definitions(generator-seq PUBLIC GRAPH_GENERATOR_SEQ) +target_include_directories(generator-seq PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/generator") +target_link_libraries(generator-seq PUBLIC -liberty) +install(TARGETS generator-seq LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") + +if(BUILD_OPENMP) + find_package(OpenMP REQUIRED) + + ADD_LIBRARY(generator-omp SHARED ${GENERATOR_SRC} $) + set_target_properties(generator-omp PROPERTIES COMPILE_FLAGS "-fopenmp") + target_compile_definitions(generator-omp PUBLIC GRAPH_GENERATOR_OMP) + target_include_directories(generator-omp PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/generator") + target_link_libraries(generator-omp PUBLIC OpenMP::OpenMP_C -liberty) + install(TARGETS generator-omp LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") + + ADD_EXECUTABLE(omp-csr + "${CMAKE_CURRENT_SOURCE_DIR}/omp-csr/omp-csr.c" + "${CMAKE_CURRENT_SOURCE_DIR}/graph500.c" + ) + target_link_libraries(omp-csr generator-omp -lm) + install(TARGETS omp-csr RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + + ADD_EXECUTABLE(generator_test_omp "${CMAKE_CURRENT_SOURCE_DIR}/generator/generator_test_omp.c") + target_link_libraries(generator_test_omp generator-omp -lm) + install(TARGETS generator_test_omp RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +endif() + +ADD_EXECUTABLE(seq-list + "${CMAKE_CURRENT_SOURCE_DIR}/seq-list/seq-list.c" + "${CMAKE_CURRENT_SOURCE_DIR}/graph500.c" +) +target_link_libraries(seq-list generator-seq -lm) +install(TARGETS seq-list RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + +ADD_EXECUTABLE(seq-csr + "${CMAKE_CURRENT_SOURCE_DIR}/seq-csr/seq-csr.c" + "${CMAKE_CURRENT_SOURCE_DIR}/graph500.c" +) +target_link_libraries(seq-csr generator-seq -lm) +install(TARGETS seq-csr RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + +ADD_EXECUTABLE(generator_test_seq "${CMAKE_CURRENT_SOURCE_DIR}/generator/generator_test_seq.c") +target_link_libraries(generator_test_seq generator-seq -lm) +install(TARGETS generator_test_seq RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + +if(BUILD_MPI) + find_package(MPI REQUIRED) + + ADD_LIBRARY(graph_generator_mpi SHARED + "${CMAKE_CURRENT_SOURCE_DIR}/generator/apply_permutation_mpi.c" + ${GENERATOR_SRC} + ) + target_compile_definitions(graph_generator_mpi PUBLIC restrict=__restrict__ GRAPH_GENERATOR_MPI GRAPHGEN_DISTRIBUTED_MEMORY) + target_include_directories(graph_generator_mpi + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/generator" + PRIVATE + ${MPI_INCLUDE_PATH} + ) + target_link_libraries(graph_generator_mpi PUBLIC ${MPI_LIBRARIES} ${MPI_LINK_FLAGS} -liberty) + install(TARGETS graph_generator_mpi LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") + + ADD_EXECUTABLE(generator_test_mpi "${CMAKE_CURRENT_SOURCE_DIR}/generator/generator_test_mpi.c") + target_compile_definitions(graph_generator_mpi PUBLIC restrict=__restrict__ GRAPH_GENERATOR_MPI GRAPHGEN_DISTRIBUTED_MEMORY) + target_include_directories(generator_test_mpi + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/generator" + PRIVATE + ${MPI_INCLUDE_PATH} + ) + target_link_libraries(generator_test_mpi graph_generator_mpi ${MPI_LIBRARIES} ${MPI_LINK_FLAGS} -lm) + install(TARGETS generator_test_mpi RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + + SET(graph500_mpi_src + "${CMAKE_CURRENT_SOURCE_DIR}/mpi/convert_to_csr.c" + "${CMAKE_CURRENT_SOURCE_DIR}/mpi/find_roots.c" + "${CMAKE_CURRENT_SOURCE_DIR}/mpi/utils.c" + "${CMAKE_CURRENT_SOURCE_DIR}/mpi/validate.c" + ) + ADD_LIBRARY(graph500_mpi_obj OBJECT ${graph500_mpi_src}) + target_include_directories(graph500_mpi_obj PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/mpi") + target_compile_definitions(graph500_mpi_obj PUBLIC restrict=__restrict__ GRAPH_GENERATOR_MPI GRAPHGEN_DISTRIBUTED_MEMORY) + ADD_LIBRARY(graph500_mpi SHARED $) + install(TARGETS graph500_mpi LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") + + ADD_EXECUTABLE(graph500_mpi_simple + "${CMAKE_CURRENT_SOURCE_DIR}/mpi/main.c" + "${CMAKE_CURRENT_SOURCE_DIR}/mpi/bfs_simple.c" + ) + target_compile_definitions(graph500_mpi_simple PUBLIC restrict=__restrict__ GRAPH_GENERATOR_MPI GRAPHGEN_DISTRIBUTED_MEMORY) + target_link_libraries(graph500_mpi_simple graph500_mpi graph_generator_mpi -lm) + install(TARGETS graph500_mpi_simple RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + + ADD_EXECUTABLE(graph500_mpi_one_sided + "${CMAKE_CURRENT_SOURCE_DIR}/mpi/main.c" + "${CMAKE_CURRENT_SOURCE_DIR}/mpi/bfs_one_sided.c" + ) + target_compile_definitions(graph500_mpi_simple PUBLIC restrict=__restrict__ GRAPH_GENERATOR_MPI GRAPHGEN_DISTRIBUTED_MEMORY) + target_link_libraries(graph500_mpi_one_sided graph500_mpi graph_generator_mpi -lm) + install(TARGETS graph500_mpi_one_sided RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +endif() + + +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/graph500" FILES_MATCHING PATTERN "*.h") +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/mpi/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/graph500/mpi" FILES_MATCHING PATTERN "*.h") +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/generator/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/graph500/generator" FILES_MATCHING PATTERN "*.h") diff --git a/sys-cluster/Graph500/files/Graph500-1.2-MPI_Type_create_struct.patch b/sys-cluster/Graph500/files/Graph500-1.2-MPI_Type_create_struct.patch new file mode 100644 index 0000000000..00719ae082 --- /dev/null +++ b/sys-cluster/Graph500/files/Graph500-1.2-MPI_Type_create_struct.patch @@ -0,0 +1,11 @@ +--- a/generator/permutation_gen.c ++++ b/generator/permutation_gen.c +@@ -251,7 +251,7 @@ + indices[0] -= temp_base; + indices[1] -= temp_base; + MPI_Datatype old_types[] = {INT64_T_MPI_TYPE, INT64_T_MPI_TYPE}; +- MPI_Type_struct(2, blocklens, indices, old_types, &slot_data_type); ++ MPI_Type_create_struct(2, blocklens, indices, old_types, &slot_data_type); + MPI_Type_commit(&slot_data_type); + } + diff --git a/sys-cluster/Graph500/files/Graph500-1.2-static-inline.patch b/sys-cluster/Graph500/files/Graph500-1.2-static-inline.patch new file mode 100644 index 0000000000..0b1f63a282 --- /dev/null +++ b/sys-cluster/Graph500/files/Graph500-1.2-static-inline.patch @@ -0,0 +1,11 @@ +--- a/generator/generator_test_seq.c ++++ b/generator/generator_test_seq.c +@@ -20,7 +20,7 @@ + + #include "make_graph.h" + +-inline double get_time() { ++static inline double get_time() { + struct timeval tv; + gettimeofday(&tv, NULL); + return tv.tv_sec + tv.tv_usec * 1.e-6; diff --git a/sys-cluster/Graph500/metadata.xml b/sys-cluster/Graph500/metadata.xml new file mode 100644 index 0000000000..b1085be03b --- /dev/null +++ b/sys-cluster/Graph500/metadata.xml @@ -0,0 +1,12 @@ + + + + + lssndrbarbieri@gmail.com + Alessandro Barbieri + + + https://github.com/Graph500/graph500/issues + Graph500/graph500 + +