Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d696153
add wip
huppd Aug 29, 2025
dd920ca
wip
huppd Sep 5, 2025
a5f10d1
compiling but not linking
huppd Sep 9, 2025
c9f6632
wip
huppd Sep 29, 2025
95e1e8a
GitHub Action: Apply Pep8-formatting
invalid-email-address Sep 29, 2025
23950eb
wip configure works
huppd Sep 29, 2025
2218849
wip even compiling
huppd Sep 29, 2025
f9dc0e1
GitHub Action: Apply Pep8-formatting
invalid-email-address Sep 29, 2025
995cba3
cleanup
huppd Sep 30, 2025
b00a66c
GitHub Action: Apply Pep8-formatting
invalid-email-address Sep 30, 2025
03a233b
fix
huppd Sep 30, 2025
12ca402
cleanup
huppd Sep 30, 2025
c602481
add main
huppd Oct 16, 2025
99239a8
GitHub Action: Apply Pep8-formatting
invalid-email-address Oct 16, 2025
77e96a6
use icon-dsl brachn
huppd Oct 17, 2025
702a1ca
add dependencies of icon4py
huppd Oct 17, 2025
5c08c1a
GitHub Action: Apply Pep8-formatting
invalid-email-address Oct 17, 2025
c8ebea8
rename icon-dsl
huppd Oct 20, 2025
71a5dd5
add time stamp check
huppd Oct 22, 2025
4329a8f
GitHub Action: Apply Pep8-formatting
invalid-email-address Oct 22, 2025
07cd567
rm versions 0.2, 0.3
huppd Oct 31, 2025
03fd365
copy everytime
huppd Oct 31, 2025
7db459d
rm depcracted options
huppd Oct 31, 2025
81fb28b
GitHub Action: Apply Pep8-formatting
invalid-email-address Oct 31, 2025
05b3992
refactor uv package
huppd Oct 31, 2025
72f9338
GitHub Action: Apply Pep8-formatting
invalid-email-address Oct 31, 2025
19ad9ee
add one more platform
huppd Oct 31, 2025
9e2256a
add doc string
huppd Oct 31, 2025
200d6ef
Merge branch 'add_icon4py' of https://github.com/C2SM/spack-c2sm into…
huppd Oct 31, 2025
2c54c59
Merge remote-tracking branch 'origin/main' into add_icon4py
huppd Oct 31, 2025
b8cb3d7
improve icon4py
huppd Nov 4, 2025
586fa84
make icon-exclaim more solid
huppd Nov 5, 2025
52fd06e
GitHub Action: Apply Pep8-formatting
invalid-email-address Nov 5, 2025
b11ab94
fix uv info
huppd Nov 5, 2025
3a16a2d
update uv
huppd Nov 5, 2025
ca24074
GitHub Action: Apply Pep8-formatting
invalid-email-address Nov 5, 2025
223dfc5
cleanup icon4py
huppd Nov 6, 2025
3105070
GitHub Action: Apply Pep8-formatting
invalid-email-address Nov 6, 2025
e557d0c
switch to jenkins
huppd Nov 18, 2025
33e6b2f
revert ew
huppd Nov 20, 2025
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
99 changes: 99 additions & 0 deletions repos/c2sm/packages/ghex/package.py
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
27 changes: 27 additions & 0 deletions repos/c2sm/packages/hwmalloc/cmake_install_path.patch
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")
67 changes: 67 additions & 0 deletions repos/c2sm/packages/hwmalloc/package.py
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
111 changes: 111 additions & 0 deletions repos/c2sm/packages/icon-exclaim/package.py
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'])
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)
4 changes: 0 additions & 4 deletions repos/c2sm/packages/icon/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,6 @@ def configure_args(self):
'You use variant extra-config-args. Injecting non-variant configure arguments may potentially disrupt the build process!'
)

# Finalize the LIBS variable (we always put the real collected
# libraries to the front):
flags['LIBS'].insert(0, libs.link_flags)

# Help the libtool scripts of the bundled libraries find the correct
# paths to the external libraries. Specify the library search (-L) flags
# in the reversed order
Expand Down
Loading