summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/snap/package.py
blob: 5f9493c8c98570ebe3324e3d9b24a5bf907d959d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# 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 Snap(MakefilePackage):
    """SNAP serves as a proxy application to model
    the performance of a modern discrete ordinates
    neutral particle transport application.
    SNAP may be considered an update to Sweep3D,
    intended for hybrid computing architectures.
    It is modeled off the Los Alamos National Laboratory code PARTISN."""

    homepage = "https://github.com/lanl/SNAP"
    git = "https://github.com/lanl/SNAP.git"

    tags = ["proxy-app"]

    license("Unlicense")

    version("master")

    variant("openmp", default=False, description="Build with OpenMP support")
    variant("opt", default=True, description="Build with debugging")
    variant("mpi", default=True, description="Build with MPI support")

    depends_on("mpi", when="+mpi")

    build_directory = "src"

    def edit(self, spec, prefix):
        with working_dir(self.build_directory):
            makefile = FileFilter("Makefile")
            if "~opt" in spec:
                makefile.filter("OPT = yes", "OPT = no")
            if "~mpi" in spec:
                makefile.filter("MPI = yes", "MPI = no")
            if "~openmp" in spec:
                makefile.filter("OPENMP = yes", "OPENMP = no")
            makefile.filter("FFLAGS =.*", "FFLAGS =")

    def install(self, spec, prefix):
        mkdirp(prefix.bin)
        install("src/gsnap", prefix.bin)
        install_tree("qasnap", prefix.qasnap)
        install("README.md", prefix)