summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/simplemoc/package.py
blob: ec03008317c1fe58c4de57a099671c11ef850337 (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
50
# 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 Simplemoc(MakefilePackage):
    """The purpose of this mini-app is to demonstrate the performance
    characterterics and viability of the Method of Characteristics (MOC)
    for 3D neutron transport calculations in the context of full scale
    light water reactor simulation."""

    homepage = "https://github.com/ANL-CESAR/SimpleMOC/"
    url = "https://github.com/ANL-CESAR/SimpleMOC/archive/v4.tar.gz"

    license("MIT")

    version("4", sha256="a39906014fdb234c43bf26e1919bdc8a13097788812e0b353a492b8e568816a6")

    tags = ["proxy-app"]

    variant("mpi", default=True, description="Build with MPI support")

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

    build_directory = "src"

    @property
    def build_targets(self):
        targets = []

        cflags = "-std=gnu99"
        ldflags = "-lm"

        if self.compiler.name == "gcc" or self.compiler.name == "intel":
            cflags += " " + self.compiler.openmp_flag
        if "+mpi" in self.spec:
            targets.append("CC={0}".format(self.spec["mpi"].mpicc))

        targets.append("CFLAGS={0}".format(cflags))
        targets.append("LDFLAGS={0}".format(ldflags))

        return targets

    def install(self, spec, prefix):
        mkdir(prefix.bin)
        install("src/SimpleMOC", prefix.bin)