2022-06-16 17:23:12 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, pythonOlder
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2021-06-04 09:07:49 +00:00
|
|
|
, fetchpatch
|
2020-12-03 08:41:04 +00:00
|
|
|
# C Inputs
|
|
|
|
, blas
|
|
|
|
, catch2
|
2020-04-24 23:36:52 +00:00
|
|
|
, cmake
|
|
|
|
, cython
|
2020-12-25 13:55:36 +00:00
|
|
|
, fmt
|
2020-09-25 04:45:31 +00:00
|
|
|
, muparserx
|
|
|
|
, ninja
|
|
|
|
, nlohmann_json
|
2020-12-03 08:41:04 +00:00
|
|
|
, spdlog
|
|
|
|
# Python Inputs
|
|
|
|
, cvxpy
|
2020-04-24 23:36:52 +00:00
|
|
|
, numpy
|
|
|
|
, pybind11
|
|
|
|
, scikit-build
|
|
|
|
# Check Inputs
|
|
|
|
, pytestCheckHook
|
2020-12-03 08:41:04 +00:00
|
|
|
, ddt
|
|
|
|
, fixtures
|
|
|
|
, pytest-timeout
|
|
|
|
, qiskit-terra
|
2021-12-06 16:07:01 +00:00
|
|
|
, setuptools
|
|
|
|
, testtools
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "qiskit-aer";
|
2022-04-27 09:35:20 +00:00
|
|
|
version = "0.10.4";
|
2021-03-09 03:18:52 +00:00
|
|
|
format = "pyproject";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-03 08:41:04 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Qiskit";
|
|
|
|
repo = "qiskit-aer";
|
|
|
|
rev = version;
|
2022-04-27 09:35:20 +00:00
|
|
|
sha256 = "sha256-mf+Pgw/daFkt1bvqSeYzlO/Sd2F2MtwZcLr+h1u+eb0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-06-04 09:07:49 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace "'cmake!=3.17,!=3.17.0'," "" \
|
2021-12-06 16:07:01 +00:00
|
|
|
--replace "'pybind11', min_version='2.6'" "'pybind11'" \
|
|
|
|
--replace "pybind11>=2.6" "pybind11" \
|
|
|
|
--replace "scikit-build>=0.11.0" "scikit-build" \
|
|
|
|
--replace "min_version='0.11.0'" ""
|
2021-06-04 09:07:49 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2020-09-25 04:45:31 +00:00
|
|
|
ninja
|
2020-04-24 23:36:52 +00:00
|
|
|
scikit-build
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2020-12-03 08:41:04 +00:00
|
|
|
blas
|
|
|
|
catch2
|
2022-04-27 09:35:20 +00:00
|
|
|
nlohmann_json
|
2020-12-25 13:55:36 +00:00
|
|
|
fmt
|
2020-09-25 04:45:31 +00:00
|
|
|
muparserx
|
2020-12-03 08:41:04 +00:00
|
|
|
spdlog
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
cvxpy
|
|
|
|
cython # generates some cython files at runtime that need to be cython-ized
|
|
|
|
numpy
|
2022-04-27 09:35:20 +00:00
|
|
|
pybind11
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
preBuild = ''
|
|
|
|
export DISABLE_CONAN=1
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
|
|
|
# *** Testing ***
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"qiskit.providers.aer"
|
|
|
|
"qiskit.providers.aer.backends.qasm_simulator"
|
|
|
|
"qiskit.providers.aer.backends.controller_wrappers" # Checks C++ files built correctly. Only exists if built & moved to output
|
|
|
|
];
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2020-12-03 08:41:04 +00:00
|
|
|
disabledTests = [
|
2022-04-27 09:35:20 +00:00
|
|
|
# these tests don't work with cvxpy >= 1.1.15
|
2022-02-20 05:27:41 +00:00
|
|
|
"test_clifford"
|
|
|
|
"test_approx_random"
|
2022-04-27 09:35:20 +00:00
|
|
|
"test_snapshot" # TODO: these ~30 tests fail on setup due to pytest fixture issues?
|
|
|
|
"test_initialize_2" # TODO: simulations appear incorrect, off by >10%.
|
|
|
|
"test_pauli_error_2q_gate_from_string_1qonly"
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
# these fail for some builds. Haven't been able to reproduce error locally.
|
|
|
|
"test_kraus_gate_noise"
|
|
|
|
"test_backend_method_clifford_circuits_and_kraus_noise"
|
|
|
|
"test_backend_method_nonclifford_circuit_and_kraus_noise"
|
|
|
|
"test_kraus_noise_fusion"
|
|
|
|
|
|
|
|
# Slow tests
|
2020-12-03 08:41:04 +00:00
|
|
|
"test_paulis_1_and_2_qubits"
|
|
|
|
"test_3d_oscillator"
|
2021-04-13 19:44:15 +00:00
|
|
|
"_057"
|
|
|
|
"_136"
|
|
|
|
"_137"
|
|
|
|
"_139"
|
|
|
|
"_138"
|
|
|
|
"_140"
|
|
|
|
"_141"
|
|
|
|
"_143"
|
|
|
|
"_144"
|
|
|
|
"test_sparse_output_probabilities"
|
|
|
|
"test_reset_2_qubit"
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
# Fails with 0.10.4
|
|
|
|
"test_extended_stabilizer_sparse_output_probs"
|
2020-12-03 08:41:04 +00:00
|
|
|
];
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
2020-12-03 08:41:04 +00:00
|
|
|
ddt
|
|
|
|
fixtures
|
|
|
|
pytest-timeout
|
|
|
|
qiskit-terra
|
2021-12-06 16:07:01 +00:00
|
|
|
testtools
|
2020-12-03 08:41:04 +00:00
|
|
|
];
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2020-12-03 08:41:04 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
"--timeout=30"
|
|
|
|
"--durations=10"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
# Tests include a compiled "circuit" which is auto-built in $HOME
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
# move tests b/c by default try to find (missing) cython-ized code in /build/source dir
|
2020-05-15 21:57:56 +00:00
|
|
|
cp -r $TMP/$sourceRoot/test $HOME
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Add qiskit-aer compiled files to cython include search
|
|
|
|
pushd $HOME
|
|
|
|
'';
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2020-12-03 08:41:04 +00:00
|
|
|
postCheck = "popd";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2022-06-16 17:23:12 +00:00
|
|
|
broken = (stdenv.isLinux && stdenv.isAarch64);
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "High performance simulators for Qiskit";
|
|
|
|
homepage = "https://qiskit.org/aer";
|
|
|
|
downloadPage = "https://github.com/QISKit/qiskit-aer/releases";
|
2020-09-25 04:45:31 +00:00
|
|
|
changelog = "https://qiskit.org/documentation/release_notes.html";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ drewrisinger ];
|
|
|
|
};
|
|
|
|
}
|