From 02dd90ebf9f42b5f9e100f3efd621efcf7e3e723 Mon Sep 17 00:00:00 2001 From: Julius-Plehn Date: Fri, 10 Jul 2020 15:22:20 +0200 Subject: [PATCH] New Package: ChaNGa (#17442) * WIP: changa package * changa cleanup * flake8 format * adds master branch to ChaNGa * positional arguments * use install instead of copy --- .../packages/changa/fix_configure_path.patch | 13 ++++++ .../repos/builtin/packages/changa/package.py | 46 +++++++++++++++++++ .../repos/builtin/packages/charmpp/package.py | 4 +- 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 var/spack/repos/builtin/packages/changa/fix_configure_path.patch create mode 100644 var/spack/repos/builtin/packages/changa/package.py diff --git a/var/spack/repos/builtin/packages/changa/fix_configure_path.patch b/var/spack/repos/builtin/packages/changa/fix_configure_path.patch new file mode 100644 index 0000000000..f986927209 --- /dev/null +++ b/var/spack/repos/builtin/packages/changa/fix_configure_path.patch @@ -0,0 +1,13 @@ +diff --git a/configure b/configure +index 04f1a59..602c6cc 100755 +--- a/configure ++++ b/configure +@@ -2434,7 +2434,7 @@ if test $($CHARMC -V | awk '{print $3}') -lt $MINIMUM_CHARM_VERSION; then + fi + + CHARM_PATH=${CHARMC%/bin/charmc} +-CONV_CONFIG=${CHARM_PATH}/tmp/conv-config.sh ++CONV_CONFIG=${CHARM_PATH}/include/conv-config.sh + CHARMINC=${CHARM_PATH}/include + + . ${CONV_CONFIG} diff --git a/var/spack/repos/builtin/packages/changa/package.py b/var/spack/repos/builtin/packages/changa/package.py new file mode 100644 index 0000000000..a6adb48c38 --- /dev/null +++ b/var/spack/repos/builtin/packages/changa/package.py @@ -0,0 +1,46 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Changa(AutotoolsPackage): + """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.""" + + homepage = "http://faculty.washington.edu/trq/hpcc/tools/changa.html" + url = "https://github.com/N-BodyShop/changa/archive/v3.4.tar.gz" + git = "https://github.com/N-BodyShop/changa.git" + + version('master', branch='master') + version('3.4', sha256='c2bceb6ac00025dfd704bb6960bc17c6df7c746872185845d1e75f47e6ce2a94') + patch("fix_configure_path.patch") + + resource( + name="utility", + url="https://github.com/N-BodyShop/utility/archive/v3.4.tar.gz", + sha256="19f9f09023ce9d642e848a36948788fb29cd7deb8e9346cdaac4c945f1416667", + placement="utility" + ) + + depends_on("charmpp build-target=ChaNGa") + + def configure_args(self): + args = [] + args.append("STRUCT_DIR={0}/utility/structures" + .format(self.stage.source_path)) + return args + + def install(self, spec, prefix): + with working_dir(self.build_directory): + mkdirp(prefix.bin) + install('ChaNGa', prefix.bin) + install('charmrun', prefix.bin) diff --git a/var/spack/repos/builtin/packages/charmpp/package.py b/var/spack/repos/builtin/packages/charmpp/package.py index a6c60ef11d..67fe034368 100644 --- a/var/spack/repos/builtin/packages/charmpp/package.py +++ b/var/spack/repos/builtin/packages/charmpp/package.py @@ -52,7 +52,7 @@ class Charmpp(Package): "build-target", default="LIBS", # AMPI also builds charm++, LIBS also builds AMPI and charm++ - values=("charm++", "AMPI", "LIBS"), + values=("charm++", "AMPI", "LIBS", "ChaNGa"), description="Specify the target to build" ) @@ -217,7 +217,7 @@ def install(self, spec, prefix): present on the system") target = spec.variants["build-target"].value - builddir = prefix + "/" + str(self.charmarch) + builddir = prefix # We assume that Spack's compiler wrappers make this work. If # not, then we need to query the compiler vendor from Spack