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

CI/Spack/CMake updates #357

Merged
merged 9 commits into from
Apr 10, 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
31 changes: 30 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ variables:
SINGULARITY_EOS_OPENMPI_VERSION: "4.1.1"
SINGULARITY_EOS_CUDA_VERSION: "11.6.0"
SINGULARITY_EOS_BUILD_TYPE: "RelWithDebInfo"
SINGULARITY_EOS_CXX_STANDARD: 14
SINGULARITY_EOS_SPACK_SPEC: "singularity-eos@main+mpi+spiner+hdf5+python+tests%gcc@=${SINGULARITY_EOS_GCC_VERSION} ^openmpi@${SINGULARITY_EOS_OPENMPI_VERSION}"
COLOR_CYAN: "\e[1;36m"
COLOR_PLAIN: "\e[0m"
Expand Down Expand Up @@ -165,7 +166,6 @@ default:
spack repo add spack-repo
spack develop --no-clone -p ${CI_PROJECT_DIR}/utils/spiner spiner@main
spack develop --no-clone -p ${CI_PROJECT_DIR}/utils/ports-of-call ports-of-call@main
spack develop --no-clone -p ${CI_PROJECT_DIR} singularity-eos@main
spack config add upstreams:default:install_tree:${PROJECT_SPACK_ROOT}/opt/spack/
spack dev-build -j $(nproc) ${SINGULARITY_EOS_SPACK_SPEC}
spack env deactivate
Expand Down Expand Up @@ -196,6 +196,7 @@ default:
- |
cmake -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/install ${SINGULARITY_CMAKE_CXX_COMPILER_FLAG} \
-DCMAKE_BUILD_TYPE=${SINGULARITY_EOS_BUILD_TYPE} \
-DCMAKE_CXX_STANDARD=${SINGULARITY_EOS_CXX_STANDARD} \
-DSINGULARITY_USE_EOSPAC=ON \
-DSINGULARITY_USE_SPINER=ON \
-DSINGULARITY_USE_SPINER_WITH_HDF5=ON \
Expand Down Expand Up @@ -270,6 +271,34 @@ install_gnu_skylake_fort:
<<: *python
<<: *fort

install_gnu_skylake_fort_kokkos:
needs: [download_prereq]
extends: .test
variables:
<<: *skylake
<<: *python
<<: *fort
SINGULARITY_EOS_SPACK_SPEC: "singularity-eos@main+python+mpi+tests+kokkos+spiner+hdf5+kokkos-kernels%gcc@=${SINGULARITY_EOS_GCC_VERSION} ^kokkos std=${SINGULARITY_EOS_CXX_STANDARD} +openmp ^openmpi@${SINGULARITY_EOS_OPENMPI_VERSION}"

install_gnu_skylake_fort_kokkos_cxx17:
needs: [download_prereq]
extends: .test
variables:
<<: *skylake
<<: *python
<<: *fort
SINGULARITY_EOS_CXX_STANDARD: 17
SINGULARITY_EOS_SPACK_SPEC: "singularity-eos@main+python+mpi+tests+kokkos+spiner+hdf5+kokkos-kernels%gcc@=${SINGULARITY_EOS_GCC_VERSION} ^kokkos std=${SINGULARITY_EOS_CXX_STANDARD} +openmp ^openmpi@${SINGULARITY_EOS_OPENMPI_VERSION}"

install_gnu_skylake_fort_static_kokkos:
needs: [download_prereq]
extends: .test
variables:
<<: *skylake
<<: *python
<<: *fort
SINGULARITY_EOS_SPACK_SPEC: "singularity-eos@main+python+mpi+tests+kokkos+spiner+hdf5+kokkos-kernels%gcc@=${SINGULARITY_EOS_GCC_VERSION} ^kokkos std=${SINGULARITY_EOS_CXX_STANDARD} ~shared +openmp ^kokkos-kernels~shared ^openmpi@${SINGULARITY_EOS_OPENMPI_VERSION}"

