spack/var/spack/repos/builtin/packages/py-qiskit-aer/package.py
Andrew W Elble 407f68a67b
new package: py-qiskit-aer and dependencies (#27198)
* new package: py-qiskit-aer and dependencies

+updates for dependencies

* flake8 fix

* forgot homepages

* incorporate feedback

* py-cmake and py-ninja to py-tweedledum, prevent py-cmake from
completely rebuilding cmake

* py-ninja: avoid rebuilding ninja

* other feedback fixes

* additional fixes
2021-11-12 10:45:07 -06:00

57 lines
2.2 KiB
Python

# 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)
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 build_args(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