summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2024-08-06 11:12:45 +0200
committerGitHub <noreply@github.com>2024-08-06 11:12:45 +0200
commitf438a339782c0e205901c86733de7673414f288f (patch)
treeb76ecf654eb42ed6cd78c0ad3831a2d5c6a8515a /var
parent8ded2ddf5e05c8ccbc0762f77bf0c3f7e34ad8d9 (diff)
downloadspack-f438a339782c0e205901c86733de7673414f288f.tar.gz
spack-f438a339782c0e205901c86733de7673414f288f.tar.bz2
spack-f438a339782c0e205901c86733de7673414f288f.tar.xz
spack-f438a339782c0e205901c86733de7673414f288f.zip
changa: add v3.5 (#45591)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/changa/fix_makefile.patch11
-rw-r--r--var/spack/repos/builtin/packages/changa/package.py45
2 files changed, 44 insertions, 12 deletions
diff --git a/var/spack/repos/builtin/packages/changa/fix_makefile.patch b/var/spack/repos/builtin/packages/changa/fix_makefile.patch
new file mode 100644
index 0000000000..40235f21bf
--- /dev/null
+++ b/var/spack/repos/builtin/packages/changa/fix_makefile.patch
@@ -0,0 +1,11 @@
+--- a/Makefile.in 2024-07-17 19:21:06.292521857 +0200
++++ b/Makefile.in 2024-07-17 19:29:45.896742764 +0200
+@@ -236,7 +236,7 @@
+ $(compile-c)
+
+ $(build_dir)/cha_commitid.c: force
+- $(quiet) VER=`cd $(source_dir) && git describe --long --always` && \
++ $(quiet) VER="3.5" && \
+ echo "const char * const Cha_CommitID = \"$$VER\";" > $(build_dir)/cha_commitid.c
+
+ $(ci_files): $(build_dir)/settings
diff --git a/var/spack/repos/builtin/packages/changa/package.py b/var/spack/repos/builtin/packages/changa/package.py
index ac44bc2a93..f3cce60c0b 100644
--- a/var/spack/repos/builtin/packages/changa/package.py
+++ b/var/spack/repos/builtin/packages/changa/package.py
@@ -6,15 +6,10 @@
from spack.package import *
-class Changa(AutotoolsPackage):
+class Changa(AutotoolsPackage, CudaPackage):
"""ChaNGa (Charm N-body GrAvity solver) is a code to perform collisionless
- N-body simulations. It can perform cosmological simulations with periodic
- boundary conditions in comoving coordinates or simulations of isolated
- stellar systems. It also can include hydrodynamics using the Smooth
- Particle Hydrodynamics (SPH) technique. It uses a Barnes-Hut tree to
- calculate gravity, with hexadecapole expansion of nodes and
- Ewald summation for periodic forces. Timestepping is done with a leapfrog
- integrator with individual timesteps for each particle."""
+ N-body simulations.
+ """
homepage = "https://faculty.washington.edu/trq/hpcc/tools/changa.html"
url = "https://github.com/N-BodyShop/changa/archive/v3.4.tar.gz"
@@ -23,24 +18,50 @@ class Changa(AutotoolsPackage):
license("GPL-2.0-or-later")
version("master", branch="master")
+ version("3.5", sha256="8c49ab5b540a8adb23d3eaa80942621e5ac83244918e66c87886c9d3fb463d39")
version("3.4", sha256="c2bceb6ac00025dfd704bb6960bc17c6df7c746872185845d1e75f47e6ce2a94")
- depends_on("c", type="build") # generated
- depends_on("cxx", type="build") # generated
+ depends_on("c", type="build")
+ depends_on("cxx", type="build")
+
patch("fix_configure_path.patch")
+ # Version 3.5 assumes to have a git repository available to compute the current version
+ # using `git describe ...` Since we are installing from the release tarball, hardcode
+ # the version to 3.5
+ patch("fix_makefile.patch", when="@3.5")
resource(
name="utility",
url="https://github.com/N-BodyShop/utility/archive/v3.4.tar.gz",
sha256="19f9f09023ce9d642e848a36948788fb29cd7deb8e9346cdaac4c945f1416667",
placement="utility",
+ when="@3.4",
+ )
+
+ resource(
+ name="utility",
+ git="https://github.com/N-BodyShop/utility.git",
+ commit="f947639f78162a68d697195e6963328f2665bf44",
+ placement="utility",
+ when="@3.5",
)
depends_on("charmpp build-target=ChaNGa")
+ depends_on("charmpp +cuda", when="+cuda")
+ depends_on("libjpeg")
+ depends_on("zlib-api")
+
+ parallel = False
+
+ def setup_build_environment(self, env):
+ env.set("CHARM_DIR", self.spec["charmpp"].prefix)
def configure_args(self):
- args = []
- args.append("STRUCT_DIR={0}/utility/structures".format(self.stage.source_path))
+ args = [f"STRUCT_DIR={self.stage.source_path}/utility/structures"]
+ if "avx" in self.spec.target:
+ args.append("--enable-arch=avx")
+ if self.spec.satisfies("+cuda"):
+ args.append(f"--with-cuda={self.spec['cuda'].prefix}")
return args
def install(self, spec, prefix):