-
Notifications
You must be signed in to change notification settings - Fork 20
Reintroduce icon-exclaim to spack-c2sm #1059
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
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
d696153
add wip
huppd dd920ca
wip
huppd a5f10d1
compiling but not linking
huppd c9f6632
wip
huppd 95e1e8a
GitHub Action: Apply Pep8-formatting
invalid-email-address 23950eb
wip configure works
huppd 2218849
wip even compiling
huppd f9dc0e1
GitHub Action: Apply Pep8-formatting
invalid-email-address 995cba3
cleanup
huppd b00a66c
GitHub Action: Apply Pep8-formatting
invalid-email-address 03a233b
fix
huppd 12ca402
cleanup
huppd c602481
add main
huppd 99239a8
GitHub Action: Apply Pep8-formatting
invalid-email-address 77e96a6
use icon-dsl brachn
huppd 702a1ca
add dependencies of icon4py
huppd 5c08c1a
GitHub Action: Apply Pep8-formatting
invalid-email-address c8ebea8
rename icon-dsl
huppd 71a5dd5
add time stamp check
huppd 4329a8f
GitHub Action: Apply Pep8-formatting
invalid-email-address 07cd567
rm versions 0.2, 0.3
huppd 03fd365
copy everytime
huppd 7db459d
rm depcracted options
huppd 81fb28b
GitHub Action: Apply Pep8-formatting
invalid-email-address 05b3992
refactor uv package
huppd 72f9338
GitHub Action: Apply Pep8-formatting
invalid-email-address 19ad9ee
add one more platform
huppd 9e2256a
add doc string
huppd 200d6ef
Merge branch 'add_icon4py' of https://github.com/C2SM/spack-c2sm into…
huppd 2c54c59
Merge remote-tracking branch 'origin/main' into add_icon4py
huppd b8cb3d7
improve icon4py
huppd 586fa84
make icon-exclaim more solid
huppd 52fd06e
GitHub Action: Apply Pep8-formatting
invalid-email-address b11ab94
fix uv info
huppd 3a16a2d
update uv
huppd ca24074
GitHub Action: Apply Pep8-formatting
invalid-email-address 223dfc5
cleanup icon4py
huppd 3105070
GitHub Action: Apply Pep8-formatting
invalid-email-address e557d0c
switch to jenkins
huppd 33e6b2f
revert ew
huppd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| from spack.package import * | ||
|
|
||
|
|
||
| class Ghex(CMakePackage, CudaPackage, ROCmPackage): | ||
| """ | ||
| GHEX is a generic halo-exchange library. | ||
|
|
||
| This Spack package was originally copied from: | ||
| https://github.com/ghex-org/spack-repos/blob/main/packages/ghex/package.py | ||
|
|
||
| License: ghex-org | ||
| """ | ||
|
|
||
| homepage = "https://github.com/ghex-org/GHEX" | ||
| url = "https://github.com/ghex-org/GHEX/archive/refs/tags/v0.3.0.tar.gz" | ||
| git = "https://github.com/ghex-org/GHEX.git" | ||
| maintainers = ["boeschf"] | ||
|
|
||
| version("0.4.1", tag="v0.4.1", submodules=True) | ||
| version("0.4.0", tag="v0.4.0", submodules=True) | ||
| version("0.3.0", tag="v0.3.0", submodules=True) | ||
| version("master", branch="master", submodules=True) | ||
|
|
||
| depends_on("cxx", type="build") | ||
|
|
||
| generator("ninja") | ||
|
|
||
| backends = ("mpi", "ucx", "libfabric") | ||
| variant( | ||
| "backend", | ||
| default="mpi", | ||
| description="Transport backend", | ||
| values=backends, | ||
| multi=False, | ||
| ) | ||
| variant("xpmem", default=False, description="Use xpmem shared memory") | ||
| variant("python", default=True, description="Build Python bindings") | ||
|
|
||
| depends_on("[email protected]:", type="build") | ||
| depends_on("mpi") | ||
| depends_on("boost") | ||
| depends_on("xpmem", when="+xpmem", type=("build", "run")) | ||
|
|
||
| depends_on("oomph") | ||
| for backend in backends: | ||
| depends_on(f"oomph backend={backend}", when=f"backend={backend}") | ||
| depends_on("oomph+cuda", when="+cuda") | ||
| depends_on("oomph+rocm", when="+rocm") | ||
| depends_on("[email protected]:", when="@0.3:") | ||
|
|
||
| conflicts("+cuda+rocm") | ||
|
|
||
| with when("+python"): | ||
| extends("python") | ||
| depends_on("[email protected]:", type="build") | ||
| depends_on("py-pip", type="build") | ||
| depends_on("py-pybind11", type="build") | ||
| depends_on("py-mpi4py", type=("build", "run")) | ||
| depends_on("py-numpy", type=("build", "run")) | ||
|
|
||
| depends_on("py-pytest", when="+python", type=("test")) | ||
|
|
||
| def cmake_args(self): | ||
| spec = self.spec | ||
|
|
||
| args = [ | ||
| self.define("GHEX_USE_BUNDLED_LIBS", True), | ||
| self.define("GHEX_USE_BUNDLED_GRIDTOOLS", True), | ||
| self.define("GHEX_USE_BUNDLED_GTEST", self.run_tests), | ||
| self.define("GHEX_USE_BUNDLED_OOMPH", False), | ||
| self.define("GHEX_TRANSPORT_BACKEND", | ||
| spec.variants["backend"].value.upper()), | ||
| self.define_from_variant("GHEX_USE_XPMEM", "xpmem"), | ||
| self.define_from_variant("GHEX_BUILD_PYTHON_BINDINGS", "python"), | ||
| self.define("GHEX_WITH_TESTING", self.run_tests), | ||
| ] | ||
|
|
||
| if spec.satisfies("+python"): | ||
| args.append(self.define("GHEX_PYTHON_LIB_PATH", python_platlib)) | ||
|
|
||
| if self.run_tests and spec.satisfies("^openmpi"): | ||
| args.append(self.define("MPIEXEC_PREFLAGS", "--oversubscribe")) | ||
|
|
||
| if "+cuda" in spec and spec.variants["cuda_arch"].value != "none": | ||
| arch_str = ";".join(spec.variants["cuda_arch"].value) | ||
| args.append(self.define("CMAKE_CUDA_ARCHITECTURES", arch_str)) | ||
| args.append(self.define("GHEX_USE_GPU", True)) | ||
| args.append(self.define("GHEX_GPU_TYPE", "NVIDIA")) | ||
|
|
||
| if "+rocm" in spec and spec.variants["amdgpu_target"].value != "none": | ||
| arch_str = ";".join(spec.variants["amdgpu_target"].value) | ||
| args.append(self.define("CMAKE_HIP_ARCHITECTURES", arch_str)) | ||
| args.append(self.define("GHEX_USE_GPU", True)) | ||
| args.append(self.define("GHEX_GPU_TYPE", "AMD")) | ||
|
|
||
| if spec.satisfies("~cuda~rocm"): | ||
| args.append(self.define("GHEX_USE_GPU", False)) | ||
|
|
||
| return args |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| index d5420e0..35dbe56 100644 | ||
| --- a/CMakeLists.txt | ||
| +++ b/CMakeLists.txt | ||
| @@ -105,11 +105,11 @@ install(FILES ${PROJECT_BINARY_DIR}/include/hwmalloc/config.hpp | ||
| install(EXPORT HWMALLOC-targets | ||
| FILE HWMALLOC-targets.cmake | ||
| NAMESPACE HWMALLOC:: | ||
| - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake) | ||
| + DESTINATION ${CMAKE_INSTALL_LIBDIR}/hwmalloc/cmake) | ||
|
|
||
| configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/HWMALLOCConfig.cmake.in | ||
| ${CMAKE_CURRENT_BINARY_DIR}/HWMALLOCConfig.cmake | ||
| - INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake) | ||
| + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/hwmalloc/cmake) | ||
|
|
||
| write_basic_package_version_file(HWMALLOCConfigVersion.cmake | ||
| VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion) | ||
| @@ -120,7 +120,7 @@ install( | ||
| ${CMAKE_CURRENT_BINARY_DIR}/HWMALLOCConfigVersion.cmake | ||
| ${CMAKE_CURRENT_LIST_DIR}/cmake/FindNUMA.cmake | ||
| DESTINATION | ||
| - ${CMAKE_INSTALL_LIBDIR}/cmake) | ||
| + ${CMAKE_INSTALL_LIBDIR}/hwmalloc/cmake) | ||
|
|
||
| export(EXPORT HWMALLOC-targets | ||
| FILE "${CMAKE_CURRENT_BINARY_DIR}/HWMALLOC-targets.cmake") | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| from spack.package import * | ||
|
|
||
|
|
||
| class Hwmalloc(CMakePackage, CudaPackage, ROCmPackage): | ||
| """ | ||
| HWMALLOC is a allocator which supports memory registration for e.g. remote memory access | ||
|
|
||
| This Spack package was originally copied from: | ||
| https://github.com/ghex-org/spack-repos/blob/main/packages/hwmalloc/package.py | ||
|
|
||
| License: ghex-org | ||
| """ | ||
|
|
||
| homepage = "https://github.com/ghex-org/hwmalloc" | ||
| url = "https://github.com/ghex-org/hwmalloc/archive/refs/tags/v0.3.0.tar.gz" | ||
| git = "https://github.com/ghex-org/hwmalloc.git" | ||
| maintainers = ["boeschf"] | ||
|
|
||
| version("0.3.0", | ||
| sha256= | ||
| "d4d4ac6087a806600d79fb62c02719ca3d58a412968fe1ef4a2fd58d9e7ee950") | ||
| version("0.2.0", | ||
| sha256= | ||
| "734758a390a3258b86307e4aef50a7ca2e5d0e2e579f18aeefcd05397e114419") | ||
| version("0.1.0", | ||
| sha256= | ||
| "06e9bfcef0ecce4d19531ccbe03592b502d1281c7a092bc0ff51ca187899b21c") | ||
| version("master", branch="master") | ||
|
|
||
| depends_on("cxx", type="build") | ||
|
|
||
| generator("ninja") | ||
|
|
||
| depends_on("numactl", type=("build", "run")) | ||
| depends_on("boost", type=("build")) | ||
| depends_on("[email protected]:", type="build") | ||
|
|
||
| variant( | ||
| "numa-throws", | ||
| default=False, | ||
| description="True if numa_tools may throw during initialization", | ||
| ) | ||
| variant("numa-local", | ||
| default=True, | ||
| description="Use numa_tools for local node allocations") | ||
| variant("logging", default=False, description="print logging info to cerr") | ||
|
|
||
| patch("cmake_install_path.patch", when="@:0.3.0", level=1) | ||
|
|
||
| def cmake_args(self): | ||
| args = [ | ||
| self.define_from_variant("HWMALLOC_NUMA_THROWS", "numa-throws"), | ||
| self.define_from_variant("HWMALLOC_NUMA_FOR_LOCAL", "numa-local"), | ||
| self.define_from_variant("HWMALLOC_ENABLE_LOGGING", "logging"), | ||
| self.define("HWMALLOC_WITH_TESTING", self.run_tests), | ||
| ] | ||
|
|
||
| if "+cuda" in self.spec: | ||
| args.append(self.define("HWMALLOC_ENABLE_DEVICE", True)) | ||
| args.append(self.define("HWMALLOC_DEVICE_RUNTIME", "cuda")) | ||
| elif "+rocm" in self.spec: | ||
| args.append(self.define("HWMALLOC_ENABLE_DEVICE", True)) | ||
| args.append(self.define("HWMALLOC_DEVICE_RUNTIME", "hip")) | ||
| else: | ||
| args.append(self.define("HWMALLOC_ENABLE_DEVICE", False)) | ||
|
|
||
| return args |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| from spack.pkg.c2sm.icon import Icon | ||
| import shutil | ||
| import os | ||
| import re | ||
| from collections import defaultdict | ||
| import spack.error as error | ||
|
|
||
|
|
||
| def validate_variant_dsl(pkg, name, value): | ||
| set_mutual_excl = set(['substitute', 'verify', 'serialize']) | ||
msimberg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| set_input_var = set(value) | ||
| if len(set_mutual_excl.intersection(set_input_var)) > 1: | ||
| raise error.SpecError( | ||
| 'Cannot have more than one of (substitute, verify, serialize) in the same build' | ||
| ) | ||
|
|
||
|
|
||
| class IconExclaim(Icon): | ||
| git = '[email protected]:C2SM/icon-exclaim.git' | ||
|
|
||
| maintainers('jonasjucker', 'huppd') | ||
|
|
||
| version('develop', branch='icon-dsl', submodules=True) | ||
|
|
||
| # EXCLAIM-GT4Py specific features: | ||
| dsl_values = ('substitute', 'verify') | ||
| variant('dsl', | ||
| default='none', | ||
| validator=validate_variant_dsl, | ||
| values=('none', ) + dsl_values, | ||
| description='Build with GT4Py dynamical core', | ||
| multi=True) | ||
|
|
||
| for x in dsl_values: | ||
| depends_on('icon4py', type="build", when=f"dsl={x}") | ||
|
|
||
| def configure_args(self): | ||
| raw_args = super().configure_args() | ||
|
|
||
| # Split into categories | ||
| args_flags = [] | ||
| icon_ldflags = [] | ||
| ldflags = [] | ||
| libs = [] | ||
|
|
||
| for a in raw_args: | ||
| if a.startswith("LIBS="): | ||
| libs.append(a.split("=", 1)[1].strip()) | ||
| elif a.startswith("ICON_LDFLAGS="): | ||
| icon_ldflags.append(a.split("=", 1)[1].strip()) | ||
| elif a.startswith("LDFLAGS="): | ||
| ldflags.append(a.split("=", 1)[1].strip()) | ||
| else: | ||
| args_flags.append(a) | ||
|
|
||
| # Handle DSL variants | ||
| dsl = self.spec.variants['dsl'].value | ||
| if dsl != ('none', ): | ||
| if 'substitute' in dsl: | ||
| args_flags.append('--enable-py2f=substitute') | ||
| elif 'verify' in dsl: | ||
| args_flags.append('--enable-py2f=verify') | ||
| else: | ||
| raise ValueError( | ||
| f"Unknown DSL variant '{dsl}'. " | ||
| f"Valid options are: {', '.join(('none',) + dsl_values)}") | ||
|
|
||
| # Add icon4py paths and libs | ||
| icon4py_prefix = self.spec["icon4py"].prefix | ||
| bindings_dir = os.path.join(icon4py_prefix, "src") | ||
|
|
||
| ldflags.append(f"-L{bindings_dir} -Wl,-rpath,{bindings_dir}") | ||
| libs.append("-licon4py_bindings") | ||
|
|
||
| # Remove duplicates | ||
| icon_ldflags = list(dict.fromkeys(icon_ldflags)) | ||
| ldflags = list(dict.fromkeys(ldflags)) | ||
| libs = list(dict.fromkeys(libs)) | ||
|
|
||
| # Reconstruct final configure args | ||
| final_args = args_flags | ||
| if icon_ldflags: | ||
| final_args.append("ICON_LDFLAGS=" + " ".join(icon_ldflags)) | ||
| if ldflags: | ||
| final_args.append("LDFLAGS=" + " ".join(ldflags)) | ||
| if libs: | ||
| final_args.append("LIBS=" + " ".join(libs)) | ||
|
|
||
| return final_args | ||
|
|
||
| def build(self, spec, prefix): | ||
| # Check the variant | ||
| dsl = self.spec.variants['dsl'].value | ||
| if dsl != ('none', ): | ||
| file = "icon4py_bindings.f90" | ||
|
|
||
| bindings_dir = os.path.join(self.spec["icon4py"].prefix, "src") | ||
| src_file = os.path.join(bindings_dir, file) | ||
|
|
||
| build_py2f_dir = os.path.join(self.stage.source_path, "src", | ||
| "build_py2f") | ||
| os.makedirs(build_py2f_dir, exist_ok=True) | ||
| dest_file = os.path.join(build_py2f_dir, file) | ||
|
|
||
| shutil.copy2(src_file, dest_file) | ||
| print( | ||
| f"Copied {src_file} to build directory {dest_file} because +dsl is enabled" | ||
| ) | ||
|
|
||
| # Proceed with the normal build | ||
| super().build(spec, prefix) | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.