install_gnu_skylake_nofort:
needs: [download_prereq]
extends: .test
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added (new features/APIs/variables/...)
- [[PR#339]](https://github.com/lanl/singularity-eos/pull/339) Added COMPONENTS to singularity-eos CMake install, allowing to select a minimal subset needed e.g. for Fortran bindings only
- [[PR#336]](https://github.com/lanl/singularity-eos/pull/336) Included code and documentation for a full, temperature consistent, Mie-Gruneisen EOS based on a pressure power law expansion in eta = 1-V/V0. PowerMG.
- [[PR#357]](https://github.com/lanl/singularity-eos/pull/357) Added support for C++17 (e.g., needed when using newer Kokkos).

### Fixed (Repair bugs, etc)
- [[PR343]](https://github.com/lanl/singularity-eos/pull/343) Add chemical potentials to stellar collapse gold files
Expand Down
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,17 @@ if(SINGULARITY_BUILD_PYTHON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()

# require at least C++14, but allow newer versions to become a client requirement if
# explicitly set at build time (needed for building with newer Kokkos)
if(CMAKE_CXX_STANDARD)
target_compile_features(singularity-eos_Interface INTERFACE cxx_std_${CMAKE_CXX_STANDARD})
else()
target_compile_features(singularity-eos_Interface INTERFACE cxx_std_14)
endif()
Yurlungur marked this conversation as resolved.
Show resolved Hide resolved

# checks if this is our build, or we've been imported via `add_subdirectory` NB:
# this should make the `option(SINGULARITY_SUBMODULE_MODE ...)` unnecessary
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
else()
message(
Expand Down
15 changes: 13 additions & 2 deletions spack-repo/packages/singularity-eos/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class SingularityEos(CMakePackage, CudaPackage):
variant("spiner", default=True, description="Use Spiner")

variant("closure", default=True, description="Build closure module")
variant("shared", default=False, description="Build shared libs")

plugins = {}

Expand Down Expand Up @@ -140,17 +141,19 @@ class SingularityEos(CMakePackage, CudaPackage):

# set up kokkos offloading dependencies
for _flag in ("~cuda", "+cuda"):
depends_on("kokkos ~shared" + _flag, when="+kokkos" + _flag)
depends_on("kokkos" + _flag, when="+kokkos" + _flag)
depends_on("kokkos-kernels" + _flag, when="+kokkos-kernels" + _flag)

depends_on("kokkos+pic", when="+kokkos-kernels")

# specfic specs when using GPU/cuda offloading
# TODO remove +wrapper for clang builds
# TODO version guard +cuda_lambda
depends_on("kokkos +wrapper+cuda_lambda", when="+cuda+kokkos")

# fix for older spacks
if spack.version.Version(spack.spack_version) >= spack.version.Version("0.17"):
depends_on("kokkos-kernels ~shared", when="+kokkos-kernels")
depends_on("kokkos-kernels", when="+kokkos-kernels")

for _flag in list(CudaPackage.cuda_arch_values):
depends_on("kokkos cuda_arch=" + _flag, when="+cuda+kokkos cuda_arch=" + _flag)
Expand Down Expand Up @@ -188,6 +191,7 @@ def cmake_args(self):
self.define_from_variant("SINGULARITY_BUILD_PYTHON", "python"),
self.define_from_variant("SINGULARITY_USE_SPINER", "spiner"),
self.define_from_variant("SINGULARITY_USE_SPINER_WITH_HDF5", "hdf5"),
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
self.define("SINGULARITY_BUILD_TESTS", self.run_tests),
self.define(
"SINGULARITY_BUILD_SESAME2SPINER", "sesame" in self.spec.variants["build_extra"].value
Expand Down Expand Up @@ -222,6 +226,13 @@ def cmake_args(self):
if "+kokkos+cuda" in self.spec:
args.append(self.define("CMAKE_CXX_COMPILER", self.spec["kokkos"].kokkos_cxx))

if "+kokkos" in self.spec:
if "cxxstd" in self.spec["kokkos"].variants:
cxx_std_variant = "cxxstd" # current spack
else:
cxx_std_variant = "std" # older spack
args.append(self.define("CMAKE_CXX_STANDARD", self.spec["kokkos"].variants[cxx_std_variant].value))

return args

def setup_run_environment(self, env):
Expand Down
Loading