From 23f16041cdff676166e3820ab84a9af1bd4912ef Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 3 May 2024 21:13:54 +0300 Subject: [PATCH] NWChem ARMCI-MPI variant and optional TCE builds (#43883) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * WIP NWChem with ARMCI-MPI and TCE optional * rename armci-mpi to armcimpi * add version for git * add ARMCI-MPI support to NWChem package EXTERNAL_ARMCI_PATH needs to be set to the ARMCI-MPI package install prefix. I could not get it from spec["armcimpi"] but it worked to use the dependent build environment method to export a generic environmental variable to use instead. * i suppose i can maintain NWChem as well * check rejects option that dozens of packages use i do not have time to fight with this nonsense Run . share/spack/setup-env.sh ==> Error: armcimpi version 'master' has extra arguments: 'branch' Valid arguments for a url fetcher are: 'url', 'sha256', 'md5', 'sha1', 'sha224', 'sha384', 'sha512', and 'checksum' Error: Process completed with exit code 1. * style * ARMCI-MPI needs depends_on; the rest seems fixed * fix ARMCI selection per review feedback from @zzzoom https://github.com/spack/spack/pull/43883#discussion_r1585014147 * address reviewer feedback from @yizeyi18 https://github.com/spack/spack/pull/43883#discussion_r1587228084 elaborate on what +extratce does, in terms of the NWChem build environment variables, some of which are documented on https://nwchemgit.github.io/TCE.html. * style * Update var/spack/repos/builtin/packages/nwchem/package.py --------- Signed-off-by: Jeff Hammond Co-authored-by: Carlos Bederián <4043375+zzzoom@users.noreply.github.com> --- .../{armci-mpi => armcimpi}/package.py | 7 ++- .../repos/builtin/packages/nwchem/package.py | 44 ++++++++++++++++--- 2 files changed, 44 insertions(+), 7 deletions(-) rename var/spack/repos/builtin/packages/{armci-mpi => armcimpi}/package.py (89%) diff --git a/var/spack/repos/builtin/packages/armci-mpi/package.py b/var/spack/repos/builtin/packages/armcimpi/package.py similarity index 89% rename from var/spack/repos/builtin/packages/armci-mpi/package.py rename to var/spack/repos/builtin/packages/armcimpi/package.py index 461487c8eb..e2126f5de2 100644 --- a/var/spack/repos/builtin/packages/armci-mpi/package.py +++ b/var/spack/repos/builtin/packages/armcimpi/package.py @@ -6,7 +6,7 @@ from spack.package import * -class ArmciMpi(AutotoolsPackage): +class Armcimpi(AutotoolsPackage): """ARMCI-MPI is an implementation of the ARMCI library used by Global Arrays. MPI-3 one-sided communication is used to implement ARMCI. """ @@ -26,6 +26,8 @@ class ArmciMpi(AutotoolsPackage): variant("shared", default=True, description="Builds a shared version of the library") variant("progress", default=False, description="Enable asynchronous progress") + provides("armci") + depends_on("autoconf", type="build") depends_on("automake", type="build") depends_on("libtool", type="build") @@ -41,3 +43,6 @@ def configure_args(self): args.extend(self.enable_or_disable("shared")) args.extend(self.with_or_without("progress")) return args + + def setup_dependent_build_environment(self, env, dependent_spec): + env.set("ARMCIMPI_DIR", self.prefix) diff --git a/var/spack/repos/builtin/packages/nwchem/package.py b/var/spack/repos/builtin/packages/nwchem/package.py index 3e557c75a2..72465aa52d 100644 --- a/var/spack/repos/builtin/packages/nwchem/package.py +++ b/var/spack/repos/builtin/packages/nwchem/package.py @@ -17,6 +17,8 @@ class Nwchem(Package): tags = ["ecp", "ecp-apps"] + maintainers("jeffhammond") + version( "7.2.2", sha256="6b68e9c12eec38c09d92472bdd1ff130b93c1b5e1f65e4702aa7ee36c80e4af7", @@ -34,7 +36,17 @@ class Nwchem(Package): ) variant("openmp", default=False, description="Enables OpenMP support") - variant("mpipr", default=False, description="Enables ARMCI with progress rank") + variant( + "armci", + values=("mpi-ts", "mpi-pr", "armcimpi", "mpi3", "openib", "ofi"), + default="mpi-ts", + description="ARMCI runtime", + ) + variant( + "extratce", + default=False, + description="Enables rarely-used TCE features (CCSDTQ, CCSDTLR, EACCSD, IPCCSD, MRCC)", + ) variant("fftw3", default=False, description="Link against the FFTW library") variant("libxc", default=False, description="Support additional functionals via libxc") variant( @@ -60,6 +72,9 @@ class Nwchem(Package): depends_on("blas") depends_on("lapack") depends_on("mpi") + depends_on("armcimpi", when="armci=armcimpi") + depends_on("libfabric", when="armci=ofi") + depends_on("rdma-core", when="armci=openib") depends_on("scalapack") depends_on("fftw-api@3", when="+fftw3") depends_on("libxc", when="+libxc") @@ -88,10 +103,6 @@ def install(self, spec, prefix): f"LAPACK_LIB={lapack.ld_flags}", f"SCALAPACK_LIB={scalapack.ld_flags}", "USE_NOIO=Y", # skip I/O algorithms - "MRCC_METHODS=y", # TCE extra module - "IPCCSD=y", # TCE extra module - "EACCSD=y", # TCE extra module - "CCSDTQ=y", # TCE extra module "V=1", # verbose build ] ) @@ -121,11 +132,32 @@ def install(self, spec, prefix): args.extend([f"NWCHEM_TARGET={target}"]) + # These optional components of TCE are rarely used and in some cases + # increase the compilation time significantly (CCSDTLR and CCSDTQ). + if spec.satisfies("+extratce"): + args.extend(["MRCC_METHODS=y"]) + args.extend(["IPCCSD=y"]) + args.extend(["EACCSD=y"]) + args.extend(["CCSDTLR=y"]) + args.extend(["CCSDTQ=y"]) + if spec.satisfies("+openmp"): args.extend(["USE_OPENMP=y"]) - if spec.satisfies("+mpipr"): + if self.spec.variants["armci"].value == "armcimpi": + armcimpi = spec["armci"] + args.extend(["ARMCI_NETWORK=ARMCI"]) + args.extend([f"EXTERNAL_ARMCI_PATH={armcimpi.prefix}"]) + elif self.spec.variants["armci"].value == "mpi-pr": args.extend(["ARMCI_NETWORK=MPI-PR"]) + elif self.spec.variants["armci"].value == "mpi-ts": + args.extend(["ARMCI_NETWORK=MPI-TS"]) + elif self.spec.variants["armci"].value == "mpi3": + args.extend(["ARMCI_NETWORK=MPI3"]) + elif self.spec.variants["armci"].value == "openib": + args.extend(["ARMCI_NETWORK=OPENIB"]) + elif self.spec.variants["armci"].value == "ofi": + args.extend(["ARMCI_NETWORK=OFI"]) if spec.satisfies("+fftw3"): args.extend(["USE_FFTW3=y"])