Skip to content

Commit

Permalink
Merge pull request #217 from atilag/stable-0.2.1
Browse files Browse the repository at this point in the history
Stable 0.2.1
  • Loading branch information
atilag authored May 20, 2019
2 parents 359b3df + e72361c commit e975026
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 21 deletions.
40 changes: 40 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,43 @@ There are two main branches in the repository:
- This is a stable branch (as the name suggest), meaning that you can expect
stable software ready for production environments.
- All the tags from the release versions are created from this branch.

Stable Branch Policy
====================

The stable branch is intended to be a safe source of fixes for high impact bugs and security issues which have been fixed on master since a release. When reviewing a stable branch PR we need to balance the risk of any given patch with the value that it will provide to users of the stable branch. Only a limited class of changes are appropriate for inclusion on the stable branch. A large, risky patch for a major issue might make sense. As might a trivial fix for a fairly obscure error handling case. A number of factors must be weighed when considering a change:

- The risk of regression: even the tiniest changes carry some risk of breaking something and we really want to avoid regressions on the stable branch
- The user visible benefit: are we fixing something that users might actually notice and, if so, how important is it?
- How self-contained the fix is: if it fixes a significant issue but also refactors a lot of code, it’s probably worth thinking about what a less risky fix might look like
- Whether the fix is already on master: a change must be a backport of a change already merged onto master, unless the change simply does not make sense on master.

Backporting procedure:
----------------------

When backporting a patch from master to stable we want to keep a reference to the change on master. When you create the branch for the stable PR you can use:

`$ git cherry-pick -x $master_commit_id`

However, this only works for small self contained patches from master. If you
need to backport a subset of a larger commit (from a squashed PR for
example) from master this just need be done manually. This should be handled
by adding::

Backported from: #master pr number

in these cases, so we can track the source of the change subset even if a
strict cherry pick doesn't make sense.

If the patch you’re proposing will not cherry-pick cleanly, you can help by resolving the conflicts yourself and proposing the resulting patch. Please keep Conflicts lines in the commit message to help review of the stable patch.

Backport Tags
-------------

Bugs or PRs tagged with `stable backport potential` are bugs which apply to the
stable release too and may be suitable for backporting once a fix lands in
master. Once the backport has been proposed, the tag should be removed.

The PR against the stable branch should include `[stable]` in the title, as a
sign that setting the target branch as stable was not a mistake. Also,
reference to the PR number in master that you are porting.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Added

Changed
-------
- Set simulator seed from "seed_simulator" in qobj (#210)

Removed
-------
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/aer/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0
0.2.1
2 changes: 1 addition & 1 deletion qiskit/providers/aer/aererror.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Exception for errors raised by Qiskit Aer simulators backends.
"""

from qiskit.qiskiterror import QiskitError
from qiskit import QiskitError


class AerError(QiskitError):
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/aer/backends/aerbackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self, controller, configuration, provider=None):
Raises:
FileNotFoundError if backend executable is not available.
QiskitError: if there is no name in the configuration
AerError: if there is no name in the configuration
"""
super().__init__(configuration, provider=provider)
self._controller = controller
Expand Down
6 changes: 3 additions & 3 deletions qiskit/providers/aer/noise/errors/errorutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ def standard_gate_instruction(instruction, ignore_phase=True):
standard_gate_unitary(pauli1),
standard_gate_unitary(pauli0))
if matrix_equal(mat_dagger, pmat, ignore_phase=ignore_phase):
if pauli0 is "id":
if pauli0 == "id":
return [{"name": pauli1, "qubits": [qubits[1]]}]
elif pauli1 is "id":
elif pauli1 == "id":
return [{"name": pauli0, "qubits": [qubits[0]]}]
else:
return [{
Expand Down Expand Up @@ -296,7 +296,7 @@ def standard_gate_unitary(name):
return np.array(
[[1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0]],
dtype=complex)
if name is "cx_10":
if name == "cx_10":
return np.array(
[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]],
dtype=complex)
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/aer/noise/errors/standard_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def kraus_error(noise_ops, standard_gates=True, canonical_kraus=False):
kraus = Kraus(noise_ops)
if canonical_kraus:
# Convert to Choi and back to get canonical Kraus
kraus = Kraus(Choi(kraus))
kraus = Kraus(Choi(kraus))
return QuantumError(kraus, standard_gates=standard_gates)


Expand Down
4 changes: 2 additions & 2 deletions qiskit/providers/aer/noise/noise_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ def from_dict(noise_dict):
error_type = error['type']

# Add QuantumError
if error_type is 'qerror':
if error_type == 'qerror':
noise_ops = tuple(
zip(error['instructions'], error['probabilities']))
instruction_names = error['operations']
Expand Down Expand Up @@ -663,7 +663,7 @@ def from_dict(noise_dict):
qerror, instruction_names, warnings=False)

