Skip to content

Commit

Permalink
improve(spack): make the MPI dependency explicit in Spack
Browse files Browse the repository at this point in the history
  • Loading branch information
JiakunYan committed May 6, 2024
1 parent 6d08e1a commit 71250a3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
11 changes: 7 additions & 4 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ endfunction()

add_lcit_benchmarks(lcitb_pt2pt.cpp)

find_package(MPI)
if(MPI_FOUND)
add_lcit_benchmark(mpi_pt2pt.cpp)
target_link_libraries(mpi_pt2pt PRIVATE MPI::MPI_CXX)
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()
4 changes: 3 additions & 1 deletion contrib/spack/packages/lci/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,16 @@ def is_positive_int(val):
('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='default-pm=mpi')
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')
Expand All @@ -103,6 +104,7 @@ def cmake_args(self):
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'),
Expand Down
4 changes: 2 additions & 2 deletions lct/pmi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ if(LCT_PMI_BACKEND_ENABLE_PMI2)
target_sources_relative(${LIBRARY_NAME} PRIVATE pmi_wrapper_pmi2.cpp)
endif()

find_package(MPI COMPONENTS CXX)
option(LCT_PMI_BACKEND_ENABLE_MPI
"Enable MPI as the process management backend" ${MPI_FOUND})
"Enable MPI as the process management backend" OFF)
if(LCT_PMI_BACKEND_ENABLE_MPI)
find_package(MPI COMPONENTS CXX)
if(MPI_FOUND)
target_sources_relative(${LIBRARY_NAME} PRIVATE pmi_wrapper_mpi.cpp)
target_link_libraries(${LIBRARY_NAME} PRIVATE MPI::MPI_CXX)
Expand Down

0 comments on commit 71250a3

Please sign in to comment.