summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/py-qiskit-aer/package.py
blob: 24052d029352de07fecafad55c58a55b7e854052 (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
# Copyright 2013-2022 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 PyQiskitAer(PythonPackage, CudaPackage):
    """Aer is a high performance simulator for quantum circuits that
    includes noise models"""

    homepage = "https://github.com/Qiskit/qiskit-aer"
    pypi = "qiskit-aer/qiskit-aer-0.9.1.tar.gz"

    version('0.9.1', sha256='3bf5f615aaae7cc5f816c39a4e9108aabaed0cc894fb6f841e48ffd56574e7eb')

    depends_on('python@3.6:', type=('build', 'run'))
    depends_on('py-setuptools@40.1.0:', type='build')
    depends_on('py-numpy@1.16.3:', type=('build', 'run'))
    depends_on('py-pybind11@2.6:', type='build')
    depends_on('py-qiskit-terra@0.17.0:', type=('build', 'run'))
    depends_on('py-scipy@1.0:', type=('build', 'run'))
    depends_on('py-scikit-build@0.11.0:', type='build')
    depends_on('py-cmake@:3.16,3.18:', type='build')
    depends_on('mpi', when='+mpi')
    depends_on('nlohmann-json@3.1.1:')
    depends_on('spdlog@1.5.0:')
    depends_on('muparserx@4.0.8:')
    depends_on('blas')
    depends_on('cuda@10.1:', when='+cuda')

    variant('mpi', default=True, description='Enable MPI support')
    variant('gdr', default=True, description='Enable GDR support')

    def setup_build_environment(self, env):
        env.set('DISABLE_CONAN', 'ON')
        env.set('DISABLE_DEPENDENCY_INSTALL', '1')
        env.set("CUDAHOSTCXX", spack_cxx)

    def install_options(self, spec, prefix):
        args = []
        args.append('-DDISABLE_CONAN=ON')
        if '~gdr' in self.spec:
            args.append('-DAER_DISABLE_GDR=True')
        else:
            args.append('-DAER_DISABLE_GDR=False')
        if '+mpi' in self.spec:
            args.append('-DAER_MPI=True')
        else:
            args.append('-DAER_MPI=False')
        if '+cuda' in self.spec:
            args.append('-DAER_THRUST_BACKEND=CUDA')
            cuda_archs = spec.variants['cuda_arch'].value
            if 'none' not in cuda_archs:
                args.append('-DCUDA_NVCC_FLAGS={0}'.
                            format(' '.join(self.cuda_flags(cuda_archs))))
        return args