diff --git a/contrib/spack/packages/lci/package.py b/contrib/spack/packages/lci/package.py index 2174fa91..ad35c116 100644 --- a/contrib/spack/packages/lci/package.py +++ b/contrib/spack/packages/lci/package.py @@ -4,18 +4,18 @@ class Lci(CMakePackage): """LCI: the Lightweight Communication Interface""" - homepage = "https://github.com/uiuc-hpc/LC" - url = "https://github.com/uiuc-hpc/LC/archive/refs/tags/v1.7.6.tar.gz" - git = "https://github.com/uiuc-hpc/LC.git" + homepage = 'https://github.com/uiuc-hpc/LC' + url = 'https://github.com/uiuc-hpc/LC/archive/refs/tags/v1.7.6.tar.gz' + git = 'https://github.com/uiuc-hpc/LC.git' - maintainers("omor1", "JiakunYan") + maintainers('omor1', 'JiakunYan') version('master', branch='master') version('coll', branch='topic/coll') - version("1.7.6", sha256="2cc6ebd2034cbdc4a1e6da3f0121092e27690851749bfa59ee70fa82309a8a2a") - version("1.7.5", sha256="a7a2aaec8ed2de31dabfbcbf1ff4dda219cb6c49a661a9072a8364ca10fe622c") - version("1.7.4", sha256="843f53c4d5f00653b466ca142679d2652cc93205e021d8d890513b3a44c44669") - version("1.7.3", sha256="329c24e75d9e61a694b7ff3cebe57272b6e39204fa10c7d4db151183f04b5fe8") + version('1.7.6', sha256='2cc6ebd2034cbdc4a1e6da3f0121092e27690851749bfa59ee70fa82309a8a2a') + version('1.7.5', sha256='a7a2aaec8ed2de31dabfbcbf1ff4dda219cb6c49a661a9072a8364ca10fe622c') + version('1.7.4', sha256='843f53c4d5f00653b466ca142679d2652cc93205e021d8d890513b3a44c44669') + version('1.7.3', sha256='329c24e75d9e61a694b7ff3cebe57272b6e39204fa10c7d4db151183f04b5fe8') def is_positive_int(val): try: @@ -74,16 +74,20 @@ def is_positive_int(val): variant('papi', default=False, description='Use PAPI to collect hardware counters') variant('gprof', default=False, description='Enable GPROF') - variant('enable-pmix', default='auto', - description='Enable PMIx as the process management backend') + 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')) - generator("ninja", "make", default="ninja") + 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='default-pm=mpi') + depends_on('mpi', when='enable-pm=mpi') depends_on('papi', when='+papi') depends_on('doxygen', when='+docs') depends_on('cray-mpich', when='platform=cray') @@ -116,38 +120,44 @@ def cmake_args(self): arg = self.define_from_variant('LCI_USE_DREG_DEFAULT', 'default-dreg') args.append(arg) - if self.spec.variants['enable-pmix'].value != 'auto': - arg = self.define_from_variant('LCT_PMI_BACKEND_ENABLE_PMIX', 'enable-pmix') + 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) + args.append(arg) + 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) args.append(arg) - if self.spec.variants['cache-line'].value != 'auto': + if not self.spec.satisfies('cache-line=auto'): arg = self.define_from_variant('LCI_CACHE_LINE', 'cache-line') args.append(arg) - if self.spec.satisfies("platform=cray") or self.spec.satisfies("default-pm=cray"): + if self.spec.satisfies('platform=cray') or self.spec.satisfies('default-pm=cray'): arg = self.define('LCI_PMI_BACKEND_DEFAULT', 'pmi1') args.append(arg) - elif 'auto' not in self.spec.variants['default-pm'].value: + elif not self.spec.satisfies('default-pm=auto'): arg = self.define_from_variant('LCI_PMI_BACKEND_DEFAULT', 'default-pm') args.append(arg) - if self.spec.variants['default-packet-size'].value != 'auto': + if not self.spec.satisfies('default-packet-size=auto'): arg = self.define_from_variant('LCI_PACKET_SIZE_DEFAULT', 'default-packet-size') args.append(arg) - if self.spec.variants['default-packets'].value != 'auto': + if not self.spec.satisfies('default-packets=auto'): arg = self.define_from_variant('LCI_SERVER_NUM_PKTS_DEFAULT', 'default-packets') args.append(arg) - if self.spec.variants['default-max-sends'].value != 'auto': + if not self.spec.satisfies('default-max-sends=auto'): arg = self.define_from_variant('LCI_SERVER_MAX_SENDS_DEFAULT', 'default-max-sends') args.append(arg) - if self.spec.variants['default-max-recvs'].value != 'auto': + if not self.spec.satisfies('default-max-recvs=auto'): arg = self.define_from_variant('LCI_SERVER_MAX_RECVS_DEFAULT', 'default-max-recvs') args.append(arg) - if self.spec.variants['default-max-cqe'].value != 'auto': + if not self.spec.satisfies('default-max-cqe=auto'): arg = self.define_from_variant('LCI_SERVER_MAX_CQES_DEFAULT', 'default-max-cqe') args.append(arg) diff --git a/lct/api/lct_config.h.in b/lct/api/lct_config.h.in index feb7fa76..cff1b89f 100644 --- a/lct/api/lct_config.h.in +++ b/lct/api/lct_config.h.in @@ -5,6 +5,8 @@ #define LCT_CACHE_LINE @LCT_CACHE_LINE@ #cmakedefine LCT_CONFIG_USE_ALIGNED_ALLOC #define LCT_PMI_BACKEND_DEFAULT "@LCT_PMI_BACKEND_DEFAULT@" +#cmakedefine LCT_PMI_BACKEND_ENABLE_PMI1 +#cmakedefine LCT_PMI_BACKEND_ENABLE_PMI2 #cmakedefine LCT_PMI_BACKEND_ENABLE_MPI #cmakedefine LCT_PMI_BACKEND_ENABLE_PMIX diff --git a/lct/pmi/CMakeLists.txt b/lct/pmi/CMakeLists.txt index 256ca915..f5448de2 100644 --- a/lct/pmi/CMakeLists.txt +++ b/lct/pmi/CMakeLists.txt @@ -8,24 +8,33 @@ lct_option( set(LIBRARY_NAME LCT) +target_sources_relative(${LIBRARY_NAME} PRIVATE pmi_wrapper.cpp + pmi_wrapper_local.cpp) + find_package(PMI) -if(PMI_FOUND) - target_link_libraries(${LIBRARY_NAME} PRIVATE PMI::PMI) -else() - add_subdirectory(pmi1) +option(LCT_PMI_BACKEND_ENABLE_PMI1 + "Enable PMI as the process management backend" ON) +if(LCT_PMI_BACKEND_ENABLE_PMI1) + if(PMI_FOUND) + target_link_libraries(${LIBRARY_NAME} PRIVATE PMI::PMI) + else() + add_subdirectory(pmi1) + endif() + target_sources_relative(${LIBRARY_NAME} PRIVATE pmi_wrapper_pmi1.cpp) endif() find_package(PMI2) -if(PMI2_FOUND) - target_link_libraries(${LIBRARY_NAME} PRIVATE PMI2::PMI2) -else() - add_subdirectory(pmi2) +option(LCT_PMI_BACKEND_ENABLE_PMI2 + "Enable PMI2 as the process management backend" ON) +if(LCT_PMI_BACKEND_ENABLE_PMI2) + if(PMI2_FOUND) + target_link_libraries(${LIBRARY_NAME} PRIVATE PMI2::PMI2) + else() + add_subdirectory(pmi2) + endif() + target_sources_relative(${LIBRARY_NAME} PRIVATE pmi_wrapper_pmi2.cpp) endif() -target_sources_relative( - ${LIBRARY_NAME} PRIVATE pmi_wrapper.cpp pmi_wrapper_pmi1.cpp - pmi_wrapper_pmi2.cpp pmi_wrapper_local.cpp) - find_package(MPI COMPONENTS CXX) option(LCT_PMI_BACKEND_ENABLE_MPI "Enable MPI as the process management backend" ${MPI_FOUND}) diff --git a/lct/pmi/pmi_wrapper.cpp b/lct/pmi/pmi_wrapper.cpp index 0b94ae6c..8a926381 100644 --- a/lct/pmi/pmi_wrapper.cpp +++ b/lct/pmi/pmi_wrapper.cpp @@ -24,9 +24,21 @@ void LCT_pmi_initialize() if (strcmp(word, "local") == 0) { lct::pmi::local_setup_ops(&lcti_pmi_ops); } else if (strcmp(word, "pmi1") == 0) { +#ifdef LCT_PMI_BACKEND_ENABLE_PMI1 lct::pmi::pmi1_setup_ops(&lcti_pmi_ops); +#else + LCT_Log(LCT_log_ctx_default, LCT_LOG_INFO, "pmi", + "LCT is not compiled with the %s backend. Skip.\n", word); + continue; +#endif } else if (strcmp(word, "pmi2") == 0) { +#ifdef LCT_PMI_BACKEND_ENABLE_PMI2 lct::pmi::pmi2_setup_ops(&lcti_pmi_ops); +#else + LCT_Log(LCT_log_ctx_default, LCT_LOG_INFO, "pmi", + "LCT is not compiled with the %s backend. Skip.\n", word); + continue; +#endif } else if (strcmp(word, "pmix") == 0) { #ifdef LCT_PMI_BACKEND_ENABLE_PMIX lct::pmi::pmix_setup_ops(&lcti_pmi_ops); diff --git a/lct/pmi/pmi_wrapper.hpp b/lct/pmi/pmi_wrapper.hpp index b88f130d..4efd789f 100644 --- a/lct/pmi/pmi_wrapper.hpp +++ b/lct/pmi/pmi_wrapper.hpp @@ -20,9 +20,13 @@ struct ops_t { void local_setup_ops(struct ops_t* ops); +#ifdef LCT_PMI_BACKEND_ENABLE_PMI1 void pmi1_setup_ops(struct ops_t* ops); +#endif +#ifdef LCT_PMI_BACKEND_ENABLE_PMI2 void pmi2_setup_ops(struct ops_t* ops); +#endif #ifdef LCT_PMI_BACKEND_ENABLE_PMIX void pmix_setup_ops(struct ops_t* ops);