# Add ReadoutError
elif error_type is 'roerror':
elif error_type == 'roerror':
probabilities = error['probabilities']
all_gate_qubits = error.get('gate_qubits', None)
roerror = ReadoutError(probabilities)
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/aer/noise/noiseerror.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Exception for errors raised by Qiskit Aer noise module.
"""

from qiskit.qiskiterror import QiskitError
from qiskit import QiskitError


class NoiseError(QiskitError):
Expand Down
6 changes: 3 additions & 3 deletions src/base/controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class Controller {
// Parameters for parallelization management in configuration
int max_parallel_experiments_;
int max_parallel_shots_;
int max_memory_mb_;
size_t max_memory_mb_;

// Parameters for parallelization management for experiments
int parallel_experiments_;
Expand Down Expand Up @@ -425,7 +425,7 @@ bool Controller::validate_memory_requirements(state_t &state,
if (max_memory_mb_ == 0)
return true;

int required_mb = state.required_memory_mb(circ.num_qubits, circ.ops);
size_t required_mb = state.required_memory_mb(circ.num_qubits, circ.ops);
if(max_memory_mb_ < required_mb) {
if(throw_except) {
std::string name = "";
Expand Down Expand Up @@ -622,7 +622,7 @@ json_t Controller::execute_circuit(Circuit &circ) {
// Pass through circuit header and add metadata
result["header"] = circ.header;
result["shots"] = circ.shots;
result["seed"] = circ.seed;
result["seed_simulator"] = circ.seed;
// Move any metadata from the subclass run_circuit data
// to the experiment resultmetadata field
if (JSON::check_key("metadata", result["data"])) {
Expand Down
3 changes: 2 additions & 1 deletion src/framework/qobj.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ void Qobj::load_qobj_from_json(const json_t &js) {
JSON::get_value(config, "config", js);
JSON::get_value(header, "header", js);
// Check for fixed seed
JSON::get_value(seed, "seed", config);
JSON::get_value(seed, "seed", config); // DEPRECIATED: Remove in 0.3.
JSON::get_value(seed, "seed_simulator", config);
// Get type
JSON::get_value(type, "type", js);
if (type != "QASM") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ size_t State::required_memory_mb(uint_t num_qubits,
// Plus 2*CHSimulator::scalar_t which has 3 4 byte words
// Plus 2*CHSimulator::pauli_t which has 2 8 byte words and one 4 byte word;
double mb_per_state = 5e-5*num_qubits;//
size_t required_mb = std::ceil(mb_per_state*required_chi);
size_t required_mb = std::llrint(std::ceil(mb_per_state*required_chi));
return required_mb;
//Todo: Update this function to account for snapshots
}
Expand Down
8 changes: 4 additions & 4 deletions test/terra/backends/qasm_simulator/qasm_fusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_noise_fusion(self):
circuit = transpile([circuit],
backend=self.SIMULATOR,
basis_gates=noise_model.basis_gates)
qobj = assemble([circuit], self.SIMULATOR, shots=shots, seed=1)
qobj = assemble([circuit], self.SIMULATOR, shots=shots, seed_simulator=1)

backend_options = self.BACKEND_OPTS.copy()
backend_options['fusion_enable'] = True
Expand Down Expand Up @@ -128,7 +128,7 @@ def test_fusion_verbose(self):
circuit = self.create_statevector_circuit()

shots = 100
qobj = assemble([circuit], self.SIMULATOR, shots=shots, seed=1)
qobj = assemble([circuit], self.SIMULATOR, shots=shots, seed_simulator=1)

backend_options = self.BACKEND_OPTS.copy()
backend_options['fusion_enable'] = True
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_control_fusion(self):
"""Test Fusion enable/disable option"""
shots = 100
circuit = self.create_statevector_circuit()
qobj = assemble([circuit], self.SIMULATOR, shots=shots, seed=0)
qobj = assemble([circuit], self.SIMULATOR, shots=shots, seed_simulator=1)

backend_options = self.BACKEND_OPTS.copy()
backend_options['fusion_enable'] = True
Expand Down Expand Up @@ -319,7 +319,7 @@ def test_fusion_operations(self):

circuit.measure(qr, cr)

qobj = assemble([circuit], self.SIMULATOR, shots=shots, seed=1)
qobj = assemble([circuit], self.SIMULATOR, shots=shots, seed_simulator=1)

backend_options = self.BACKEND_OPTS.copy()
backend_options['fusion_enable'] = True
Expand Down
2 changes: 1 addition & 1 deletion test/terra/backends/qasm_simulator/qasm_truncate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"""
import json
from test.benchmark.tools import quantum_volume_circuit
from qiskit import execute, compile, QuantumRegister, ClassicalRegister, QuantumCircuit, Aer
from qiskit import execute, QuantumRegister, ClassicalRegister, QuantumCircuit, Aer
from qiskit.providers.aer import QasmSimulator
from qiskit.providers.aer import noise
from qiskit.providers.aer.noise import NoiseModel
Expand Down
2 changes: 1 addition & 1 deletion test/terra/utils/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,6 @@ def new_fake_qobj():
QasmQobjInstruction(name='barrier', qubits=[1])
],
header=QobjExperimentHeader(),
config=QasmQobjExperimentConfig(seed=123456)
config=QasmQobjExperimentConfig(seed_simulator=123456)
)]
)

0 comments on commit e975026

Please sign in to comment.