From bf4fccee15853153c8346bd26328524195b603f9 Mon Sep 17 00:00:00 2001 From: kjrstory Date: Wed, 24 May 2023 03:59:05 +0900 Subject: New package: FDS (#37850) --- var/spack/repos/builtin/packages/fds/package.py | 94 +++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 var/spack/repos/builtin/packages/fds/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/fds/package.py b/var/spack/repos/builtin/packages/fds/package.py new file mode 100644 index 0000000000..5e9e7737c2 --- /dev/null +++ b/var/spack/repos/builtin/packages/fds/package.py @@ -0,0 +1,94 @@ +# Copyright 2013-2023 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.package import * + + +class Fds(MakefilePackage): + """ + Fire Dynamics Simulator (FDS) is a large-eddy simulation (LES) code for low-speed flows, + with an emphasis on smoke and heat transport from fires. + FDS and Smokeview are free and open-source software tools provided by the National Institute + of Standards and Technology (NIST) of the United States Department of Commerce. Pursuant + to Title 17, Section 105 of the United States Code, this software is not subject to copyright + protection and is in the public domain. View the full disclaimer for NIST-developed software. + """ + + maintainers("kjrstory") + homepage = "https://pages.nist.gov/fds-smv" + url = "https://github.com/firemodels/fds/archive/refs/tags/FDS-6.8.0.tar.gz" + git = "https://github.com/firemodels/fds.git" + + version("6.8.0", commit="886e0096535519b7358a3c4393c91da3caee5072") + + depends_on("mpi") + depends_on("mkl") + + build_directory = "Build" + + requires( + "%gcc", + "%intel", + "%oneapi", + policy="one_of", + msg="FDS builds only with GNU Fortran or Intel Fortran", + ) + + requires( + "^intel-mkl", + "^intel-oneapi-mkl", + policy="one_of", + msg="FDS builds require either Intel MKL or Intel oneAPI MKL library", + ) + + requires( + "^openmpi", + when="%gcc platform=linux", + msg="OpenMPI can only be used with GNU Fortran on Linux platform", + ) + + requires( + "^intel-mpi^intel-mkl", + when="%intel platform=linux", + msg="Intel MPI and Intel MKL can only be used with Intel Fortran on Linux platform", + ) + + requires( + "^intel-oneapi-mpi^intel-oneapi-mkl", + when="%oneapi platform=linux", + msg="Intel oneAPI MPI and MKL can only be used with oneAPI Fortran on Linux platform", + ) + + requires( + "^openmpi%intel", + when="platform=darwin", + msg="OpenMPI can only be used with Intel Fortran on macOS", + ) + + def edit(self, spec, prefix): + env["MKL_ROOT"] = self.spec["mkl"].prefix + if spec.compiler.name == "oneapi": + env["INTEL_IFORT"] = "ifx" + makefile = FileFilter("Build/makefile") + makefile.filter(r"\.\./Scripts", "./Scripts") + makefile.filter(r"\.\.\\Scripts", ".\\Scripts") + + @property + def build_targets(self): + spec = self.spec + mpi_mapping = {"openmpi": "ompi", "intel-oneapi-mpi": "impi", "intel-mpi": "impi"} + compiler_mapping = {"gcc": "gnu", "oneapi": "intel", "intel": "intel"} + platform_mapping = {"linux": "linux", "darwin": "osx"} + mpi_prefix = mpi_mapping[spec["mpi"].name] + compiler_prefix = compiler_mapping[spec.compiler.name] + platform_prefix = platform_mapping[spec.architecture.platform] + return ["{}_{}_{}".format(mpi_prefix, compiler_prefix, platform_prefix)] + + def install(self, spec, prefix): + mkdirp(prefix.bin) + with working_dir(self.build_directory): + install("*.mod", prefix.bin) + install("*.o", prefix.bin) + install("fds_" + self.build_targets[0], prefix.bin + "/fds") -- cgit v1.2.3-70-g09d2