Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove qs2/3 references #78

Merged
merged 7 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,8 @@ print(device.run(bell, s3_folder).result().measurement_counts)
The code sample imports the Amazon Braket framework, then defines the execution environment as the AWSQuantumSimulator and the device to use. The `s3_folder` statement defines the Amazon S3 bucket for job output and the folder in the bucket to store job output. This folder is created when you run the job. It then creates a Bell Pair circuit, executes the circuit on the simulator and prints the results of the job.

### Available Simulators
There are currently three simulators available for Amazon Braket. To specify which simulator to use, change the code sample to replace the value for the `AwsQuantumSimulator` to one of the following values:
There is currently one cloud simulator available for Amazon Braket:
- `arn:aws:aqx:::quantum-simulator:aqx:qs1` – a Schrödinger simulator. Simulates exactly running a job on a quantum computer. Limit of 25 qubits. This simulator samples only from the state vector and outputs an array of bit strings that appears as though it came from a quantum computer. Does not provide a state vector.
- `arn:aws:aqx:::quantum-simulator:aqx:qs2` – a tensor network simulator. Provides an approximation of running a job on a quantum computer.
- `arn:aws:aqx:::quantum-simulator:aqx:qs3` – a Schrödinger simulator. Simulates exactly running a job on a quantum computer. Limit of 25 qubits. This simulator samples from the state vector but includes the entire state vector. This generates more data, and therefore incurs additional costs for storage of data in Amazon S3.

#### To validate your configuration using a Python file
1. Open a text editor with example file `../braket-python-sdk/examples/bell.py`.
Expand Down
2 changes: 0 additions & 2 deletions src/braket/aws/aws_quantum_simulator_arns.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@

class AwsQuantumSimulatorArns(str, Enum):
QS1 = "arn:aws:aqx:::quantum-simulator:aqx:qs1"
QS2 = "arn:aws:aqx:::quantum-simulator:aqx:qs2"
QS3 = "arn:aws:aqx:::quantum-simulator:aqx:qs3"
7 changes: 1 addition & 6 deletions test/integ_tests/test_device_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ def test_device_across_regions(aws_session):


@pytest.mark.parametrize(
"simulator_arn,simulator_name",
[
(AwsQuantumSimulatorArns.QS1, "quantum-simulator-1"),
(AwsQuantumSimulatorArns.QS2, "quantum-simulator-2"),
(AwsQuantumSimulatorArns.QS3, "quantum-simulator-3"),
],
"simulator_arn,simulator_name", [(AwsQuantumSimulatorArns.QS1, "quantum-simulator-1"),],
)
def test_simulator_creation(simulator_arn, simulator_name, aws_session):
simulator = AwsQuantumSimulator(simulator_arn, aws_session=aws_session)
Expand Down
31 changes: 2 additions & 29 deletions test/integ_tests/test_simulator_quantum_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
from braket.circuits import Circuit


@pytest.mark.parametrize(
"simulator_arn", [AwsQuantumSimulatorArns.QS1, AwsQuantumSimulatorArns.QS3]
)
@pytest.mark.parametrize("simulator_arn", [AwsQuantumSimulatorArns.QS1])
def test_bell_pair(simulator_arn, aws_session, s3_destination_folder):
device = AwsQuantumSimulator(simulator_arn, aws_session)
bell = Circuit().h(0).cnot(0, 1)
Expand All @@ -31,9 +29,7 @@ def test_bell_pair(simulator_arn, aws_session, s3_destination_folder):
assert len(result.measurements) == 750


@pytest.mark.parametrize(
"simulator_arn", [AwsQuantumSimulatorArns.QS1, AwsQuantumSimulatorArns.QS3]
)
@pytest.mark.parametrize("simulator_arn", [AwsQuantumSimulatorArns.QS1])
def test_qubit_ordering(simulator_arn, aws_session, s3_destination_folder):
device = AwsQuantumSimulator(simulator_arn, aws_session)

Expand All @@ -46,26 +42,3 @@ def test_qubit_ordering(simulator_arn, aws_session, s3_destination_folder):
state_001 = Circuit().i(0).i(1).x(2)
result = device.run(state_001, s3_destination_folder).result()
assert result.measurement_counts.most_common(1)[0][0] == "001"


def test_state_vector(aws_session, s3_destination_folder):
device = AwsQuantumSimulator(AwsQuantumSimulatorArns.QS3, aws_session)
bell = Circuit().h(0).cnot(0, 1)
state_vector = device.run(bell, s3_destination_folder, shots=1).result().state_vector
assert state_vector["00"] == complex(1 / math.sqrt(2), 0)
assert state_vector["01"] == 0
assert state_vector["10"] == 0
assert state_vector["11"] == complex(1 / math.sqrt(2), 0)


def test_qs2_quantum_task(aws_session, s3_destination_folder):
device = AwsQuantumSimulator(AwsQuantumSimulatorArns.QS2, aws_session)

bell = Circuit().h(range(8))
measurements = device.run(bell, s3_destination_folder, shots=1).result().measurements

# 1 shot
assert len(measurements) == 1

# 8 qubits
assert len(measurements[0]) == 8