summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/warpx/package.py
blob: af6a55cbdd6143417953c6d218f65326296d1532 (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
# 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 Warpx(CMakePackage):
    """WarpX is an advanced electromagnetic Particle-In-Cell code. It supports
    many features including Perfectly-Matched Layers (PML) and mesh refinement.
    In addition, WarpX is a highly-parallel and highly-optimized code and
    features hybrid OpenMP/MPI parallelization, advanced vectorization
    techniques and load balancing capabilities.

    For WarpX' Python bindings and PICMI input support, see the 'py-warpx' package.
    """

    homepage = "https://ecp-warpx.github.io"
    git      = "https://github.com/ECP-WarpX/WarpX.git"

    maintainers = ['ax3l', 'dpgrote', 'MaxThevenet', 'RemiLehe']

    version('develop', branch='development')

    variant('app', default=True,
            description='Build the WarpX executable application')
    variant('ascent', default=False,
            description='Enable Ascent in situ vis')
    variant('compute',
            default='omp',
            values=('omp', 'cuda', 'hip', 'sycl', 'noacc'),
            multi=False,
            description='On-node, accelerated computing backend')
    variant('dims',
            default='3',
            values=('2', '3', 'rz'),
            multi=False,
            description='Number of spatial dimensions')
    variant('eb', default=False,
            description='Embedded boundary support (in development)')
    variant('lib', default=True,
            description='Build WarpX as a shared library')
    variant('mpi', default=True,
            description='Enable MPI support')
    variant('mpithreadmultiple', default=True,
            description='MPI thread-multiple support, i.e. for async_io')
    variant('openpmd', default=True,
            description='Enable openPMD I/O')
    variant('precision',
            default='double',
            values=('single', 'double'),
            multi=False,
            description='Floating point precision (single/double)')
    variant('psatd', default=True,
            description='Enable PSATD solver support')
    variant('qed', default=True,
            description='Enable QED support')
    variant('qedtablegen', default=False,
            description='QED table generation support')
    variant('shared', default=True,
            description='Build a shared version of the library')
    variant('tprof', default=True,
            description='Enable tiny profiling features')

    depends_on('ascent', when='+ascent')
    depends_on('ascent +cuda', when='+ascent compute=cuda')
    depends_on('ascent +mpi', when='+ascent +mpi')
    depends_on('blaspp', when='+psatd dims=rz')
    depends_on('boost@1.66.0: +math', when='+qedtablegen')
    depends_on('cmake@3.15.0:', type='build')
    depends_on('cuda@9.2.88:', when='compute=cuda')
    depends_on('fftw@3:', when='+psatd compute=omp')
    depends_on('fftw +mpi', when='+psatd +mpi compute=omp')
    depends_on('lapackpp', when='+psatd dims=rz')
    depends_on('mpi', when='+mpi')
    depends_on('openpmd-api@0.13.1:,dev', when='+openpmd')
    depends_on('openpmd-api +mpi', when='+openpmd +mpi')
    depends_on('pkgconfig', type='build', when='+psatd compute=omp')
    depends_on('rocfft', when='+psatd compute=hip')
    depends_on('llvm-openmp', when='%apple-clang compute=omp')

    conflicts('~qed +qedtablegen',
              msg='WarpX PICSAR QED table generation needs +qed')
    conflicts('compute=sycl', when='+psatd',
              msg='WarpX spectral solvers are not yet tested with SYCL '
                  '(use "warpx ~psatd")')

    def cmake_args(self):
        spec = self.spec

        args = [
            '-DBUILD_SHARED_LIBS:BOOL={0}'.format(
                'ON' if '+shared' in spec else 'OFF'),
            # variants
            '-DWarpX_APP:BOOL={0}'.format(
                'ON' if '+app' in spec else 'OFF'),
            '-DWarpX_ASCENT:BOOL={0}'.format(
                'ON' if '+ascent' in spec else 'OFF'),
            '-DWarpX_COMPUTE={0}'.format(
                spec.variants['compute'].value.upper()),
            '-DWarpX_DIMS={0}'.format(
                spec.variants['dims'].value.upper()),
            '-DWarpX_EB:BOOL={0}'.format(
                'ON' if '+eb' in spec else 'OFF'),
            '-DWarpX_LIB:BOOL={0}'.format(
                'ON' if '+lib' in spec else 'OFF'),
            '-DWarpX_MPI:BOOL={0}'.format(
                'ON' if '+mpi' in spec else 'OFF'),
            '-DWarpX_MPI_THREAD_MULTIPLE:BOOL={0}'.format(
                'ON' if '+mpithreadmultiple' in spec else 'OFF'),
            '-DWarpX_OPENPMD:BOOL={0}'.format(
                'ON' if '+openpmd' in spec else 'OFF'),
            '-DWarpX_PRECISION={0}'.format(
                spec.variants['precision'].value.upper()),
            '-DWarpX_PSATD:BOOL={0}'.format(
                'ON' if '+psatd' in spec else 'OFF'),
            '-DWarpX_QED:BOOL={0}'.format(
                'ON' if '+qed' in spec else 'OFF'),
            '-DWarpX_QED_TABLE_GEN:BOOL={0}'.format(
                'ON' if '+qedtablegen' in spec else 'OFF'),
        ]

        return args