summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/xyce/package.py
blob: afe0256dd76a550faebd4da691ba3bf4f57ada8b (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
# Copyright 2013-2021 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 import *


class Xyce(CMakePackage):
    """Xyce (rhymes with 'spice') is an open source, SPICE-compatible,
    high-performance analog circuit simulator, capable of solving extremely
    large circuit problems by supporting large-scale parallel computing
    platforms.
    Xyce also supports serial execution on all common desktop platforms,
    and small-scale parallel runs on Unix-like systems. In addition to analog
    electronic simulation, Xyce has also been used to investigate more general
    network systems, such as neural networks and power grids.
    """

    homepage = 'https://xyce.sandia.gov'
    git      = 'https://github.com/Xyce/Xyce.git'
    url      = 'https://github.com/Xyce/Xyce/archive/Release-7.2.0.tar.gz'
    maintainers = ['kuberry']

    version('master',  branch='master')
    version('7.2.0', 'cf49705278ecda46373784bb24925cb97f9017b6adff49e4416de146bdd6a4b5', preferred=True)

    depends_on('cmake@3.13:', type='build')
    depends_on('flex')
    depends_on('bison')

    variant('build_type', default='Release',
            description='CMake build type',
            values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel'))

    variant('mpi', default=True, description='Enable MPI support')
    depends_on('mpi', when='+mpi')

    variant('pymi', default=False, description='Enable Python Model Interpreter for Xyce')
    depends_on('python@3:', type=('build', 'link', 'run'), when='+pymi')
    depends_on('py-pip', type='run', when='+pymi')
    depends_on('py-pybind11@2.6.1:', when='+pymi')

    # Xyce is built against an older version of Trilinos unlikely to be
    # used for any other purpose.
    depends_on('trilinos@12.12.1 +amesos+amesos2+anasazi+aztec+belos+complex+epetra+epetraext+explicit_template_instantiation+fortran+hdf5+ifpack+isorropia+kokkos+nox+sacado+suite-sparse+teuchos+trilinoscouplings+zoltan+stokhos+amesos2basker+epetraextbtf+epetraextexperimental+epetraextgraphreorderings gotype=all')

    # MPI options must be consistent with Trilinos
    depends_on('trilinos~mpi', when='~mpi')
    depends_on('trilinos+mpi', when='+mpi')

    # The default settings for various Trilinos variants would require the
    # installation of many more packages than are needed for Xyce.
    # The default variants in Trilinos have been set for several
    # applications, namely xSDK, deal.ii, and DTK. Future changes to the
    # Trilinos recipe will disable all packages by default. At that
    # point, these ~variants can be removed from the following recipes.
    depends_on('trilinos~adios2~alloptpkgs~boost~cgns~chaco~cuda~cuda_rdc~debug~dtk~exodus~float~glm~gtest~hwloc~hypre~ifpack2~intrepid~intrepid2~ipo~matio~mesquite~metis~minitensor~ml~muelu~mumps~netcdf~openmp~phalanx~piro~pnetcdf~python~rol~rythmos~shards~shared~shylu~stk~stratimikos~strumpack~superlu~superlu-dist~teko~tempus~wrapper~x11~xsdkflags~zlib~zoltan2')

    def cmake_args(self):
        spec = self.spec

        trilinos = spec['trilinos']

        cxx_flags = [self.compiler.cxx_pic_flag]
        try:
            cxx_flags.append(self.compiler.cxx11_flag)
        except ValueError:
            pass
        cxx_flags.append("-DXyce_INTRUSIVE_PCE -Wreorder -O3")

        options = []
        options.extend([
            '-DTrilinos_DIR:PATH={0}'.format(trilinos.prefix),
            '-DCMAKE_CXX_FLAGS:STRING={0}'.format(' '.join(cxx_flags)),
        ])

        if '+mpi' in spec:
            options.append('-DCMAKE_CXX_COMPILER:STRING={0}'.format(spec['mpi'].mpicxx))
        else:
            options.append('-DCMAKE_CXX_COMPILER:STRING={0}'.format(self.compiler.cxx))

        if '+shared' in spec:
            options.append('-DBUILD_SHARED_LIBS:BOOL=ON')
        else:
            options.append('-DBUILD_SHARED_LIBS:BOOL=OFF')

        if '+pymi' in spec:
            pybind11 = spec['py-pybind11']
            python   = spec['python']
            options.append('-DXyce_PYMI:BOOL=ON')
            options.append('-Dpybind11_DIR:PATH={0}'.format(pybind11.prefix))
            options.append('-DPython_ROOT_DIR:FILEPATH={0}'.format(python.prefix))
            options.append('-DPython_FIND_STRATEGY=LOCATION')

        return options