-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #291 from lanl/mauneyc/fix-package-depends
Updates to package.py
- Loading branch information
Showing
4 changed files
with
36 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,8 +58,12 @@ class SingularityEos(CMakePackage, CudaPackage): | |
# configuration | ||
variant("hdf5", default=False, description="Use hdf5") | ||
|
||
variant("spiner", default=True, description="Use Spiner") | ||
|
||
variant("closure", default=True, description="Build closure module") | ||
|
||
# building/testing/docs | ||
depends_on("cmake@3.14:") | ||
depends_on("cmake@3.19:") | ||
depends_on("[email protected]", when="+tests") | ||
depends_on("python@3:", when="+python") | ||
depends_on("py-numpy", when="+python+tests") | ||
|
@@ -73,18 +77,18 @@ class SingularityEos(CMakePackage, CudaPackage): | |
# eospac when asked for | ||
depends_on("eospac", when="+eospac") | ||
|
||
depends_on("[email protected]:", when="@:1.7.0") | ||
depends_on("[email protected].1:", when="@1.7.1:") | ||
depends_on("[email protected],1.5.2:", when="@:1.7.0") | ||
depends_on("[email protected].2:", when="@1.7.1:") | ||
# request HEAD of main branch | ||
depends_on("ports-of-call@main", when="@main") | ||
|
||
depends_on("spiner +kokkos", when="+kokkos") | ||
depends_on("spiner +kokkos", when="+kokkos+spiner") | ||
# tell spiner to use HDF5 | ||
depends_on("spiner +hdf5", when="+hdf5") | ||
depends_on("spiner +hdf5", when="+hdf5+spiner") | ||
|
||
depends_on("spiner@:1.6.0", when="@:1.7.0") | ||
depends_on("[email protected]:", when="@1.7.1:") #TODO version | ||
depends_on("spiner@main", when="@main") | ||
depends_on("spiner@:1.6.0", when="@:1.7.0 +spiner") | ||
depends_on("[email protected]:", when="@1.7.1: +spiner") #TODO version | ||
depends_on("spiner@main", when="@main +spiner") | ||
|
||
depends_on("mpark-variant") | ||
depends_on( | ||
|
@@ -96,9 +100,11 @@ class SingularityEos(CMakePackage, CudaPackage): | |
when="+cuda", | ||
) | ||
|
||
|
||
#TODO: do we need kokkos,kokkoskernels the exact same version? | ||
for _myver,_kver in zip(("@:1.6.2","@1.7.0:"),("@3.2:","@3.3:")): | ||
depends_on("kokkos" + _kver, when=_myver) | ||
depends_on("kokkos-kernels" + _kver, when=_myver) | ||
depends_on("kokkos" + _kver, when=_myver + '+kokkos') | ||
depends_on("kokkos-kernels" + _kver, when=_myver + '+kokkos-kernels') | ||
|
||
# set up kokkos offloading dependencies | ||
for _flag in ("~cuda", "+cuda", "~openmp", "+openmp"): | ||
|
@@ -107,8 +113,9 @@ class SingularityEos(CMakePackage, CudaPackage): | |
depends_on("spiner" + _flag, when="+kokkos" + _flag) | ||
|
||
# specfic specs when using GPU/cuda offloading | ||
# TODO Do we need `+aggressive_vectorization`, `+cuda_constexpr`, `~compiler_warnings` ? | ||
depends_on("kokkos +wrapper+cuda_lambda+cuda_relocatable_device_code", when="+cuda+kokkos") | ||
# 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"): | ||
|
@@ -127,6 +134,10 @@ class SingularityEos(CMakePackage, CudaPackage): | |
conflicts("+cuda", when="~kokkos") | ||
conflicts("+openmp", when="~kokkos") | ||
conflicts("+kokkos-kernels", when="~kokkos") | ||
conflicts("+hdf5", when="~spiner") | ||
|
||
# TODO: @dholliday remove when sg_get_eos not singularity | ||
conflicts("+fortran", when="~closure") | ||
|
||
# NOTE: these are set so that dependencies in downstream projects share | ||
# common MPI dependence | ||
|
@@ -144,9 +155,9 @@ def cmake_args(self): | |
self.define_from_variant("SINGULARITY_USE_KOKKOS", "kokkos"), | ||
self.define_from_variant("SINGULARITY_USE_KOKKOSKERNELS", "kokkos-kernels"), | ||
self.define_from_variant("SINGULARITY_USE_FORTRAN", "fortran"), | ||
self.define_from_variant("SINGULARITY_BUILD_CLOSURE", "fortran"), | ||
self.define_from_variant("SINGULARITY_BUILD_CLOSURE", "closure"), | ||
self.define_from_variant("SINGULARITY_BUILD_PYTHON", "python"), | ||
self.define_from_variant("SINGULARITY_USE_SPINER", "hdf5"), | ||
self.define_from_variant("SINGULARITY_USE_SPINER", "spiner"), | ||
self.define_from_variant("SINGULARITY_USE_SPINER_WITH_HDF5", "hdf5"), | ||
self.define("SINGULARITY_BUILD_TESTS", self.run_tests), | ||
self.define( | ||
|
@@ -165,46 +176,18 @@ def cmake_args(self): | |
("stellarcollapse" in self.spec.variants["build_extra"].value and self.run_tests), | ||
), | ||
self.define("SINGULARITY_TEST_PYTHON", ("+python" in self.spec and self.run_tests)), | ||
# TODO: guard for older versions, remove for new versions(1.7<) | ||
self.define("SINGULARITY_USE_HDF5", "^hdf5" in self.spec), | ||
self.define("SINGULARITY_USE_EOSPAC", "^eospac" in self.spec), | ||
] | ||
|
||
#TODO: do we need this? | ||
if "+kokkos+cuda" in self.spec: | ||
args.append(self.define("CMAKE_CXX_COMPILER", self.spec["kokkos"].kokkos_cxx)) | ||
|
||
return args | ||
|
||
# TODO everything past here may not be needed, | ||
# except the pythonpath setting | ||
# | ||
# specify the name of the auto-generated cmake cache config | ||
@property | ||
def cmake_config_fname(self): | ||
return "singularity-eos_spackconfig.cmake" | ||
|
||
# generate the pre-configured cmake cache file that reflects the spec options | ||
# NOTE: this file isn't replaced if the same spec is already installed - | ||
# you may need to uninstall the old spec first | ||
@run_after("cmake") | ||
def generate_cmake_configuration(self): | ||
config_fname = self.cmake_config_fname | ||
cmake_config = self.cmake_args() | ||
|
||
with working_dir("cmake-gen", create=True): | ||
with open(config_fname, "w") as cmc: | ||
for arg in cmake_config: | ||
kt, v = arg.replace("-D", "").split("=") | ||
k, t = kt.split(":") | ||
cmc.write('set({} "{}" CACHE {} "" FORCE)\n'.format(k, v, t)) | ||
install(config_fname, join_path(prefix, config_fname)) | ||
|
||
# run when loaded | ||
# NOTE: to use: | ||
# cmake -C $SINGULARITY_SPACK_CMAKE_CONFIG ... | ||
def setup_run_environment(self, env): | ||
env.set( | ||
"SINGULARITY_SPACK_CMAKE_CONFIG", os.path.join(self.prefix, self.cmake_config_fname) | ||
) | ||
if os.path.isdir(self.prefix.lib64): | ||
lib_dir = self.prefix.lib64 | ||
else: | ||
|