From c9980904ed7d7d1a088a70a55bb025d22eeb43ae Mon Sep 17 00:00:00 2001 From: Ryan Shaffer <3620100+rmshaffer@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:59:36 -0400 Subject: [PATCH] feature: Add IQM Garnet device, retire OQC Lucy device (#93) * device updates: add IQM Garnet, retire OQC Lucy * fix tests * Remove retired devices from tests * Fix test error --- src/device.jl | 9 +- src/raw_schema.jl | 41 +++- src/task.jl | 1 + test/annealing_task_result.jl | 2 +- test/gate_model_task_result.jl | 12 +- test/integ_tests/cost_tracking.jl | 2 +- test/integ_tests/device_creation.jl | 11 +- test/integ_tests/measure.jl | 3 +- test/iqm_device.jl | 323 ++++++++++++++++++++++++++++ test/oq3_program_result.jl | 2 +- test/photonic_task_result.jl | 2 +- test/runtests.jl | 1 + test/schemas_misc.jl | 2 +- test/task.jl | 12 +- test/task_batch.jl | 6 +- 15 files changed, 395 insertions(+), 34 deletions(-) create mode 100644 test/iqm_device.jl diff --git a/src/device.jl b/src/device.jl index 2926a1fe..242a5f24 100644 --- a/src/device.jl +++ b/src/device.jl @@ -23,7 +23,7 @@ julia> arn(d) ``` """ abstract type BraketDevice end -for provider in (:AmazonDevice, :_XanaduDevice, :_DWaveDevice, :OQCDevice, :QuEraDevice, :IonQDevice, :RigettiDevice) +for provider in (:AmazonDevice, :_XanaduDevice, :_DWaveDevice, :_OQCDevice, :IQMDevice, :QuEraDevice, :IonQDevice, :RigettiDevice) @eval begin abstract type $provider <: BraketDevice end end @@ -67,8 +67,11 @@ end struct Aquila <: QuEraDevice end Base.convert(::Type{String}, d::Aquila) = "arn:aws:braket:us-east-1::device/qpu/quera/Aquila" -struct Lucy <: OQCDevice end -Base.convert(::Type{String}, d::Lucy) = "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" +struct _Lucy <: _OQCDevice end +Base.convert(::Type{String}, d::_Lucy) = "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" + +struct Garnet <: IQMDevice end +Base.convert(::Type{String}, d::Garnet) = "arn:aws:braket:eu-north-1::device/qpu/iqm/Garnet" for (d, d_arn) in zip((:_Aspen8, :_Aspen9, :_Aspen10, :_Aspen11, :_AspenM1, :_AspenM2, :AspenM3), ("arn:aws:braket:::device/qpu/rigetti/Aspen-8", diff --git a/src/raw_schema.jl b/src/raw_schema.jl index a2c0f923..0d31a0d2 100644 --- a/src/raw_schema.jl +++ b/src/raw_schema.jl @@ -89,6 +89,13 @@ end StructTypes.StructType(::Type{OqcMetadata}) = StructTypes.UnorderedStruct() StructTypes.defaults(::Type{OqcMetadata}) = Dict{Symbol, Any}(:braketSchemaHeader => braketSchemaHeader("braket.task_result.oqc_metadata", "1")) +struct IqmMetadata <: BraketSchemaBase + braketSchemaHeader::braketSchemaHeader + compiledProgram::String +end +StructTypes.StructType(::Type{IqmMetadata}) = StructTypes.UnorderedStruct() +StructTypes.defaults(::Type{IqmMetadata}) = Dict{Symbol, Any}(:braketSchemaHeader => braketSchemaHeader("braket.task_result.iqm_metadata", "1")) + struct SimulatorMetadata <: BraketSchemaBase braketSchemaHeader::braketSchemaHeader executionDuration::Int @@ -1097,6 +1104,7 @@ struct AdditionalMetadata ionqMetadata::Union{Nothing, IonQMetadata} rigettiMetadata::Union{Nothing, RigettiMetadata} oqcMetadata::Union{Nothing, OqcMetadata} + iqmMetadata::Union{Nothing, IqmMetadata} xanaduMetadata::Union{Nothing, XanaduMetadata} queraMetadata::Union{Nothing, QueraMetadata} simulatorMetadata::Union{Nothing, SimulatorMetadata} @@ -1420,6 +1428,33 @@ end StructTypes.StructType(::Type{OqcDeviceParameters}) = StructTypes.UnorderedStruct() StructTypes.defaults(::Type{OqcDeviceParameters}) = Dict{Symbol, Any}(:braketSchemaHeader => braketSchemaHeader("braket.device_schema.oqc.oqc_device_parameters", "1")) +struct IqmProviderProperties <: BraketSchemaBase + braketSchemaHeader::braketSchemaHeader + properties::Dict{String, Dict{String, QubitType}} +end +StructTypes.StructType(::Type{IqmProviderProperties}) = StructTypes.UnorderedStruct() +StructTypes.defaults(::Type{IqmProviderProperties}) = Dict{Symbol, Any}(:braketSchemaHeader => braketSchemaHeader("braket.device_schema.iqm.iqm_provider_properties", "1")) + +struct IqmDeviceCapabilities <: BraketSchemaBase + service::DeviceServiceProperties + action::Dict{Union{DeviceActionType, String}, Union{OpenQASMDeviceActionProperties, JaqcdDeviceActionProperties}} + deviceParameters::Dict + braketSchemaHeader::braketSchemaHeader + paradigm::GateModelQpuParadigmProperties + provider::Union{Nothing, IqmProviderProperties} + standardized::Union{Nothing, StandardizedGateModelQpuDeviceProperties} + pulse::Union{Nothing, PulseDeviceActionProperties} +end +StructTypes.StructType(::Type{IqmDeviceCapabilities}) = StructTypes.UnorderedStruct() +StructTypes.defaults(::Type{IqmDeviceCapabilities}) = Dict{Symbol, Any}(:braketSchemaHeader => braketSchemaHeader("braket.device_schema.iqm.iqm_device_capabilities", "1")) + +struct IqmDeviceParameters <: BraketSchemaBase + braketSchemaHeader::braketSchemaHeader + paradigmParameters::GateModelParameters +end +StructTypes.StructType(::Type{IqmDeviceParameters}) = StructTypes.UnorderedStruct() +StructTypes.defaults(::Type{IqmDeviceParameters}) = Dict{Symbol, Any}(:braketSchemaHeader => braketSchemaHeader("braket.device_schema.iqm.iqm_device_parameters", "1")) + struct NativeGateCalibrations <: BraketSchemaBase braketSchemaHeader::braketSchemaHeader gates::Dict{String, Dict{String, Vector{NativeGate}}} @@ -1557,7 +1592,7 @@ struct TaskMetadata <: BraketSchemaBase id::String shots::Int deviceId::String - deviceParameters::Union{Nothing, Union{DwaveDeviceParameters, DwaveAdvantageDeviceParameters, Dwave2000QDeviceParameters, RigettiDeviceParameters, IonqDeviceParameters, OqcDeviceParameters, GateModelSimulatorDeviceParameters, XanaduDeviceParameters, Nothing}} + deviceParameters::Union{Nothing, Union{DwaveDeviceParameters, DwaveAdvantageDeviceParameters, Dwave2000QDeviceParameters, RigettiDeviceParameters, IonqDeviceParameters, OqcDeviceParameters, IqmDeviceParameters, GateModelSimulatorDeviceParameters, XanaduDeviceParameters, Nothing}} createdAt::Union{Nothing, String} endedAt::Union{Nothing, String} status::Union{Nothing, String} @@ -1620,8 +1655,8 @@ struct GenericDeviceActionProperties <: DeviceActionProperties end StructTypes.StructType(::Type{GenericDeviceActionProperties}) = StructTypes.UnorderedStruct() -const type_dict = Dict{String, DataType}("braket.device_schema.gate_model_qpu_paradigm_properties_v1"=>GateModelQpuParadigmProperties, "braket.device_schema.oqc.oqc_device_capabilities_v1"=>OqcDeviceCapabilities, "braket.device_schema.dwave.dwave_advantage_device_level_parameters_v1"=>DwaveAdvantageDeviceLevelParameters, "braket.device_schema.ionq.ionq_device_capabilities_v1"=>IonqDeviceCapabilities, "braket.device_schema.ionq.ionq_device_parameters_v1"=>IonqDeviceParameters, "braket.device_schema.quera.quera_device_capabilities_v1"=>QueraDeviceCapabilities, "braket.device_schema.standardized_gate_model_qpu_device_properties_v1"=>StandardizedGateModelQpuDeviceProperties, "braket.device_schema.xanadu.xanadu_device_capabilities_v1"=>XanaduDeviceCapabilities, "braket.device_schema.dwave.dwave_device_parameters_v1"=>DwaveDeviceParameters, "braket.task_result.dwave_metadata_v1"=>DwaveMetadata, "braket.device_schema.dwave.dwave_2000Q_device_level_parameters_v1"=>Dwave2000QDeviceLevelParameters, "braket.task_result.quera_metadata_v1"=>QueraMetadata, "braket.device_schema.oqc.oqc_provider_properties_v1"=>OqcProviderProperties, "braket.device_schema.device_service_properties_v1"=>DeviceServiceProperties, "braket.device_schema.xanadu.xanadu_device_parameters_v1"=>XanaduDeviceParameters, "braket.ir.blackbird.program_v1"=>BlackbirdProgram, "braket.device_schema.dwave.dwave_provider_properties_v1"=>DwaveProviderProperties, "braket.device_schema.rigetti.rigetti_device_capabilities_v1"=>RigettiDeviceCapabilities, "braket.task_result.annealing_task_result_v1"=>AnnealingTaskResult, "braket.device_schema.dwave.dwave_provider_level_parameters_v1"=>DwaveProviderLevelParameters, "braket.device_schema.pulse.pulse_device_action_properties_v1"=>PulseDeviceActionProperties, "braket.device_schema.ionq.ionq_provider_properties_v1"=>IonqProviderProperties, "braket.task_result.photonic_model_task_result_v1"=>PhotonicModelTaskResult, "braket.device_schema.continuous_variable_qpu_paradigm_properties_v1"=>ContinuousVariableQpuParadigmProperties, "braket.device_schema.xanadu.xanadu_provider_properties_v1"=>XanaduProviderProperties, "braket.device_schema.pulse.native_gate_calibrations_v1"=>NativeGateCalibrations, "braket.device_schema.dwave.dwave_advantage_device_parameters_v1"=>DwaveAdvantageDeviceParameters, "braket.device_schema.rigetti.rigetti_device_parameters_v1"=>RigettiDeviceParameters, "braket.ir.ahs.program_v1"=>AHSProgram, "braket.ir.jaqcd.program_v1"=>Program, "braket.task_result.task_metadata_v1"=>TaskMetadata, "braket.task_result.analog_hamiltonian_simulation_task_result_v1"=>AnalogHamiltonianSimulationTaskResult, "braket.device_schema.simulators.gate_model_simulator_paradigm_properties_v1"=>GateModelSimulatorParadigmProperties, "braket.task_result.gate_model_task_result_v1"=>GateModelTaskResult, "braket.task_result.ionq_metadata_v1"=>IonQMetadata, "braket.device_schema.rigetti.rigetti_provider_properties_v1"=>RigettiProviderProperties, "braket.device_schema.oqc.oqc_device_parameters_v1"=>OqcDeviceParameters, "braket.device_schema.simulators.gate_model_simulator_device_capabilities_v1"=>GateModelSimulatorDeviceCapabilities, "braket.task_result.xanadu_metadata_v1"=>XanaduMetadata, "braket.device_schema.gate_model_parameters_v1"=>GateModelParameters, "braket.device_schema.simulators.gate_model_simulator_device_parameters_v1"=>GateModelSimulatorDeviceParameters, "braket.task_result.oqc_metadata_v1"=>OqcMetadata, "braket.device_schema.dwave.dwave_device_capabilities_v1"=>DwaveDeviceCapabilities, "braket.device_schema.quera.quera_ahs_paradigm_properties_v1"=>QueraAhsParadigmProperties, "braket.jobs_data.persisted_job_data_v1"=>PersistedJobData, "braket.task_result.rigetti_metadata_v1"=>RigettiMetadata, "braket.task_result.simulator_metadata_v1"=>SimulatorMetadata, "braket.ir.annealing.problem_v1"=>Problem, "braket.device_schema.dwave.dwave_2000Q_device_parameters_v1"=>Dwave2000QDeviceParameters, "braket.ir.openqasm.program_v1"=>OpenQasmProgram) -const header_dict = Dict{DataType, braketSchemaHeader}(GateModelQpuParadigmProperties=>braketSchemaHeader("braket.device_schema.gate_model_qpu_paradigm_properties", "1"), OqcDeviceCapabilities=>braketSchemaHeader("braket.device_schema.oqc.oqc_device_capabilities", "1"), DwaveAdvantageDeviceLevelParameters=>braketSchemaHeader("braket.device_schema.dwave.dwave_advantage_device_level_parameters", "1"), IonqDeviceCapabilities=>braketSchemaHeader("braket.device_schema.ionq.ionq_device_capabilities", "1"), IonqDeviceParameters=>braketSchemaHeader("braket.device_schema.ionq.ionq_device_parameters", "1"), QueraDeviceCapabilities=>braketSchemaHeader("braket.device_schema.quera.quera_device_capabilities", "1"), StandardizedGateModelQpuDeviceProperties=>braketSchemaHeader("braket.device_schema.standardized_gate_model_qpu_device_properties", "1"), XanaduDeviceCapabilities=>braketSchemaHeader("braket.device_schema.xanadu.xanadu_device_capabilities", "1"), DwaveDeviceParameters=>braketSchemaHeader("braket.device_schema.dwave.dwave_device_parameters", "1"), DwaveMetadata=>braketSchemaHeader("braket.task_result.dwave_metadata", "1"), Dwave2000QDeviceLevelParameters=>braketSchemaHeader("braket.device_schema.dwave.dwave_2000Q_device_level_parameters", "1"), QueraMetadata=>braketSchemaHeader("braket.task_result.quera_metadata", "1"), OqcProviderProperties=>braketSchemaHeader("braket.device_schema.oqc.oqc_provider_properties", "1"), DeviceServiceProperties=>braketSchemaHeader("braket.device_schema.device_service_properties", "1"), XanaduDeviceParameters=>braketSchemaHeader("braket.device_schema.xanadu.xanadu_device_parameters", "1"), BlackbirdProgram=>braketSchemaHeader("braket.ir.blackbird.program", "1"), DwaveProviderProperties=>braketSchemaHeader("braket.device_schema.dwave.dwave_provider_properties", "1"), RigettiDeviceCapabilities=>braketSchemaHeader("braket.device_schema.rigetti.rigetti_device_capabilities", "1"), AnnealingTaskResult=>braketSchemaHeader("braket.task_result.annealing_task_result", "1"), DwaveProviderLevelParameters=>braketSchemaHeader("braket.device_schema.dwave.dwave_provider_level_parameters", "1"), PulseDeviceActionProperties=>braketSchemaHeader("braket.device_schema.pulse.pulse_device_action_properties", "1"), IonqProviderProperties=>braketSchemaHeader("braket.device_schema.ionq.ionq_provider_properties", "1"), PhotonicModelTaskResult=>braketSchemaHeader("braket.task_result.photonic_model_task_result", "1"), ContinuousVariableQpuParadigmProperties=>braketSchemaHeader("braket.device_schema.continuous_variable_qpu_paradigm_properties", "1"), XanaduProviderProperties=>braketSchemaHeader("braket.device_schema.xanadu.xanadu_provider_properties", "1"), NativeGateCalibrations=>braketSchemaHeader("braket.device_schema.pulse.native_gate_calibrations", "1"), DwaveAdvantageDeviceParameters=>braketSchemaHeader("braket.device_schema.dwave.dwave_advantage_device_parameters", "1"), RigettiDeviceParameters=>braketSchemaHeader("braket.device_schema.rigetti.rigetti_device_parameters", "1"), AHSProgram=>braketSchemaHeader("braket.ir.ahs.program", "1"), Program=>braketSchemaHeader("braket.ir.jaqcd.program", "1"), TaskMetadata=>braketSchemaHeader("braket.task_result.task_metadata", "1"), AnalogHamiltonianSimulationTaskResult=>braketSchemaHeader("braket.task_result.analog_hamiltonian_simulation_task_result", "1"), GateModelSimulatorParadigmProperties=>braketSchemaHeader("braket.device_schema.simulators.gate_model_simulator_paradigm_properties", "1"), GateModelTaskResult=>braketSchemaHeader("braket.task_result.gate_model_task_result", "1"), IonQMetadata=>braketSchemaHeader("braket.task_result.ionq_metadata", "1"), RigettiProviderProperties=>braketSchemaHeader("braket.device_schema.rigetti.rigetti_provider_properties", "1"), OqcDeviceParameters=>braketSchemaHeader("braket.device_schema.oqc.oqc_device_parameters", "1"), GateModelSimulatorDeviceCapabilities=>braketSchemaHeader("braket.device_schema.simulators.gate_model_simulator_device_capabilities", "1"), XanaduMetadata=>braketSchemaHeader("braket.task_result.xanadu_metadata", "1"), GateModelParameters=>braketSchemaHeader("braket.device_schema.gate_model_parameters", "1"), GateModelSimulatorDeviceParameters=>braketSchemaHeader("braket.device_schema.simulators.gate_model_simulator_device_parameters", "1"), OqcMetadata=>braketSchemaHeader("braket.task_result.oqc_metadata", "1"), DwaveDeviceCapabilities=>braketSchemaHeader("braket.device_schema.dwave.dwave_device_capabilities", "1"), QueraAhsParadigmProperties=>braketSchemaHeader("braket.device_schema.quera.quera_ahs_paradigm_properties", "1"), PersistedJobData=>braketSchemaHeader("braket.jobs_data.persisted_job_data", "1"), RigettiMetadata=>braketSchemaHeader("braket.task_result.rigetti_metadata", "1"), SimulatorMetadata=>braketSchemaHeader("braket.task_result.simulator_metadata", "1"), Problem=>braketSchemaHeader("braket.ir.annealing.problem", "1"), Dwave2000QDeviceParameters=>braketSchemaHeader("braket.device_schema.dwave.dwave_2000Q_device_parameters", "1"), OpenQasmProgram=>braketSchemaHeader("braket.ir.openqasm.program", "1")) +const type_dict = Dict{String, DataType}("braket.device_schema.gate_model_qpu_paradigm_properties_v1"=>GateModelQpuParadigmProperties, "braket.device_schema.oqc.oqc_device_capabilities_v1"=>OqcDeviceCapabilities, "braket.device_schema.iqm.iqm_device_capabilities_v1"=>IqmDeviceCapabilities, "braket.device_schema.dwave.dwave_advantage_device_level_parameters_v1"=>DwaveAdvantageDeviceLevelParameters, "braket.device_schema.ionq.ionq_device_capabilities_v1"=>IonqDeviceCapabilities, "braket.device_schema.ionq.ionq_device_parameters_v1"=>IonqDeviceParameters, "braket.device_schema.quera.quera_device_capabilities_v1"=>QueraDeviceCapabilities, "braket.device_schema.standardized_gate_model_qpu_device_properties_v1"=>StandardizedGateModelQpuDeviceProperties, "braket.device_schema.xanadu.xanadu_device_capabilities_v1"=>XanaduDeviceCapabilities, "braket.device_schema.dwave.dwave_device_parameters_v1"=>DwaveDeviceParameters, "braket.task_result.dwave_metadata_v1"=>DwaveMetadata, "braket.device_schema.dwave.dwave_2000Q_device_level_parameters_v1"=>Dwave2000QDeviceLevelParameters, "braket.task_result.quera_metadata_v1"=>QueraMetadata, "braket.device_schema.oqc.oqc_provider_properties_v1"=>OqcProviderProperties, "braket.device_schema.iqm.iqm_provider_properties_v1"=>IqmProviderProperties, "braket.device_schema.device_service_properties_v1"=>DeviceServiceProperties, "braket.device_schema.xanadu.xanadu_device_parameters_v1"=>XanaduDeviceParameters, "braket.ir.blackbird.program_v1"=>BlackbirdProgram, "braket.device_schema.dwave.dwave_provider_properties_v1"=>DwaveProviderProperties, "braket.device_schema.rigetti.rigetti_device_capabilities_v1"=>RigettiDeviceCapabilities, "braket.task_result.annealing_task_result_v1"=>AnnealingTaskResult, "braket.device_schema.dwave.dwave_provider_level_parameters_v1"=>DwaveProviderLevelParameters, "braket.device_schema.pulse.pulse_device_action_properties_v1"=>PulseDeviceActionProperties, "braket.device_schema.ionq.ionq_provider_properties_v1"=>IonqProviderProperties, "braket.task_result.photonic_model_task_result_v1"=>PhotonicModelTaskResult, "braket.device_schema.continuous_variable_qpu_paradigm_properties_v1"=>ContinuousVariableQpuParadigmProperties, "braket.device_schema.xanadu.xanadu_provider_properties_v1"=>XanaduProviderProperties, "braket.device_schema.pulse.native_gate_calibrations_v1"=>NativeGateCalibrations, "braket.device_schema.dwave.dwave_advantage_device_parameters_v1"=>DwaveAdvantageDeviceParameters, "braket.device_schema.rigetti.rigetti_device_parameters_v1"=>RigettiDeviceParameters, "braket.ir.ahs.program_v1"=>AHSProgram, "braket.ir.jaqcd.program_v1"=>Program, "braket.task_result.task_metadata_v1"=>TaskMetadata, "braket.task_result.analog_hamiltonian_simulation_task_result_v1"=>AnalogHamiltonianSimulationTaskResult, "braket.device_schema.simulators.gate_model_simulator_paradigm_properties_v1"=>GateModelSimulatorParadigmProperties, "braket.task_result.gate_model_task_result_v1"=>GateModelTaskResult, "braket.task_result.ionq_metadata_v1"=>IonQMetadata, "braket.device_schema.rigetti.rigetti_provider_properties_v1"=>RigettiProviderProperties, "braket.device_schema.oqc.oqc_device_parameters_v1"=>OqcDeviceParameters, "braket.device_schema.iqm.iqm_device_parameters_v1"=>IqmDeviceParameters, "braket.device_schema.simulators.gate_model_simulator_device_capabilities_v1"=>GateModelSimulatorDeviceCapabilities, "braket.task_result.xanadu_metadata_v1"=>XanaduMetadata, "braket.device_schema.gate_model_parameters_v1"=>GateModelParameters, "braket.device_schema.simulators.gate_model_simulator_device_parameters_v1"=>GateModelSimulatorDeviceParameters, "braket.task_result.oqc_metadata_v1"=>OqcMetadata, "braket.task_result.iqm_metadata_v1"=>IqmMetadata, "braket.device_schema.dwave.dwave_device_capabilities_v1"=>DwaveDeviceCapabilities, "braket.device_schema.quera.quera_ahs_paradigm_properties_v1"=>QueraAhsParadigmProperties, "braket.jobs_data.persisted_job_data_v1"=>PersistedJobData, "braket.task_result.rigetti_metadata_v1"=>RigettiMetadata, "braket.task_result.simulator_metadata_v1"=>SimulatorMetadata, "braket.ir.annealing.problem_v1"=>Problem, "braket.device_schema.dwave.dwave_2000Q_device_parameters_v1"=>Dwave2000QDeviceParameters, "braket.ir.openqasm.program_v1"=>OpenQasmProgram) +const header_dict = Dict{DataType, braketSchemaHeader}(GateModelQpuParadigmProperties=>braketSchemaHeader("braket.device_schema.gate_model_qpu_paradigm_properties", "1"), OqcDeviceCapabilities=>braketSchemaHeader("braket.device_schema.oqc.oqc_device_capabilities", "1"), IqmDeviceCapabilities=>braketSchemaHeader("braket.device_schema.iqm.iqm_device_capabilities", "1"), DwaveAdvantageDeviceLevelParameters=>braketSchemaHeader("braket.device_schema.dwave.dwave_advantage_device_level_parameters", "1"), IonqDeviceCapabilities=>braketSchemaHeader("braket.device_schema.ionq.ionq_device_capabilities", "1"), IonqDeviceParameters=>braketSchemaHeader("braket.device_schema.ionq.ionq_device_parameters", "1"), QueraDeviceCapabilities=>braketSchemaHeader("braket.device_schema.quera.quera_device_capabilities", "1"), StandardizedGateModelQpuDeviceProperties=>braketSchemaHeader("braket.device_schema.standardized_gate_model_qpu_device_properties", "1"), XanaduDeviceCapabilities=>braketSchemaHeader("braket.device_schema.xanadu.xanadu_device_capabilities", "1"), DwaveDeviceParameters=>braketSchemaHeader("braket.device_schema.dwave.dwave_device_parameters", "1"), DwaveMetadata=>braketSchemaHeader("braket.task_result.dwave_metadata", "1"), Dwave2000QDeviceLevelParameters=>braketSchemaHeader("braket.device_schema.dwave.dwave_2000Q_device_level_parameters", "1"), QueraMetadata=>braketSchemaHeader("braket.task_result.quera_metadata", "1"), OqcProviderProperties=>braketSchemaHeader("braket.device_schema.oqc.oqc_provider_properties", "1"), IqmProviderProperties=>braketSchemaHeader("braket.device_schema.iqm.iqm_provider_properties", "1"), DeviceServiceProperties=>braketSchemaHeader("braket.device_schema.device_service_properties", "1"), XanaduDeviceParameters=>braketSchemaHeader("braket.device_schema.xanadu.xanadu_device_parameters", "1"), BlackbirdProgram=>braketSchemaHeader("braket.ir.blackbird.program", "1"), DwaveProviderProperties=>braketSchemaHeader("braket.device_schema.dwave.dwave_provider_properties", "1"), RigettiDeviceCapabilities=>braketSchemaHeader("braket.device_schema.rigetti.rigetti_device_capabilities", "1"), AnnealingTaskResult=>braketSchemaHeader("braket.task_result.annealing_task_result", "1"), DwaveProviderLevelParameters=>braketSchemaHeader("braket.device_schema.dwave.dwave_provider_level_parameters", "1"), PulseDeviceActionProperties=>braketSchemaHeader("braket.device_schema.pulse.pulse_device_action_properties", "1"), IonqProviderProperties=>braketSchemaHeader("braket.device_schema.ionq.ionq_provider_properties", "1"), PhotonicModelTaskResult=>braketSchemaHeader("braket.task_result.photonic_model_task_result", "1"), ContinuousVariableQpuParadigmProperties=>braketSchemaHeader("braket.device_schema.continuous_variable_qpu_paradigm_properties", "1"), XanaduProviderProperties=>braketSchemaHeader("braket.device_schema.xanadu.xanadu_provider_properties", "1"), NativeGateCalibrations=>braketSchemaHeader("braket.device_schema.pulse.native_gate_calibrations", "1"), DwaveAdvantageDeviceParameters=>braketSchemaHeader("braket.device_schema.dwave.dwave_advantage_device_parameters", "1"), RigettiDeviceParameters=>braketSchemaHeader("braket.device_schema.rigetti.rigetti_device_parameters", "1"), AHSProgram=>braketSchemaHeader("braket.ir.ahs.program", "1"), Program=>braketSchemaHeader("braket.ir.jaqcd.program", "1"), TaskMetadata=>braketSchemaHeader("braket.task_result.task_metadata", "1"), AnalogHamiltonianSimulationTaskResult=>braketSchemaHeader("braket.task_result.analog_hamiltonian_simulation_task_result", "1"), GateModelSimulatorParadigmProperties=>braketSchemaHeader("braket.device_schema.simulators.gate_model_simulator_paradigm_properties", "1"), GateModelTaskResult=>braketSchemaHeader("braket.task_result.gate_model_task_result", "1"), IonQMetadata=>braketSchemaHeader("braket.task_result.ionq_metadata", "1"), RigettiProviderProperties=>braketSchemaHeader("braket.device_schema.rigetti.rigetti_provider_properties", "1"), OqcDeviceParameters=>braketSchemaHeader("braket.device_schema.oqc.oqc_device_parameters", "1"), IqmDeviceParameters=>braketSchemaHeader("braket.device_schema.iqm.iqm_device_parameters", "1"), GateModelSimulatorDeviceCapabilities=>braketSchemaHeader("braket.device_schema.simulators.gate_model_simulator_device_capabilities", "1"), XanaduMetadata=>braketSchemaHeader("braket.task_result.xanadu_metadata", "1"), GateModelParameters=>braketSchemaHeader("braket.device_schema.gate_model_parameters", "1"), GateModelSimulatorDeviceParameters=>braketSchemaHeader("braket.device_schema.simulators.gate_model_simulator_device_parameters", "1"), OqcMetadata=>braketSchemaHeader("braket.task_result.oqc_metadata", "1"), IqmMetadata=>braketSchemaHeader("braket.task_result.iqm_metadata", "1"), DwaveDeviceCapabilities=>braketSchemaHeader("braket.device_schema.dwave.dwave_device_capabilities", "1"), QueraAhsParadigmProperties=>braketSchemaHeader("braket.device_schema.quera.quera_ahs_paradigm_properties", "1"), PersistedJobData=>braketSchemaHeader("braket.jobs_data.persisted_job_data", "1"), RigettiMetadata=>braketSchemaHeader("braket.task_result.rigetti_metadata", "1"), SimulatorMetadata=>braketSchemaHeader("braket.task_result.simulator_metadata", "1"), Problem=>braketSchemaHeader("braket.ir.annealing.problem", "1"), Dwave2000QDeviceParameters=>braketSchemaHeader("braket.device_schema.dwave.dwave_2000Q_device_parameters", "1"), OpenQasmProgram=>braketSchemaHeader("braket.ir.openqasm.program", "1")) lookup_type(header::braketSchemaHeader) = type_dict[header.name * "_v" * header.version] diff --git a/src/task.jl b/src/task.jl index 16bb21af..3f88f684 100644 --- a/src/task.jl +++ b/src/task.jl @@ -137,6 +137,7 @@ function _device_parameters_from_dict(device_parameters::Dict{String,<:Any}, dev occursin("ionq", device_arn) && return IonqDeviceParameters(header_dict[IonqDeviceParameters], paradigm_parameters, processed_em) occursin("rigetti", device_arn) && return RigettiDeviceParameters(header_dict[RigettiDeviceParameters], paradigm_parameters) occursin("oqc", device_arn) && return OqcDeviceParameters(header_dict[OqcDeviceParameters], paradigm_parameters) + occursin("iqm", device_arn) && return IqmDeviceParameters(header_dict[IqmDeviceParameters], paradigm_parameters) return GateModelSimulatorDeviceParameters(header_dict[GateModelSimulatorDeviceParameters], paradigm_parameters) end diff --git a/test/annealing_task_result.jl b/test/annealing_task_result.jl index b1f30440..5be98d24 100644 --- a/test/annealing_task_result.jl +++ b/test/annealing_task_result.jl @@ -30,7 +30,7 @@ using Braket, JSON3, Test Dict(0=>0.3333, 1=>-0.333, 4=>-0.333, 5=>0.333), Dict("0,4"=> 0.667, "0,5"=> -1, "1,4"=> 0.667, "1,5"=> 0.667), ) - additional_metadata = Braket.AdditionalMetadata(problem, dwave_metadata, nothing, nothing, nothing, nothing, nothing, nothing) + additional_metadata = Braket.AdditionalMetadata(problem, dwave_metadata, nothing, nothing, nothing, nothing, nothing, nothing, nothing) function result_str_1() result = Braket.AnnealingTaskResult(Braket.header_dict[Braket.AnnealingTaskResult], solutions, diff --git a/test/gate_model_task_result.jl b/test/gate_model_task_result.jl index da982b4a..ab7b5195 100644 --- a/test/gate_model_task_result.jl +++ b/test/gate_model_task_result.jl @@ -33,7 +33,7 @@ non_zero_shots_result(task_mtd, add_mtd) = Braket.GateModelTaskResult( action = Braket.Program(c) @testset for (shots, result) in zip([0, 100], [zero_shots_result, non_zero_shots_result]) task_metadata = Braket.TaskMetadata(Braket.header_dict[Braket.TaskMetadata], "task_arn", shots, "arn1", nothing, nothing, nothing, nothing, nothing) - additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing) + additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing) r = result(task_metadata, additional_metadata) g = Braket.format_result(r) @test g isa Braket.GateModelQuantumTaskResult @@ -45,7 +45,7 @@ non_zero_shots_result(task_mtd, add_mtd) = Braket.GateModelTaskResult( end end task_metadata = Braket.TaskMetadata(Braket.header_dict[Braket.TaskMetadata], "task_arn", 0, "arn1", nothing, nothing, nothing, nothing, nothing) - additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing) + additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing) result = Braket.GateModelQuantumTaskResult(task_metadata, JSON3.read(JSON3.write(additional_metadata), Braket.AdditionalMetadata), nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing) @test JSON3.read("{\"task_metadata\": $(JSON3.write(task_metadata)), \"additional_metadata\": $(JSON3.write(additional_metadata))}", Braket.GateModelQuantumTaskResult) == result end @@ -78,7 +78,7 @@ end ], []) task_metadata_shots = Braket.TaskMetadata(Braket.header_dict[Braket.TaskMetadata], "task_arn", length(measurements), "arn1", nothing, nothing, nothing, nothing, nothing) - additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing) + additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing) task_result = Braket.GateModelTaskResult(Braket.header_dict[Braket.GateModelTaskResult], measurements, nothing, @@ -104,7 +104,7 @@ end ], []) task_metadata_shots = Braket.TaskMetadata(Braket.header_dict[Braket.TaskMetadata], "task_arn", length(measurements), "arn1", nothing, nothing, nothing, nothing, nothing) - additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing) + additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing) task_result = Braket.GateModelTaskResult(Braket.header_dict[Braket.GateModelTaskResult], measurements, nothing, @@ -120,7 +120,7 @@ end @testset "result without measurements or measurementProbabilities" begin task_metadata_shots = Braket.TaskMetadata(Braket.header_dict[Braket.TaskMetadata], "task_arn", length(measurements), "arn1", nothing, nothing, nothing, nothing, nothing) - additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing) + additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing) task_result = Braket.GateModelTaskResult(Braket.header_dict[Braket.GateModelTaskResult], nothing, nothing, @@ -134,7 +134,7 @@ end @testset "bad result type in results for shots > 0" begin action = Braket.Program(Braket.header_dict[Braket.Program], [Braket.IR.CNot(0, 1, "cnot"), Braket.IR.CNot(2, 3, "cnot")], [Braket.IR.DensityMatrix([1,3], "densitymatrix")], []) task_metadata_shots = Braket.TaskMetadata(Braket.header_dict[Braket.TaskMetadata], "task_arn", length(measurements), "arn1", nothing, nothing, nothing, nothing, nothing) - additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing) + additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing) task_result = Braket.GateModelTaskResult(Braket.header_dict[Braket.GateModelTaskResult], measurements, nothing, diff --git a/test/integ_tests/cost_tracking.jl b/test/integ_tests/cost_tracking.jl index e877ad06..c0cc9cc6 100644 --- a/test/integ_tests/cost_tracking.jl +++ b/test/integ_tests/cost_tracking.jl @@ -7,7 +7,7 @@ using AWS: @service, AWSConfig, global_aws_config circuit = Circuit([(H, 0)]) t = Braket.Tracker() n_available = 0 - for arn = ("arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy", "arn:aws:braket:us-west-1::device/qpu/rigetti/Aspen-M-3", "arn:aws:braket:us-east-1::device/qpu/ionq/Harmony") + for arn = ("arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy", "arn:aws:braket:eu-north-1::device/qpu/iqm/Garnet", "arn:aws:braket:us-west-1::device/qpu/rigetti/Aspen-M-3", "arn:aws:braket:us-east-1::device/qpu/ionq/Harmony") d = AwsDevice(arn) if Braket.isavailable(d) d(circuit, shots=10) diff --git a/test/integ_tests/device_creation.jl b/test/integ_tests/device_creation.jl index 6fbb66ed..9214711a 100644 --- a/test/integ_tests/device_creation.jl +++ b/test/integ_tests/device_creation.jl @@ -1,13 +1,12 @@ using Braket, Test -DWAVE_ARN = "arn:aws:braket:::device/qpu/d-wave/DW_2000Q_6" -RIGETTI_ARN = "arn:aws:braket:::device/qpu/rigetti/Aspen-11" +RIGETTI_ARN = "arn:aws:braket:::device/qpu/rigetti/Aspen-M-3" IONQ_ARN = "arn:aws:braket:us-east-1::device/qpu/ionq/Aria-1" SIMULATOR_ARN = "arn:aws:braket:::device/quantum-simulator/amazon/sv1" -OQC_ARN = "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" +IQM_ARN = "arn:aws:braket:eu-north-1::device/qpu/iqm/Garnet" @testset "Device Creation" begin - @testset for dev_arn in (RIGETTI_ARN, IONQ_ARN, DWAVE_ARN, OQC_ARN, SIMULATOR_ARN) + @testset for dev_arn in (RIGETTI_ARN, IONQ_ARN, IQM_ARN, SIMULATOR_ARN) device = AwsDevice(dev_arn) @test arn(device) == dev_arn @test !isnothing(name(device)) && !isempty(name(device)) @@ -17,7 +16,7 @@ OQC_ARN = "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" @test !isnothing(properties(device)) end @testset "get_devices" begin - @testset for dev_arn in [RIGETTI_ARN, IONQ_ARN, DWAVE_ARN, OQC_ARN, SIMULATOR_ARN] + @testset for dev_arn in [RIGETTI_ARN, IONQ_ARN, IQM_ARN, SIMULATOR_ARN] results = get_devices(arns=[dev_arn]) @test arn(first(results)) == dev_arn end @@ -35,7 +34,7 @@ OQC_ARN = "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" end @testset "all" begin result_arns = arn.(get_devices()) - for dev_arn in [DWAVE_ARN, RIGETTI_ARN, IONQ_ARN, SIMULATOR_ARN, OQC_ARN] + for dev_arn in [RIGETTI_ARN, IONQ_ARN, SIMULATOR_ARN, IQM_ARN] @test dev_arn ∈ result_arns end end diff --git a/test/integ_tests/measure.jl b/test/integ_tests/measure.jl index 0b16972d..dd761169 100644 --- a/test/integ_tests/measure.jl +++ b/test/integ_tests/measure.jl @@ -5,6 +5,7 @@ SHOTS = 8000 IONQ_ARN = "arn:aws:braket:us-east-1::device/qpu/ionq/Harmony" SIMULATOR_ARN = "arn:aws:braket:::device/quantum-simulator/amazon/sv1" OQC_ARN = "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" +IQM_ARN = "arn:aws:braket:eu-north-1::device/qpu/iqm/Garnet" @testset "Measure operator" begin @testset "Unsupported devices" begin @@ -17,7 +18,7 @@ OQC_ARN = "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" end end @testset "Supported devices" begin - @testset "Arn $arn" for arn in (OQC_ARN,) + @testset "Arn $arn" for arn in (OQC_ARN, IQM_ARN) device = AwsDevice(arn) status(device) == "OFFLINE" && continue circ = Circuit([(H, 0), (CNot, 0, 1), (Measure, 0)]) diff --git a/test/iqm_device.jl b/test/iqm_device.jl new file mode 100644 index 00000000..f96dfc0e --- /dev/null +++ b/test/iqm_device.jl @@ -0,0 +1,323 @@ +using Braket, Test + +@testset "IQM device schema" begin + @testset "Device capabilities" begin + props = """{ + "braketSchemaHeader": { + "name": "braket.device_schema.standardized_gate_model_qpu_device_properties", + "version": "1" + }, + "oneQubitProperties": { + "0": { + "T1": {"value": 28.9, "standardError": 0.01, "unit": "us"}, + "T2": {"value": 44.5, "standardError": 0.02, "unit": "us"}, + "oneQubitFidelity": [ + { + "fidelityType": {"name": "readout"}, + "fidelity": 0.9993, + "standardError": null + }, + { + "fidelityType": {"name": "randomized_benchmarking"}, + "fidelity": 0.903, + "standardError": null + } + ] + } + }, + "twoQubitProperties": { + "0-1": { + "twoQubitGateFidelity": [ + { + "direction": {"control": 0, "target": 1}, + "gateName": "cnot", + "fidelity": 0.877, + "fidelityType": {"name": "interleaved_randomized_benchmarking"} + } + ] + } + } + }""" + jaqcd() = """{ + "braketSchemaHeader": { + "name": "braket.device_schema.iqm.iqm_device_capabilities", + "version": "1" + }, + "service": { + "braketSchemaHeader": { + "name": "braket.device_schema.device_service_properties", + "version": "1" + }, + "executionWindows": [ + {"executionDay": "Everyday", "windowStartHour": "11:00", "windowEndHour": "12:00"} + ], + "shotsRange": [1, 10], + "deviceCost": {"price": 0.25, "unit": "minute"}, + "deviceDocumentation": { + "imageUrl": "image_url", + "summary": "Summary on the device", + "externalDocumentationUrl": "exter doc link" + }, + "deviceLocation": "eu-west-2", + "updatedAt": "2020-06-16T19:28:02.869136" + }, + "action": { + "braket.ir.jaqcd.program": { + "actionType": "braket.ir.jaqcd.program", + "version": ["1"], + "supportedOperations": ["x", "y"], + "supportedResultTypes": [ + { + "name": "resultType1", + "observables": ["observable1"], + "minShots": 2, + "maxShots": 4 + } + ] + } + }, + "paradigm": { + "braketSchemaHeader": { + "name": "braket.device_schema.gate_model_qpu_paradigm_properties", + "version": "1" + }, + "qubitCount": 32, + "nativeGateSet": ["ccnot", "cy"], + "connectivity": {"fullyConnected": false, "connectivityGraph": {"1": ["2", "3"]}} + }, + "deviceParameters": {} + } + """ + openqasm() = """{ + "braketSchemaHeader": { + "name": "braket.device_schema.iqm.iqm_device_capabilities", + "version": "1" + }, + "service": { + "braketSchemaHeader": { + "name": "braket.device_schema.device_service_properties", + "version": "1" + }, + "executionWindows": [ + {"executionDay": "Everyday", "windowStartHour": "11:00", "windowEndHour": "12:00"} + ], + "shotsRange": [1, 10], + "deviceCost": {"price": 0.25, "unit": "minute"}, + "deviceDocumentation": { + "imageUrl": "image_url", + "summary": "Summary on the device", + "externalDocumentationUrl": "exter doc link" + }, + "deviceLocation": "us-east-1", + "updatedAt": "2020-06-16T19:28:02.869136" + }, + "action": { + "braket.ir.openqasm.program": { + "actionType": "braket.ir.openqasm.program", + "version": ["1"], + "supportedOperations": ["x", "y"], + "supportedResultTypes": [ + { + "name": "resultType1", + "observables": ["observable1"], + "minShots": 2, + "maxShots": 4 + } + ], + "supportPhysicalQubits": false, + "supportedPragmas": ["braket_noise_bit_flip"], + "forbiddenPragmas": ["braket_unitary_matrix"], + "forbiddenArrayOperations": ["concatenation", "range", "slicing"], + "requireAllQubitsMeasurement": false, + "requireContiguousQubitIndices": false, + "supportsPartialVerbatimBox": false, + "supportsUnassignedMeasurements": false + } + }, + "paradigm": { + "braketSchemaHeader": { + "name": "braket.device_schema.gate_model_qpu_paradigm_properties", + "version": "1" + }, + "qubitCount": 32, + "nativeGateSet": ["ccnot", "cy"], + "connectivity": {"fullyConnected": false, "connectivityGraph": {"1": ["2", "3"]}} + }, + "deviceParameters": {}, + "standardized": $props + } + """ + @testset for format in [jaqcd, openqasm] + @test Braket.parse_raw_schema(format()) isa Braket.IqmDeviceCapabilities + end + end + @testset "Device parameters" begin + ir_gen() = """{ + "braketSchemaHeader": { + "name": "braket.device_schema.iqm.iqm_device_parameters", + "version": "1" + }, + "paradigmParameters": { + "braketSchemaHeader": { + "name": "braket.device_schema.gate_model_parameters", + "version": "1" + }, + "qubitCount": 1 + } + } + """ + @test Braket.parse_raw_schema(ir_gen()) isa Braket.IqmDeviceParameters + end + @testset "Provider properties" begin + ir_gen() = """{ + "braketSchemaHeader": { + "name": "braket.device_schema.iqm.iqm_provider_properties", + "version": "1" + }, + "properties": { + "one_qubit": { + "0": { + "T1": 12.2, + "T2": 13.5, + "fRO": 0.99, + "fRB": 0.98, + "native_gate_fidelities": [ + {"native_gate": "rz", "CLf": 0.99}, + {"native_gate": "sx", "CLf": 0.99}, + {"native_gate": "x", "CLf": 0.99} + ], + "EPE": 0.001 + }, + "1": { + "T1": 12.2, + "T2": 13.5, + "fRO": 0.99, + "fRB": 0.98, + "native_gate_fidelities": [ + {"native_gate": "rz", "CLf": 0.99}, + {"native_gate": "sx", "CLf": 0.99}, + {"native_gate": "x", "CLf": 0.99} + ], + "EPE": 0.001 + }, + "2": { + "T1": 12.2, + "T2": 13.5, + "fRO": 0.99, + "fRB": 0.98, + "native_gate_fidelities": [ + {"native_gate": "rz", "CLf": 0.99}, + {"native_gate": "sx", "CLf": 0.99}, + {"native_gate": "x", "CLf": 0.99} + ], + "EPE": 0.001 + }, + "3": { + "T1": 12.2, + "T2": 13.5, + "fRO": 0.99, + "fRB": 0.98, + "native_gate_fidelities": [ + {"native_gate": "rz", "CLf": 0.99}, + {"native_gate": "sx", "CLf": 0.99}, + {"native_gate": "x", "CLf": 0.99} + ], + "EPE": 0.001 + }, + "4": { + "T1": 12.2, + "T2": 13.5, + "fRO": 0.99, + "fRB": 0.98, + "native_gate_fidelities": [ + {"native_gate": "rz", "CLf": 0.99}, + {"native_gate": "sx", "CLf": 0.99}, + {"native_gate": "x", "CLf": 0.99} + ], + "EPE": 0.001 + }, + "5": { + "T1": 12.2, + "T2": 13.5, + "fRO": 0.99, + "fRB": 0.98, + "native_gate_fidelities": [ + {"native_gate": "rz", "CLf": 0.99}, + {"native_gate": "sx", "CLf": 0.99}, + {"native_gate": "x", "CLf": 0.99} + ], + "EPE": 0.001 + }, + "6": { + "T1": 12.2, + "T2": 13.5, + "fRO": 0.99, + "fRB": 0.98, + "native_gate_fidelities": [ + {"native_gate": "rz", "CLf": 0.99}, + {"native_gate": "sx", "CLf": 0.99}, + {"native_gate": "x", "CLf": 0.99} + ], + "EPE": 0.001 + }, + "7": { + "T1": 12.2, + "T2": 13.5, + "fRO": 0.99, + "fRB": 0.98, + "native_gate_fidelities": [ + {"native_gate": "rz", "CLf": 0.99}, + {"native_gate": "sx", "CLf": 0.99}, + {"native_gate": "x", "CLf": 0.99} + ], + "EPE": 0.001 + } + }, + "two_qubit": { + "0-1": { + "coupling": {"control_qubit": 0, "target_qubit": 1}, + "CLf": 0.99, + "ECR_f": 0.99 + }, + "1-2": { + "coupling": {"control_qubit": 1, "target_qubit": 2}, + "CLf": 0.99, + "ECR_f": 0.99 + }, + "2-3": { + "coupling": {"control_qubit": 2, "target_qubit": 3}, + "CLf": 0.99, + "ECR_f": 0.99 + }, + "3-4": { + "coupling": {"control_qubit": 3, "target_qubit": 4}, + "CLf": 0.99, + "ECR_f": 0.99 + }, + "4-5": { + "coupling": {"control_qubit": 4, "target_qubit": 5}, + "CLf": 0.99, + "ECR_f": 0.99 + }, + "5-6": { + "coupling": {"control_qubit": 5, "target_qubit": 6}, + "CLf": 0.99, + "ECR_f": 0.99 + }, + "6-7": { + "coupling": {"control_qubit": 6, "target_qubit": 7}, + "CLf": 0.99, + "ECR_f": 0.99 + }, + "7-0": { + "coupling": {"control_qubit": 7, "target_qubit": 0}, + "CLf": 0.99, + "ECR_f": 0.99 + } + } + } + } + """ + @test Braket.parse_raw_schema(ir_gen()) isa Braket.IqmProviderProperties + end +end diff --git a/test/oq3_program_result.jl b/test/oq3_program_result.jl index ecadb543..222b41cf 100644 --- a/test/oq3_program_result.jl +++ b/test/oq3_program_result.jl @@ -15,7 +15,7 @@ oq3_program() = Braket.OpenQasmProgram(Braket.header_dict[Braket.OpenQasmProgram @testset "OQ3ProgramResult" begin task_metadata = Braket.TaskMetadata(Braket.header_dict[Braket.TaskMetadata], "task_arn", 100, "arn1", nothing, nothing, nothing, nothing, nothing) - additional_metadata = Braket.AdditionalMetadata(oq3_program(), nothing, nothing, nothing, nothing, nothing, nothing) + additional_metadata = Braket.AdditionalMetadata(oq3_program(), nothing, nothing, nothing, nothing, nothing, nothing, nothing) read_in = JSON3.read("""{"taskMetadata": $(JSON3.write(task_metadata)), "additionalMetadata": $(JSON3.write(additional_metadata))}""", Braket.OQ3ProgramResult) @test read_in isa Braket.OQ3ProgramResult @test read_in.taskMetadata == task_metadata diff --git a/test/photonic_task_result.jl b/test/photonic_task_result.jl index 4d083910..ba3bbf61 100644 --- a/test/photonic_task_result.jl +++ b/test/photonic_task_result.jl @@ -4,7 +4,7 @@ using Braket, JSON3, Test task_metadata = Braket.TaskMetadata(Braket.header_dict[Braket.TaskMetadata], "task_arn", 100, "arn1", nothing, nothing, nothing, nothing, nothing) xanadu_metadata = Braket.XanaduMetadata(Braket.header_dict[Braket.XanaduMetadata], "DECLARE ro BIT[2];") blackbird_program = Braket.BlackbirdProgram(Braket.header_dict[Braket.BlackbirdProgram], "Vac | q[0]") - additional_metadata = Braket.AdditionalMetadata(blackbird_program, nothing, nothing, nothing, nothing, xanadu_metadata, nothing, nothing) + additional_metadata = Braket.AdditionalMetadata(blackbird_program, nothing, nothing, nothing, nothing, nothing, xanadu_metadata, nothing, nothing) measurements = [[[1, 2, 3, 4]], [[4, 3, 2, 1]], [[0, 0, 0, 0]]] function result_1() Braket.PhotonicModelTaskResult(Braket.header_dict[Braket.PhotonicModelTaskResult], measurements, task_metadata, additional_metadata) diff --git a/test/runtests.jl b/test/runtests.jl index 9849f507..c682b6ca 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -43,6 +43,7 @@ for group in groups include("rigetti_device.jl") include("simulator_device.jl") include("oqc_device.jl") + include("iqm_device.jl") include("quera_device.jl") include("xanadu_device.jl") include("translation.jl") diff --git a/test/schemas_misc.jl b/test/schemas_misc.jl index ac68db27..c7f1a59a 100644 --- a/test/schemas_misc.jl +++ b/test/schemas_misc.jl @@ -209,7 +209,7 @@ using Braket, Braket.IR, Test, JSON3, StructTypes end @testset "Device metadata" begin - @testset for T in (Braket.OqcMetadata, Braket.XanaduMetadata, Braket.RigettiMetadata) + @testset for T in (Braket.IqmMetadata, Braket.RigettiMetadata) raw = """{"compiledProgram": "fake_program"}""" read_in = JSON3.read(raw, T) @test read_in isa T diff --git a/test/task.jl b/test/task.jl index 76941417..3cf176c1 100644 --- a/test/task.jl +++ b/test/task.jl @@ -65,7 +65,7 @@ zero_shots_result(task_mtd, add_mtd) = Braket.GateModelTaskResult( c = CNot(Circuit(), 0, 1) action = Braket.Program(c) task_metadata = Braket.TaskMetadata(Braket.header_dict[Braket.TaskMetadata], "task_arn", 0, "arn1", nothing, nothing, nothing, nothing, nothing) - additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing) + additional_metadata = Braket.AdditionalMetadata(action, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing) s3_req_str = JSON3.write(zero_shots_result(task_metadata, additional_metadata)) req_patch = @patch Braket.AWS._http_request(a...; b...) = Braket.AWS.Response(Braket.HTTP.Response(200), IOBuffer(s3_req_str)) apply(req_patch) do @@ -111,15 +111,13 @@ zero_shots_result(task_mtd, add_mtd) = Braket.GateModelTaskResult( c = measure q; """ oq3_program() = Braket.OpenQasmProgram(Braket.header_dict[Braket.OpenQasmProgram], bell_qasm, nothing) - bb_program() = Braket.BlackbirdProgram(Braket.header_dict[Braket.BlackbirdProgram], "Vac | q[0]") bell_circ() = (c = Circuit(); c=H(c, 0); c=CNot(c, 0, 1); return c) bell_prog() = Braket.Program(bell_circ()) - RIGETTI_ARN = "arn:aws:braket:::device/qpu/rigetti/Aspen-11" + RIGETTI_ARN = "arn:aws:braket:::device/qpu/rigetti/Aspen-M-3" IONQ_ARN = "arn:aws:braket:::device/qpu/ionq/ionQdevice" SV1_ARN = "arn:aws:braket:::device/quantum-simulator/amazon/sv1" - OQC_ARN = "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" - XANADU_ARN = "arn:aws:braket:us-east-1::device/qpu/xanadu/Borealis" - @testset for program in (bell_circ, bell_prog), arn in (SV1_ARN, OQC_ARN, RIGETTI_ARN, IONQ_ARN) + IQM_ARN = "arn:aws:braket:eu-north-1::device/qpu/iqm/Garnet" + @testset for program in (bell_circ, bell_prog), arn in (SV1_ARN, IQM_ARN, RIGETTI_ARN, IONQ_ARN) shots = 100 device_params = Dict("fake_param_1"=>2, "fake_param_2"=>"hello") s3_folder = ("fake_bucket", "fake_folder") @@ -146,7 +144,7 @@ zero_shots_result(task_mtd, add_mtd) = Braket.GateModelTaskResult( @test task_args[:extra_opts]["deviceParameters"] == JSON3.write(device_params) end - @testset for (program, arn) in zip((oq3_program, bb_program), (SV1_ARN, XANADU_ARN)) + @testset for program in (oq3_program,), arn in (SV1_ARN,) shots = 100 device_params = Dict("fake_param_1"=>2, "fake_param_2"=>"hello") s3_folder = ("fake_bucket", "fake_folder") diff --git a/test/task_batch.jl b/test/task_batch.jl index 057fb080..39ad68b8 100644 --- a/test/task_batch.jl +++ b/test/task_batch.jl @@ -8,13 +8,13 @@ mock_result(c) = Braket.GateModelTaskResult( [Braket.ResultTypeValue(Braket.IR.Amplitude(["011000"], "amplitude"), Dict("011000"=>0.9999999999999982))], collect(0:5), Braket.TaskMetadata(Braket.header_dict[Braket.TaskMetadata], "task_arn", 0, "arn1", nothing, nothing, nothing, nothing, nothing), - Braket.AdditionalMetadata(Braket.Program(c), nothing, nothing, nothing, nothing, nothing, nothing, nothing) + Braket.AdditionalMetadata(Braket.Program(c), nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing) ) -RIGETTI_ARN = "arn:aws:braket:::device/qpu/rigetti/Aspen-11" +RIGETTI_ARN = "arn:aws:braket:::device/qpu/rigetti/Aspen-M-3" IONQ_ARN = "arn:aws:braket:::device/qpu/ionq/ionQdevice" SV1_ARN = "arn:aws:braket:::device/quantum-simulator/amazon/sv1" -OQC_ARN = "arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy" +IQM_ARN = "arn:aws:braket:eu-north-1::device/qpu/iqm/Garnet" XANADU_ARN = "arn:aws:braket:us-east-1::device/qpu/xanadu/Borealis" @testset "Batched tasks" begin