summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/pumi/package.py
blob: 82f594680e73234bce09476d0c51192a92cabba6 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# 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 Pumi(CMakePackage):
    """SCOREC RPI's Parallel Unstructured Mesh Infrastructure (PUMI).
    An efficient distributed mesh data structure and methods to support
    parallel adaptive analysis including general mesh-based operations,
    such as mesh entity creation/deletion, adjacency and geometric
    classification, iterators, arbitrary (field) data attachable to mesh
    entities, efficient communication involving entities duplicated
    across multiple tasks, migration of mesh entities between tasks,
    and dynamic load balancing."""

    homepage = "https://www.scorec.rpi.edu/pumi"
    git = "https://github.com/SCOREC/core.git"

    maintainers("cwsmith")

    tags = ["e4s"]

    license("BSD-3-Clause")

    # We will use the scorec/core master branch as the 'nightly' version
    # of pumi in spack.  The master branch is more stable than the
    # scorec/core develop branch and we prefer not to expose spack users
    # to the added instability.
    version("master", submodules=True, branch="master")
    version(
        "2.2.8", submodules=True, commit="736bb87ccd8db51fc499a1b91e53717a88841b1f"
    )  # tag 2.2.8
    version(
        "2.2.7", submodules=True, commit="a295720d7b4828282484f2b78bac1f6504512de4"
    )  # tag 2.2.7
    version("2.2.6", commit="4dd330e960b1921ae0d8d4039b8de8680a20d993")  # tag 2.2.6
    version("2.2.5", commit="73c16eae073b179e45ec625a5abe4915bc589af2")  # tag 2.2.5
    version("2.2.4", commit="8072fdbafd53e0c9a63248a269f4cce5000a4a8e")  # tag 2.2.4
    version("2.2.3", commit="d200cb366813695d0f18b514d8d8ecc382cb79fc")  # tag 2.2.3
    version("2.2.2", commit="bc34e3f7cfd8ab314968510c71486b140223a68f")  # tag 2.2.2
    version("2.2.1", commit="cd826205db21b8439026db1f6af61a8ed4a18564")  # tag 2.2.1
    version("2.2.0", commit="8c7e6f13943893b2bc1ece15003e4869a0e9634f")  # tag 2.2.0
    version("2.1.0", commit="840fbf6ec49a63aeaa3945f11ddb224f6055ac9f")

    variant("int64", default=False, description="Enable 64bit mesh entity ids")
    variant("shared", default=False, description="Build shared libraries")
    variant("zoltan", default=False, description="Enable Zoltan Features")
    variant("fortran", default=False, description="Enable FORTRAN interface")
    variant("testing", default=False, description="Enable all tests")
    variant(
        "simmodsuite",
        default="none",
        values=("none", "base", "kernels", "full"),
        description="Enable Simmetrix SimModSuite Support: 'base' enables "
        "the minimum set of functionality, 'kernels' adds CAD kernel "
        "support to 'base', and 'full' enables all functionality.",
    )
    variant(
        "simmodsuite_version_check",
        default=True,
        description="Enable check of Simmetrix SimModSuite version. "
        "Disable the check for testing new versions.",
    )

    depends_on("mpi")
    depends_on("cmake@3:", type="build")
    depends_on("zoltan", when="+zoltan")
    depends_on("zoltan+int64", when="+zoltan+int64")
    simbase = "+base"
    simkernels = simbase + "+parasolid+acis+discrete"
    simfull = (
        simkernels
        + "+abstract+adv+advmodel\
                            +import+paralleladapt+parallelmesh"
    )
    depends_on("simmetrix-simmodsuite" + simbase, when="simmodsuite=base")
    depends_on("simmetrix-simmodsuite" + simkernels, when="simmodsuite=kernels")
    depends_on("simmetrix-simmodsuite" + simfull, when="simmodsuite=full")

    def cmake_args(self):
        spec = self.spec

        args = [
            "-DSCOREC_CXX_WARNINGS=OFF",
            self.define_from_variant("ENABLE_ZOLTAN", "zoltan"),
            "-DCMAKE_C_COMPILER=%s" % spec["mpi"].mpicc,
            "-DCMAKE_CXX_COMPILER=%s" % spec["mpi"].mpicxx,
            self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
            self.define_from_variant("PUMI_FORTRAN_INTERFACE", "fortran"),
            "-DMDS_ID_TYPE=%s" % ("long" if "+int64" in spec else "int"),
            "-DSKIP_SIMMETRIX_VERSION_CHECK=%s"
            % ("ON" if "~simmodsuite_version_check" in spec else "OFF"),
            self.define_from_variant("IS_TESTING", "testing"),
            "-DMESHES=%s" % join_path(self.stage.source_path, "pumi-meshes"),
        ]
        if spec.satisfies("fortran"):
            args += ["-DCMAKE_Fortran_COMPILER=%s" % spec["mpi"].mpifc]
        if spec.satisfies("@2.2.3"):
            args += ["-DCMAKE_CXX_STANDARD=11"]
        if self.spec.variants["simmodsuite"].value != "none":
            args.append("-DENABLE_SIMMETRIX=ON")
            mpi_id = spec["mpi"].name + spec["mpi"].version.up_to(1).string
            args.append("-DSIM_MPI=" + mpi_id)
            if self.spec.variants["simmodsuite"].value in ["kernels", "full"]:
                args.append("-DENABLE_SIMMETRIX=ON")
                args.append("-DSIM_PARASOLID=ON")
                args.append("-DSIM_ACIS=ON")
                args.append("-DSIM_DISCRETE=ON")
        return args

    def test(self):
        if self.spec.version <= Version("2.2.6"):
            return
        exe = "uniform"
        options = ["../testdata/pipe.dmg", "../testdata/pipe.smb", "pipe_unif.smb"]
        expected = "mesh pipe_unif.smb written"
        description = "testing pumi uniform mesh refinement"
        self.run_test(exe, options, expected, purpose=description, work_dir=self.prefix.bin)

        mpiexec = Executable(join_path(self.spec["mpi"].prefix.bin, "mpiexec")).command
        mpiopt = ["-n", "2"]
        exe = ["split"]
        options = ["../testdata/pipe.dmg", "../testdata/pipe.smb", "pipe_2_.smb", "2"]
        expected = "mesh pipe_2_.smb written"
        description = "testing pumi mesh partitioning"
        self.run_test(
            mpiexec,
            mpiopt + exe + options,
            expected,
            purpose=description,
            work_dir=self.prefix.bin,
        )