From d9b81a0417bee256910459ab870c2c323689cf97 Mon Sep 17 00:00:00 2001 From: Jiakun Yan Date: Mon, 6 May 2024 20:23:59 -0500 Subject: [PATCH] Update spack package.py: rename options; remove pure mpi benchmarks --- CMakeLists.txt | 9 +- benchmarks/CMakeLists.txt | 9 - benchmarks/{ => archive}/mpi_pt2pt.cpp | 0 contrib/spack/packages/lci/package.py | 262 +++++++++++++------------ examples/MPI_LCI/CMakeLists.txt | 27 --- examples/MPI_LCI/hello_world.cpp | 33 ---- 6 files changed, 139 insertions(+), 201 deletions(-) rename benchmarks/{ => archive}/mpi_pt2pt.cpp (100%) delete mode 100644 examples/MPI_LCI/CMakeLists.txt delete mode 100644 examples/MPI_LCI/hello_world.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 06fccf98..6da49c4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,7 @@ if(NOT LCI_WITH_LCT_ONLY) find_package(IBV) find_package(OFI) - find_package(UCX) + find_package(UCX CONFIG) string(TOUPPER ${LCI_SERVER} LCI_SERVER_UPPER) if(${LCI_SERVER_UPPER}_FOUND) # If the user-specified server are found, just use it. @@ -175,13 +175,6 @@ if(NOT LCI_WITH_LCT_ONLY) option(LCI_ENABLE_PRG_NET_ENDPOINT_DEFAULT "Enable the progress specific network endpoint by default." ON) - option(LCI_USE_GPROF "Enable GPROF" OFF) - if(LCI_USE_GPROF) - add_compile_options(-pg -fno-inline) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg") - endif() - include(CheckCCompilerFlag) check_c_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) option(LCI_OPTIMIZE_FOR_NATIVE "Build with -march=native" diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 0c127570..6e5719d6 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -41,12 +41,3 @@ function(add_lcit_benchmarks) endfunction() add_lcit_benchmarks(lcitb_pt2pt.cpp) - -option(LCI_WITH_MPI_BENCHMARKS "Build MPI Benchmarks by default" ON) -if(LCI_WITH_MPI_BENCHMARKS) - find_package(MPI) - if(MPI_FOUND) - add_lcit_benchmark(mpi_pt2pt.cpp) - target_link_libraries(mpi_pt2pt PRIVATE MPI::MPI_CXX) - endif() -endif() diff --git a/benchmarks/mpi_pt2pt.cpp b/benchmarks/archive/mpi_pt2pt.cpp similarity index 100% rename from benchmarks/mpi_pt2pt.cpp rename to benchmarks/archive/mpi_pt2pt.cpp diff --git a/contrib/spack/packages/lci/package.py b/contrib/spack/packages/lci/package.py index c1f153d2..0f73dcf2 100644 --- a/contrib/spack/packages/lci/package.py +++ b/contrib/spack/packages/lci/package.py @@ -1,17 +1,16 @@ -from spack import * -import os +from spack.package import * + class Lci(CMakePackage): """LCI: the Lightweight Communication Interface""" - homepage = 'https://github.com/uiuc-hpc/lci' - url = 'https://github.com/uiuc-hpc/lci/archive/refs/tags/v1.7.7.tar.gz' - git = 'https://github.com/uiuc-hpc/lci.git' + homepage = "https://github.com/uiuc-hpc/lci" + url = "https://github.com/uiuc-hpc/lci/archive/refs/tags/v1.7.7.tar.gz" + git = "https://github.com/uiuc-hpc/lci.git" - maintainers('omor1', 'JiakunYan') + maintainers("omor1", "JiakunYan") - version('master', branch='master') - version('coll', branch='topic/coll') + version("master", branch="master") version("1.7.7", sha256="c310f699b7b4317a2f5c3557f85c240fe3c85d2d06618dd248434ef807d53779") version("1.7.6", sha256="c88ccea2ad277ed38fc23187771b52b6fb212ed4429114717bfa8887ed21665c") version("1.7.5", sha256="13e4084c9e7aaf55966ba5aa0423164b8fd21ee7526fc62017b3c9b3db99cb83") @@ -22,146 +21,161 @@ def is_positive_int(val): try: return int(val) > 0 except ValueError: - return val == 'auto' - - variant('fabric', default='ibv', values=('ofi', 'ibv', 'ucx'), multi=False, - description='Communication fabric') - variant('completion', default='sync,cq,am', - values=('sync', 'cq', 'am', 'glob'), multi=True, - description='Completion mechanism') - - variant('shared', default=True, description='Build with shared libraries') - variant('examples', default=False, description='Build LCI examples') - variant('tests', default=False, description='Build LCI tests') - variant('benchmarks', default=False, description='Build LCI benchmarks') - variant('docs', default=False, description='Build LCI documentation') - - variant('vector', default=True, - description='Use GCC vector extension for the immediate field') - variant('aligned', default=True, description='Enable memory alignment') - variant('cache-line', default='auto', values=is_positive_int, - description='Cache line size, in bytes') - variant('native', default=True, description='Build with -march=native') - - variant('inline-cq', default=False, - description='Use the inline C completion queue implementation') - variant('ibv-td', default=True, - description='Enable IBV thread domain') - - variant('default-pm', description='Default: Process management backend', - values=disjoint_sets( - ('auto',), ('pmix', 'pmi2', 'pmi1', 'mpi', 'local'), ('cray',), - ).prohibit_empty_set( - ).with_default('auto').with_non_feature_values('auto')) - variant('multithread-progress', default=True, - description='Enable thread-safe LCI_progress function') - variant('default-dreg', default='auto', - description='Default: Whether to use registration cache') - variant('default-packet-size', default='auto', values=is_positive_int, - description='Default: Size of packet') - variant('default-packets', default='auto', values=is_positive_int, - description='Default: Number of packets') - variant('default-max-sends', default='auto', values=is_positive_int, - description='Default: Max posted sends') - variant('default-max-recvs', default='auto', values=is_positive_int, - description='Default: Max posted recvs') - variant('default-max-cqe', default='auto', values=is_positive_int, - description='Default: Max posted cqes') - - variant('debug', default=False, description='Enable debug mode') - variant('pcounter', default=False, - description='Use performance counter') - variant('debug-slow', default=False, description='Enable manual slowdown') - variant('papi', default=False, - description='Use PAPI to collect hardware counters') - variant('gprof', default=False, description='Enable GPROF') - variant('enable-pm', description='Which process management backend to enable', - values=disjoint_sets( - ('auto',), ('pmix', 'pmi2', 'pmi1', 'mpi', 'local'), - ).prohibit_empty_set( - ).with_default('auto').with_non_feature_values('auto')) - variant('mpi-benchmarks', default=False, description='Enable MPI benchmark', when="@1.7.8:") - - generator('ninja', 'make', default='ninja') - - depends_on('cmake@3.19:', type='build') - depends_on('libfabric', when='fabric=ofi') - depends_on('rdma-core', when='fabric=ibv') - depends_on('ucx', when='fabric=ucx') - depends_on('mpi', when='enable-pm=mpi') - depends_on('mpi', when='+mpi-benchmarks') - depends_on('papi', when='+papi') - depends_on('doxygen', when='+docs') - depends_on('cray-mpich', when='platform=cray') - depends_on('cray-pmi', when='default-pm=cray') + return val == "auto" + + variant( + "fabric", + default="ibv", + values=("ofi", "ibv", "ucx"), + multi=False, + description="Communication fabric", + ) + + variant("examples", default=False, description="Build LCI examples") + variant("tests", default=False, description="Build LCI tests") + variant("benchmarks", default=False, description="Build LCI benchmarks") + variant("docs", default=False, description="Build LCI documentation") + + variant( + "cache-line", + default="auto", + values=is_positive_int, + description="Cache line size, in bytes", + ) + + variant( + "multithread-progress", + default=True, + description="Enable thread-safe LCI_progress function", + ) + variant("dreg", default="auto", description="Whether to use registration cache by default") + variant( + "packet-size", + default="auto", + values=is_positive_int, + description="Size of packet by default", + ) + variant( + "npackets", + default="auto", + values=is_positive_int, + description="Number of packets by default", + ) + variant( + "fabric-nsends-max", + default="auto", + values=is_positive_int, + description="Max number of send descriptors that can be posted (send queue length) " + "at the fabric layer by default", + ) + variant( + "fabric-nrecvs-max", + default="auto", + values=is_positive_int, + description="Max number of receive descriptors that can be posted (receive queue length) " + "at the fabric layer by default", + ) + variant( + "fabric-ncqes-max", + default="auto", + values=is_positive_int, + description="Max number of completion queue entries that can be posted " + "(completion queue length) at the fabric layer by default", + ) + + variant("debug", default=False, description="Enable the debug mode") + variant("pcounter", default=False, description="Enable the performance counters") + variant( + "papi", default=False, description="Enable the PAPI plugin to collect hardware counters" + ) + + variant( + "enable-pm", + description="Process management backends to enable", + values=disjoint_sets(("auto",), ("pmix", "pmi2", "pmi1", "mpi", "local")) + .prohibit_empty_set() + .with_default("auto") + .with_non_feature_values("auto"), + ) + variant( + "default-pm", + description="Order of process management backends to try by default", + values=disjoint_sets(("auto",), ("pmix", "pmi2", "pmi1", "mpi", "local"), ("cray",)) + .prohibit_empty_set() + .with_default("auto") + .with_non_feature_values("auto"), + ) + + generator("ninja", "make", default="ninja") + + depends_on("cmake@3.12:", type="build") + depends_on("libfabric", when="fabric=ofi") + depends_on("rdma-core", when="fabric=ibv") + depends_on("ucx", when="fabric=ucx") + depends_on("mpi", when="enable-pm=mpi") + depends_on("papi", when="+papi") + depends_on("doxygen", when="+docs") + depends_on("cray-pmi", when="default-pm=cray") def cmake_args(self): args = [ - self.define_from_variant('LCI_SERVER', 'fabric'), - self.define('LCI_FORCE_SERVER', True), - self.define_from_variant('LCI_EP_CE', 'completion'), - self.define_from_variant('BUILD_SHARED_LIBS', 'shared'), - self.define_from_variant('LCI_WITH_EXAMPLES', 'examples'), - self.define_from_variant('LCI_WITH_TESTS', 'tests'), - self.define_from_variant('LCI_WITH_BENCHMARKS', 'benchmarks'), - self.define_from_variant('LCI_WITH_MPI_BENCHMARKS', 'mpi-benchmarks'), - self.define_from_variant('LCI_WITH_DOC', 'docs'), - self.define_from_variant('LCI_USE_AVX', 'vector'), - self.define_from_variant('LCI_CONFIG_USE_ALIGNED_ALLOC', 'aligned'), - self.define_from_variant('LCI_OPTIMIZE_FOR_NATIVE', 'native'), - self.define_from_variant('LCI_USE_INLINE_CQ', 'inline-cq'), - self.define_from_variant('LCI_IBV_ENABLE_TD', 'ibv-td'), - self.define_from_variant('LCI_ENABLE_MULTITHREAD_PROGRESS', 'multithread-progress'), - self.define_from_variant('LCI_DEBUG', 'debug'), - self.define_from_variant('LCI_USE_PERFORMANCE_COUNTER', 'pcounter'), - self.define_from_variant('LCI_ENABLE_SLOWDOWN', 'debug-slow'), - self.define_from_variant('LCI_USE_PAPI', 'papi'), - self.define_from_variant('LCI_USE_GPROF', 'gprof'), + self.define_from_variant("LCI_SERVER", "fabric"), + self.define("LCI_FORCE_SERVER", True), + self.define_from_variant("LCI_WITH_EXAMPLES", "examples"), + self.define_from_variant("LCI_WITH_TESTS", "tests"), + self.define_from_variant("LCI_WITH_BENCHMARKS", "benchmarks"), + self.define_from_variant("LCI_WITH_DOC", "docs"), + self.define_from_variant("LCI_ENABLE_MULTITHREAD_PROGRESS", "multithread-progress"), + self.define_from_variant("LCI_DEBUG", "debug"), + self.define_from_variant("LCI_USE_PERFORMANCE_COUNTER", "pcounter"), + self.define_from_variant("LCI_USE_PAPI", "papi"), ] - if not self.spec.satisfies('default-dreg=auto'): - arg = self.define_from_variant('LCI_USE_DREG_DEFAULT', 'default-dreg') + if not self.spec.satisfies("dreg=auto"): + arg = self.define_from_variant("LCI_USE_DREG_DEFAULT", "dreg") args.append(arg) - if not self.spec.satisfies('enable-pm=auto'): - arg = self.define('LCT_PMI_BACKEND_ENABLE_PMI1', 'enable-pm=pmi1' in self.spec) + if not self.spec.satisfies("enable-pm=auto"): + arg = self.define("LCT_PMI_BACKEND_ENABLE_PMI1", "enable-pm=pmi1" in self.spec) args.append(arg) - arg = self.define('LCT_PMI_BACKEND_ENABLE_PMI2', 'enable-pm=pmi2' in self.spec) + arg = self.define("LCT_PMI_BACKEND_ENABLE_PMI2", "enable-pm=pmi2" in self.spec) args.append(arg) - arg = self.define('LCT_PMI_BACKEND_ENABLE_MPI', 'enable-pm=mpi' in self.spec) + arg = self.define("LCT_PMI_BACKEND_ENABLE_MPI", "enable-pm=mpi" in self.spec) args.append(arg) - arg = self.define('LCT_PMI_BACKEND_ENABLE_PMIX', 'enable-pm=pmix' in self.spec) + arg = self.define("LCT_PMI_BACKEND_ENABLE_PMIX", "enable-pm=pmix" in self.spec) args.append(arg) - if not self.spec.satisfies('cache-line=auto'): - arg = self.define_from_variant('LCI_CACHE_LINE', 'cache-line') + if self.spec.satisfies("default-pm=cray"): + arg = self.define("LCI_PMI_BACKEND_DEFAULT", "pmi1") args.append(arg) - - if self.spec.satisfies('platform=cray') or self.spec.satisfies('default-pm=cray'): - arg = self.define('LCI_PMI_BACKEND_DEFAULT', 'pmi1') + arg = self.define("LCT_PMI_BACKEND_ENABLE_PMI1", True) args.append(arg) - elif not self.spec.satisfies('default-pm=auto'): - arg = self.define_from_variant('LCI_PMI_BACKEND_DEFAULT', 'default-pm') + elif not self.spec.satisfies("default-pm=auto"): + arg = self.define_from_variant("LCI_PMI_BACKEND_DEFAULT", "default-pm") + args.append(arg) + + if not self.spec.satisfies("cache-line=auto"): + arg = self.define_from_variant("LCI_CACHE_LINE", "cache-line") args.append(arg) - if not self.spec.satisfies('default-packet-size=auto'): - arg = self.define_from_variant('LCI_PACKET_SIZE_DEFAULT', 'default-packet-size') + if not self.spec.satisfies("packet-size=auto"): + arg = self.define_from_variant("LCI_PACKET_SIZE_DEFAULT", "packet-size") args.append(arg) - if not self.spec.satisfies('default-packets=auto'): - arg = self.define_from_variant('LCI_SERVER_NUM_PKTS_DEFAULT', 'default-packets') + if not self.spec.satisfies("npackets=auto"): + arg = self.define_from_variant("LCI_SERVER_NUM_PKTS_DEFAULT", "npackets") args.append(arg) - if not self.spec.satisfies('default-max-sends=auto'): - arg = self.define_from_variant('LCI_SERVER_MAX_SENDS_DEFAULT', 'default-max-sends') + if not self.spec.satisfies("fabric-nsends-max=auto"): + arg = self.define_from_variant("LCI_SERVER_MAX_SENDS_DEFAULT", "fabric-nsends-max") args.append(arg) - if not self.spec.satisfies('default-max-recvs=auto'): - arg = self.define_from_variant('LCI_SERVER_MAX_RECVS_DEFAULT', 'default-max-recvs') + if not self.spec.satisfies("fabric-nrecvs-max=auto"): + arg = self.define_from_variant("LCI_SERVER_MAX_RECVS_DEFAULT", "fabric-nrecvs-max") args.append(arg) - if not self.spec.satisfies('default-max-cqe=auto'): - arg = self.define_from_variant('LCI_SERVER_MAX_CQES_DEFAULT', 'default-max-cqe') + if not self.spec.satisfies("fabric-ncqes-max=auto"): + arg = self.define_from_variant("LCI_SERVER_MAX_CQES_DEFAULT", "fabric-ncqes-max") args.append(arg) return args diff --git a/examples/MPI_LCI/CMakeLists.txt b/examples/MPI_LCI/CMakeLists.txt deleted file mode 100644 index e7ed51bd..00000000 --- a/examples/MPI_LCI/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -option(LCI_BUILD_MPLCI "build MPI/LCI interoperation examples by default" ON) -if(NOT LCI_BUILD_MPLCI) - set(EXCLUDE_FROM_ALL ON) -endif() - -find_package(MPI) - -function(add_mplci_example NAME) - set(TARGET_NAME mplci_${NAME}) - add_executable(${TARGET_NAME} ${NAME}.cpp) - target_link_libraries(${TARGET_NAME} PRIVATE LCI) - target_include_directories(${TARGET_NAME} PRIVATE ${MPI_CXX_INCLUDE_PATH}) - target_compile_options(${TARGET_NAME} PRIVATE ${MPI_CXX_COMPILE_FLAGS}) - target_link_libraries(${TARGET_NAME} PRIVATE ${MPI_CXX_LIBRARIES} - ${MPI_CXX_LINK_FLAGS}) - target_compile_definitions(${TARGET_NAME} PRIVATE YAMPI_MPI) -endfunction() - -function(add_mplci_examples) - foreach(name ${ARGN}) - add_mplci_example(${name}) - endforeach() -endfunction() - -if(MPI_FOUND) - add_mplci_examples(hello_world) -endif() diff --git a/examples/MPI_LCI/hello_world.cpp b/examples/MPI_LCI/hello_world.cpp deleted file mode 100644 index 8cce7306..00000000 --- a/examples/MPI_LCI/hello_world.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -#include -#include "lci.h" - -int main(int argc, char** argv) -{ - LCI_open(); - // Initialize the MPI environment - MPI_Init(NULL, NULL); - - // Get the number of processes - int world_size; - MPI_Comm_size(MPI_COMM_WORLD, &world_size); - - // Get the rank of the process - int world_rank; - MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); - - // Get the name of the processor - char processor_name[MPI_MAX_PROCESSOR_NAME]; - int name_len; - MPI_Get_processor_name(processor_name, &name_len); - - // Print off a hello world message - assert(world_rank == LCI_RANK); - assert(world_size == LCI_NUM_PROCESSES); - printf("Hello world from processor %s, rank %d out of %d processors\n", - processor_name, world_rank, world_size); - - // Finalize the MPI environment. - MPI_Finalize(); -} \ No newline at end of file