Skip to content

Commit

Permalink
Merge pull request #86 from lanl/rberger_spackage_loosen_constraints
Browse files Browse the repository at this point in the history
spack: remove openmp and cuda variants
  • Loading branch information
Yurlungur authored Feb 23, 2024
2 parents 87a4869 + ff3b15a commit cc089cc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 33 deletions.
26 changes: 11 additions & 15 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,19 @@ before_script:
- |
if [[ ${CI_JOB_NAME} =~ "a100" ]];
then
export SPINER_SPACK_SPEC="${SPINER_SPACK_SPEC}+hdf5+mpi+kokkos+cuda cuda_arch=80";
export SPINER_SPACK_SPEC="${SPINER_SPACK_SPEC}+hdf5+mpi+kokkos ^kokkos+wrapper+cuda cuda_arch=80";
fi
- |
if [[ "${CI_COMMIT_BRANCH}" == "${CI_DEFAULT_BRANCH}" ]];
then
section start "spack_build[collapsed=true]" "Building via Spack"
mkdir -p spack_build_env
spack env create -d spack_build_env
spack env activate -d spack_build_env
spack repo add spack-repo
spack repo list
spack config add upstreams:default:install_tree:${SPINER_SPACK_DIR}/opt/spack/
spack dev-build -j $(nproc) ${SPINER_SPACK_SPEC}
spack env deactivate
section end spack_build
fi
section start "spack_build[collapsed=true]" "Building via Spack"
mkdir -p spack_build_env
spack env create -d spack_build_env
spack env activate -d spack_build_env
spack repo add spack-repo
spack repo list
spack config add upstreams:default:install_tree:${SPINER_SPACK_DIR}/opt/spack/
spack dev-build -q -j $(nproc) ${SPINER_SPACK_SPEC}
spack env deactivate
section end spack_build
- section start "spack_env[collapsed=true]" "Creating Spack environment"
- mkdir -p spack_env
- spack env create -d spack_env
Expand All @@ -124,7 +121,6 @@ before_script:
-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/install \
-DSPINER_USE_HDF=ON \
-DSPINER_TEST_USE_KOKKOS=$([[ ${CI_JOB_NAME} =~ "a100" ]] && echo ON || echo OFF) \
-DSPINER_TEST_USE_KOKKOS_CUDA=$([[ ${CI_JOB_NAME} =~ "a100" ]] && echo ON || echo OFF) \
-DCMAKE_CXX_COMPILER=$([[ ${CI_JOB_NAME} =~ "a100" ]] && echo nvcc_wrapper || g++) \
..
- make -j $(nproc)
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ option(SPINER_BUILD_TESTS "Compile Tests" OFF)
cmake_dependent_option(SPINER_TEST_USE_KOKKOS "Use kokkos offloading for tests"
ON "SPINER_BUILD_TESTS" OFF)
cmake_dependent_option(
SPINER_TEST_USE_KOKKOS_CUDA "Use kokkos cuda offloading for tests" ON
SPINER_TEST_USE_KOKKOS_CUDA "Use kokkos cuda offloading for tests (affects submodule-build only)" ON
"SPINER_TEST_USE_KOKKOS" ON)

# CTest
Expand Down
21 changes: 5 additions & 16 deletions spack-repo/packages/spiner/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from spack.package import *


class Spiner(CMakePackage, CudaPackage):
class Spiner(CMakePackage):
"""Spiner:
Performance portable routines for generic, tabulated, multi-dimensional data"""

Expand Down Expand Up @@ -44,7 +44,6 @@ class Spiner(CMakePackage, CudaPackage):
default=False,
description="Enable kokkos",
)
variant("openmp", default=False, description="Enable openmp kokkos backend")

variant("hdf5", default=False, description="Enable hdf5")
variant("mpi", default=False, description="Support parallel hdf5")
Expand All @@ -64,13 +63,9 @@ class Spiner(CMakePackage, CudaPackage):
# Currently the raw cuda backend of ports-of-call is not supported.
depends_on("ports-of-call portability_strategy=Kokkos", when="@:1.5.1 +kokkos")
depends_on("ports-of-call portability_strategy=None", when="@:1.5.1 ~kokkos")
for _flag in list(CudaPackage.cuda_arch_values):
depends_on("[email protected]: cuda_arch=" + _flag, when="+cuda+kokkos cuda_arch=" + _flag)
for _flag in ("~cuda", "+cuda", "~openmp", "+openmp"):
depends_on("[email protected]: " + _flag, when="+kokkos" + _flag)
depends_on(
"[email protected]: ~shared+wrapper+cuda_lambda+cuda_constexpr",
when="+cuda+kokkos",
"[email protected]: ~shared+cuda_lambda+cuda_constexpr",
when="+kokkos ^kokkos+cuda",
)

depends_on("hdf5+hl~mpi", when="+hdf5~mpi")
Expand All @@ -81,26 +76,20 @@ class Spiner(CMakePackage, CudaPackage):
depends_on("py-matplotlib", when="+python")

conflicts("+mpi", when="~hdf5")
conflicts("+cuda", when="~kokkos")
conflicts("+openmp", when="~kokkos")
conflicts("cuda_arch=none", when="+cuda", msg="CUDA architecture is required")

def cmake_args(self):
if self.spec.satisfies("@1.6.0:"):
use_kokkos_option = "SPINER_TEST_USE_KOKKOS"
use_cuda_option = "SPINER_TEST_USE_CUDA"
else:
use_kokkos_option = "SPINER_USE_KOKKOS"
use_cuda_option = "SPINER_USE_CUDA"

args = [
self.define("BUILD_TESTING", self.run_tests),
self.define_from_variant(use_kokkos_option, "kokkos"),
self.define_from_variant(use_cuda_option, "cuda"),
self.define_from_variant("SPINER_USE_HDF", "hdf5"),
]
if "+cuda" in self.spec:
if self.spec.satisfies("^kokkos+cuda"):
args.append(
self.define("CMAKE_CUDA_ARCHITECTURES", self.spec.variants["cuda_arch"].value)
self.define("CMAKE_CUDA_ARCHITECTURES", self.spec["kokkos"].variants["cuda_arch"].value)
)
return args
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (SPINER_TEST_USE_KOKKOS)
list(APPEND _spiner_content_opts "Kokkos_ENABLE_CUDA_LAMBDA")
list(APPEND _spiner_content_opts "Kokkos_ENABLE_CUDA_CONSTEXPR")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND _spiner_content_opts "Kokkos_ENABLE_DEBUG")
list(APPEND _spiner_content_opts "Kokkos_ENABLE_DEBUG_BOUNDS_CHECK")
list(APPEND _spiner_content_opts "Kokkos_ENABLE_DEBUG_DUALVIEW_MODIFY_CHECK")
Expand Down

0 comments on commit cc089cc

Please sign in to comment.