Qiskit / qiskit-ibm-runtime

IBM Client for Qiskit Runtime
https://docs.quantum.ibm.com/api/qiskit-ibm-runtime
Apache License 2.0
153 stars 154 forks source link

runtime.run with QAOA fails if use_swap_strategies is not set to False #332

Closed EliasCombarro closed 1 year ago

EliasCombarro commented 2 years ago

Describe the bug

When running the QAOA program with Runtime, if the parameter use_swap_strategies is not explicitly set to False (or if it is set to True) the job returns an error. When using a real device(ibmq_belem), the outpur of job.error_message() is

Job ca56l45rkhf0snkhnatg has failed: 2022-05-22T16:53:42.527919340Z 05/22/2022 04:53:42 PM - jaeger_tracing - INFO Initializing Jaeger Tracer with UDP reporter 2022-05-22T16:53:42.534241144Z 05/22/2022 04:53:42 PM - jaeger_tracing - INFO Using sampler ConstSampler(True) 2022-05-22T16:53:42.535360084Z 05/22/2022 04:53:42 PM - jaeger_tracing - INFO opentracing.tracer initialized to <jaeger_client.tracer.Tracer object at 0x7f7ef7208cd0>[app_name=ntc-job] 2022-05-22T16:53:42.572818303Z 05/22/2022 04:53:42 PM - programruntime.program_starter_wrapper - INFO Executing program.py (job ca56l45rkhf0snkhnatg) with params {'operator': PauliOp(Pauli('ZZ'), coeff=1)} 2022-05-22T16:53:42.577024774Z 05/22/2022 04:53:42 PM - qiskit.utils.quantum_instance - INFO 2022-05-22T16:53:42.577024774Z Qiskit Terra version: 0.20.1 2022-05-22T16:53:42.577024774Z Backend: 'ibmq_belem (<programruntime.runtime_provider.RuntimeProvider object at 0x7f7ef7220820>)', with following setting: 2022-05-22T16:53:42.577024774Z {'basis_gates': ['cx', 'id', 'rz', 'sx', 'x'], 'coupling_map': [[0, 1], [1, 0], [1, 2], [1, 3], [2, 1], [3, 1], [3, 4], [4, 3]]} 2022-05-22T16:53:42.577024774Z {'initial_layout': None, 'seed_transpiler': None, 'optimization_level': 1} 2022-05-22T16:53:42.577024774Z RunConfig(shots=1024) 2022-05-22T16:53:42.577024774Z {'timeout': None, 'wait': 0.2} 2022-05-22T16:53:42.577024774Z {} 2022-05-22T16:53:42.577024774Z {} 2022-05-22T16:53:42.577024774Z Measurement mitigation: None 2022-05-22T16:53:42.977187496Z 05/22/2022 04:53:42 PM - qiskit.algorithms.minimum_eigen_solvers.vqe - INFO 2022-05-22T16:53:42.977187496Z ==================== Setting of VQE ============================ 2022-05-22T16:53:42.977187496Z Algorithm: VQE 2022-05-22T16:53:42.977187496Z -- max_evals_grouped: 1 2022-05-22T16:53:42.977187496Z -- circuit_sampler: <qiskit.opflow.converters.circuit_sampler.CircuitSampler object at 0x7f7ef0b55670> 2022-05-22T16:53:42.977187496Z -- expectation: <qiskit.opflow.expectations.pauli_expectation.PauliExpectation object at 0x7f7ef0b49fa0> 2022-05-22T16:53:42.977187496Z -- include_custom: False 2022-05-22T16:53:42.977187496Z -- ansatz: ┌──────────────────┐ 2022-05-22T16:53:42.977187496Z q_0: ┤0 ├ 2022-05-22T16:53:42.977187496Z │ Qaoa(γ[0],β[0]) │ 2022-05-22T16:53:42.977187496Z q_1: ┤1 ├ 2022-05-22T16:53:42.977187496Z └──────────────────┘ 2022-05-22T16:53:42.977187496Z -- optimizer: <qiskit.algorithms.optimizers.spsa.SPSA object at 0x7f7ef0b49e50> 2022-05-22T16:53:42.977187496Z -- initial_point: Random seed 2022-05-22T16:53:42.977187496Z -- gradient: None 2022-05-22T16:53:42.977187496Z -- quantum_instance: 2022-05-22T16:53:42.977187496Z Qiskit Terra version: 0.20.1 2022-05-22T16:53:42.977187496Z Backend: 'ibmq_belem (<programruntime.runtime_provider.RuntimeProvider object at 0x7f7ef7220820>)', with following setting: 2022-05-22T16:53:42.977187496Z {'basis_gates': ['cx', 'id', 'rz', 'sx', 'x'], 'coupling_map': [[0, 1], [1, 0], [1, 2], [1, 3], [2, 1], [3, 1], [3, 4], [4, 3]]} 2022-05-22T16:53:42.977187496Z {'initial_layout': None, 'seed_transpiler': None, 'optimization_level': 1} 2022-05-22T16:53:42.977187496Z RunConfig(shots=1024) 2022-05-22T16:53:42.977187496Z {'timeout': None, 'wait': 0.2} 2022-05-22T16:53:42.977187496Z {} 2022-05-22T16:53:42.977187496Z {} 2022-05-22T16:53:42.977187496Z Measurement mitigation: None 2022-05-22T16:53:42.977187496Z -- eval_time: None 2022-05-22T16:53:42.977187496Z -- eval_count: 0 2022-05-22T16:53:42.977187496Z -- callback: <function main..store_history_and_forward at 0x7f7ef0c5ea60> 2022-05-22T16:53:42.977187496Z =============================================================== 2022-05-22T16:53:42.977187496Z ┌──────────────────┐ 2022-05-22T16:53:42.977187496Z q_0: ┤0 ├ 2022-05-22T16:53:42.977187496Z │ Qaoa(γ[0],β[0]) │ 2022-05-22T16:53:42.977187496Z q_1: ┤1 ├ 2022-05-22T16:53:42.977187496Z └──────────────────┘=============================================================== 2022-05-22T16:53:42.977187496Z Optimizer: SPSA 2022-05-22T16:53:42.977187496Z -- gradient_support_level: 1 2022-05-22T16:53:42.977187496Z -- bounds_support_level: 1 2022-05-22T16:53:42.977187496Z -- initial_point_support_level: 3 2022-05-22T16:53:42.977187496Z -- options: {} 2022-05-22T16:53:42.977187496Z -- max_evals_grouped: 1 2022-05-22T16:53:42.977187496Z -- nfev: None 2022-05-22T16:53:42.977187496Z -- smoothed_hessian: None 2022-05-22T16:53:42.977187496Z =============================================================== 2022-05-22T16:53:42.977187496Z 2022-05-22T16:53:42.989024261Z 05/22/2022 04:53:42 PM - qiskit.algorithms.optimizers.spsa - INFO SPSA: Starting calibration of learning rate and perturbation. 2022-05-22T16:53:42.996529375Z 05/22/2022 04:53:42 PM - qiskit.transpiler.runningpassmanager - INFO Pass: SwapStrategyCreator - 0.20671 (ms) 2022-05-22T16:53:44.575622215Z --- Logging error --- 2022-05-22T16:53:44.575622215Z Traceback (most recent call last): 2022-05-22T16:53:44.575622215Z File "/provider/programruntime/program_starter_wrapper.py", line 70, in execute 2022-05-22T16:53:44.575622215Z final_result = self.main(backend, self.messenger, *self.user_params) 2022-05-22T16:53:44.575622215Z File "/code/program.py", line 2543, in main 2022-05-22T16:53:44.575622215Z result = qaoa.compute_minimum_eigenvalue(operator, aux_operators) 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/algorithms/minimum_eigen_solvers/vqe.py", line 548, in compute_minimum_eigenvalue 2022-05-22T16:53:44.575622215Z opt_result = self.optimizer.minimize( 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/algorithms/optimizers/spsa.py", line 511, in minimize 2022-05-22T16:53:44.575622215Z get_eta, get_eps = self.calibrate(fun, x0, max_evals_grouped=self._max_evals_grouped) 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/algorithms/optimizers/spsa.py", line 332, in calibrate 2022-05-22T16:53:44.575622215Z losses = _batch_evaluate(loss, points, max_evals_grouped) 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/algorithms/optimizers/spsa.py", line 691, in _batch_evaluate 2022-05-22T16:53:44.575622215Z return [ 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/algorithms/optimizers/spsa.py", line 692, in 2022-05-22T16:53:44.575622215Z function(point) if isinstance(point, tuple) else function(point) for point in points 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/algorithms/minimum_eigen_solvers/vqe.py", line 637, in energy_evaluation 2022-05-22T16:53:44.575622215Z sampled_expect_op = self._circuit_sampler.convert(expect_op, params=param_bindings) 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/opflow/converters/circuit_sampler.py", line 218, in convert 2022-05-22T16:53:44.575622215Z sampled_statefn_dicts = self.sample_circuits(circuit_sfns=circs, param_bindings=p_b) 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/opflow/converters/circuit_sampler.py", line 299, in sample_circuits 2022-05-22T16:53:44.575622215Z self._transpiled_circ_cache = self.quantum_instance.transpile( 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/utils/quantum_instance.py", line 450, in transpile 2022-05-22T16:53:44.575622215Z transpiled_circuits = pass_manager.run(circuits) 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/passmanager.py", line 224, in run 2022-05-22T16:53:44.575622215Z return self._run_single_circuit(circuits[0], output_name, callback) 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/passmanager.py", line 277, in _run_single_circuit 2022-05-22T16:53:44.575622215Z result = running_passmanager.run(circuit, output_name=output_name, callback=callback) 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/runningpassmanager.py", line 124, in run 2022-05-22T16:53:44.575622215Z dag = self._dopass(pass, dag, passset.options) 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/runningpassmanager.py", line 157, in _do_pass 2022-05-22T16:53:44.575622215Z dag = self._run_thispass(pass, dag) 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/runningpassmanager.py", line 186, in _run_this_pass 2022-05-22T16:53:44.575622215Z newdag = pass.run(dag) 2022-05-22T16:53:44.575622215Z File "/code/program.py", line 1880, in run 2022-05-22T16:53:44.575622215Z rebound = qaoa.assign_parameters(op.params) 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/library/n_local/n_local.py", line 808, in assign_parameters 2022-05-22T16:53:44.575622215Z self._build() 2022-05-22T16:53:44.575622215Z File "/code/program.py", line 1605, in _build 2022-05-22T16:53:44.575622215Z self._check_configuration() 2022-05-22T16:53:44.575622215Z File "/code/program.py", line 1542, in _check_configuration 2022-05-22T16:53:44.575622215Z if self._num_logical_qubits > self._num_physical_qubits: 2022-05-22T16:53:44.575622215Z TypeError: '>' not supported between instances of 'int' and 'NoneType' 2022-05-22T16:53:44.575622215Z 2022-05-22T16:53:44.575622215Z During handling of the above exception, another exception occurred: 2022-05-22T16:53:44.575622215Z 2022-05-22T16:53:44.575622215Z Traceback (most recent call last): 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/logging/init.py", line 1085, in emit 2022-05-22T16:53:44.575622215Z msg = self.format(record) 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/logging/init.py", line 929, in format 2022-05-22T16:53:44.575622215Z return fmt.format(record) 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/logging/init.py", line 668, in format 2022-05-22T16:53:44.575622215Z record.message = record.getMessage() 2022-05-22T16:53:44.575622215Z File "/usr/local/lib/python3.8/logging/init.py", line 373, in getMessage 2022-05-22T16:53:44.575622215Z msg = msg % self.args 2022-05-22T16:53:44.575622215Z TypeError: not all arguments converted during string formatting 2022-05-22T16:53:44.575622215Z Call stack: 2022-05-22T16:53:44.575622215Z File "/code/program_starter.py", line 52, in 2022-05-22T16:53:44.575622215Z starter.execute() 2022-05-22T16:53:44.575622215Z File "/provider/programruntime/program_starter_wrapper.py", line 74, in execute 2022-05-22T16:53:44.575622215Z logger.error(f"Error executing program job {self.provider.execution_id}", ex) 2022-05-22T16:53:44.575622215Z Message: 'Error executing program job ca56l45rkhf0snkhnatg' 2022-05-22T16:53:44.575622215Z Arguments: (TypeError("'>' not supported between instances of 'int' and 'NoneType'"),) 2022-05-22T16:53:44.575622215Z 05/22/2022 04:53:44 PM - programruntime.clients.api.usermessengernatsclient - ERROR Timed out waiting for ack on jobs.error.{execution_id} after 0.5 seconds 2022-05-22T16:53:44.591922900Z 05/22/2022 04:53:44 PM - jaeger_tracing - INFO Span publisher exited 2022-05-22T16:53:44.595445399Z Traceback (most recent call last): 2022-05-22T16:53:44.595445399Z File "/code/program_starter.py", line 52, in 2022-05-22T16:53:44.595445399Z starter.execute() 2022-05-22T16:53:44.595445399Z File "/provider/programruntime/program_starter_wrapper.py", line 76, in execute 2022-05-22T16:53:44.595445399Z raise ex 2022-05-22T16:53:44.595445399Z File "/provider/programruntime/program_starter_wrapper.py", line 70, in execute 2022-05-22T16:53:44.595445399Z final_result = self.main(backend, self.messenger, *self.user_params) 2022-05-22T16:53:44.595445399Z File "/code/program.py", line 2543, in main 2022-05-22T16:53:44.595445399Z result = qaoa.compute_minimum_eigenvalue(operator, aux_operators) 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/algorithms/minimum_eigen_solvers/vqe.py", line 548, in compute_minimum_eigenvalue 2022-05-22T16:53:44.595445399Z opt_result = self.optimizer.minimize( 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/algorithms/optimizers/spsa.py", line 511, in minimize 2022-05-22T16:53:44.595445399Z get_eta, get_eps = self.calibrate(fun, x0, max_evals_grouped=self._max_evals_grouped) 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/algorithms/optimizers/spsa.py", line 332, in calibrate 2022-05-22T16:53:44.595445399Z losses = _batch_evaluate(loss, points, max_evals_grouped) 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/algorithms/optimizers/spsa.py", line 691, in _batch_evaluate 2022-05-22T16:53:44.595445399Z return [ 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/algorithms/optimizers/spsa.py", line 692, in 2022-05-22T16:53:44.595445399Z function(point) if isinstance(point, tuple) else function(point) for point in points 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/algorithms/minimum_eigen_solvers/vqe.py", line 637, in energy_evaluation 2022-05-22T16:53:44.595445399Z sampled_expect_op = self._circuit_sampler.convert(expect_op, params=param_bindings) 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/opflow/converters/circuit_sampler.py", line 218, in convert 2022-05-22T16:53:44.595445399Z sampled_statefn_dicts = self.sample_circuits(circuit_sfns=circs, param_bindings=p_b) 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/opflow/converters/circuit_sampler.py", line 299, in sample_circuits 2022-05-22T16:53:44.595445399Z self._transpiled_circ_cache = self.quantum_instance.transpile( 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/utils/quantum_instance.py", line 450, in transpile 2022-05-22T16:53:44.595445399Z transpiled_circuits = pass_manager.run(circuits) 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/passmanager.py", line 224, in run 2022-05-22T16:53:44.595445399Z return self._run_single_circuit(circuits[0], output_name, callback) 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/passmanager.py", line 277, in _run_single_circuit 2022-05-22T16:53:44.595445399Z result = running_passmanager.run(circuit, output_name=output_name, callback=callback) 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/runningpassmanager.py", line 124, in run 2022-05-22T16:53:44.595445399Z dag = self._dopass(pass, dag, passset.options) 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/runningpassmanager.py", line 157, in _do_pass 2022-05-22T16:53:44.595445399Z dag = self._run_thispass(pass, dag) 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/runningpassmanager.py", line 186, in _run_this_pass 2022-05-22T16:53:44.595445399Z newdag = pass.run(dag) 2022-05-22T16:53:44.595445399Z File "/code/program.py", line 1880, in run 2022-05-22T16:53:44.595445399Z rebound = qaoa.assign_parameters(op.params) 2022-05-22T16:53:44.595445399Z File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/library/n_local/n_local.py", line 808, in assign_parameters 2022-05-22T16:53:44.595445399Z self._build() 2022-05-22T16:53:44.595445399Z File "/code/program.py", line 1605, in _build 2022-05-22T16:53:44.595445399Z self._check_configuration() 2022-05-22T16:53:44.595445399Z File "/code/program.py", line 1542, in _check_configuration 2022-05-22T16:53:44.595445399Z if self._num_logical_qubits > self._num_physical_qubits: 2022-05-22T16:53:44.595445399Z TypeError: '>' not supported between instances of 'int' and 'NoneType'

When running on ibqm_qasm_simulator the error is:

Job ca56l7lrkhf0snkhnb1g has failed: 2022-05-22T16:53:56.823005244Z 05/22/2022 04:53:56 PM - jaeger_tracing - INFO Initializing Jaeger Tracer with UDP reporter 2022-05-22T16:54:01.838348003Z 05/22/2022 04:54:01 PM - jaeger_tracing - INFO Using sampler ConstSampler(True) 2022-05-22T16:54:01.839385125Z 05/22/2022 04:54:01 PM - jaeger_tracing - INFO opentracing.tracer initialized to <jaeger_client.tracer.Tracer object at 0x7fed621e06d0>[app_name=ntc-job] 2022-05-22T16:54:01.843066864Z 05/22/2022 04:54:01 PM - qiskit.compiler.assembler - INFO Total Assembly Time - 0.11182 (ms) 2022-05-22T16:54:01.843610789Z 05/22/2022 04:54:01 PM - qiskit.compiler.assembler - INFO Total Assembly Time - 0.07987 (ms) 2022-05-22T16:54:01.844071104Z 05/22/2022 04:54:01 PM - qiskit.compiler.assembler - INFO Total Assembly Time - 0.07200 (ms) 2022-05-22T16:54:01.844564955Z 05/22/2022 04:54:01 PM - qiskit.compiler.assembler - INFO Total Assembly Time - 0.07153 (ms) 2022-05-22T16:54:01.844922088Z 05/22/2022 04:54:01 PM - qiskit.compiler.assembler - INFO Total Assembly Time - 0.06914 (ms) 2022-05-22T16:54:01.845352577Z 05/22/2022 04:54:01 PM - qiskit.compiler.assembler - INFO Total Assembly Time - 0.07200 (ms) 2022-05-22T16:54:01.845723144Z 05/22/2022 04:54:01 PM - qiskit.compiler.assembler - INFO Total Assembly Time - 0.06890 (ms) 2022-05-22T16:54:01.846058813Z 05/22/2022 04:54:01 PM - qiskit.compiler.assembler - INFO Total Assembly Time - 0.06890 (ms) 2022-05-22T16:54:01.846462612Z 05/22/2022 04:54:01 PM - qiskit.compiler.assembler - INFO Total Assembly Time - 0.07010 (ms) 2022-05-22T16:54:01.846942797Z 05/22/2022 04:54:01 PM - qiskit.compiler.assembler - INFO Total Assembly Time - 0.07224 (ms) 2022-05-22T16:54:01.847791539Z 05/22/2022 04:54:01 PM - programruntime.program_starter_wrapper - INFO Executing program.py (job ca56l7lrkhf0snkhnb1g) with params {'operator': PauliOp(Pauli('ZZ'), coeff=1), 'use_swap_strategies': True} 2022-05-22T16:54:03.861061601Z --- Logging error --- 2022-05-22T16:54:03.861125425Z Traceback (most recent call last): 2022-05-22T16:54:03.861134180Z File "/provider/programruntime/program_starter_wrapper.py", line 70, in execute 2022-05-22T16:54:03.861146456Z final_result = self.main(backend, self.messenger, self.user_params) 2022-05-22T16:54:03.861151115Z File "/code/program.py", line 2498, in main 2022-05-22T16:54:03.861156760Z pass_manager = swap_pass_manager_creator( 2022-05-22T16:54:03.861164207Z File "/code/program.py", line 2332, in swap_pass_manager_creator 2022-05-22T16:54:03.861164207Z SwapStrategyCreator( 2022-05-22T16:54:03.861166315Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/basepasses.py", line 29, in call 2022-05-22T16:54:03.861166315Z pass_instance = type.call(cls, args, kwargs) 2022-05-22T16:54:03.861166315Z File "/code/program.py", line 1930, in init 2022-05-22T16:54:03.861166315Z raise QiskitError( 2022-05-22T16:54:03.861166315Z qiskit.exceptions.QiskitError: 'Cannot create a swap strategy if the backend does not have a coupling map.' 2022-05-22T16:54:03.861166315Z 2022-05-22T16:54:03.861166315Z During handling of the above exception, another exception occurred: 2022-05-22T16:54:03.861166315Z 2022-05-22T16:54:03.861166315Z Traceback (most recent call last): 2022-05-22T16:54:03.861166315Z File "/usr/local/lib/python3.8/logging/init.py", line 1085, in emit 2022-05-22T16:54:03.861166315Z msg = self.format(record) 2022-05-22T16:54:03.861166315Z File "/usr/local/lib/python3.8/logging/init.py", line 929, in format 2022-05-22T16:54:03.861166315Z return fmt.format(record) 2022-05-22T16:54:03.861166315Z File "/usr/local/lib/python3.8/logging/init.py", line 668, in format 2022-05-22T16:54:03.861166315Z record.message = record.getMessage() 2022-05-22T16:54:03.861166315Z File "/usr/local/lib/python3.8/logging/init.py", line 373, in getMessage 2022-05-22T16:54:03.861166315Z msg = msg % self.args 2022-05-22T16:54:03.861166315Z TypeError: not all arguments converted during string formatting 2022-05-22T16:54:03.861166315Z Call stack: 2022-05-22T16:54:03.861166315Z File "/code/program_starter.py", line 52, in 2022-05-22T16:54:03.861170505Z starter.execute() 2022-05-22T16:54:03.861176583Z File "/provider/programruntime/program_starter_wrapper.py", line 74, in execute 2022-05-22T16:54:03.861182345Z logger.error(f"Error executing program job {self.provider.execution_id}", ex) 2022-05-22T16:54:03.861187813Z Message: 'Error executing program job ca56l7lrkhf0snkhnb1g' 2022-05-22T16:54:03.861193397Z Arguments: (QiskitError('Cannot create a swap strategy if the backend does not have a coupling map.'),) 2022-05-22T16:54:03.861201360Z 05/22/2022 04:54:03 PM - programruntime.clients.api.nats_client - ERROR An unexpected error occurred when communicating with the server 2022-05-22T16:54:03.861206933Z Traceback (most recent call last): 2022-05-22T16:54:03.861212595Z File "/provider/programruntime/program_starter_wrapper.py", line 70, in execute 2022-05-22T16:54:03.861218001Z final_result = self.main(backend, self.messenger, self.user_params) 2022-05-22T16:54:03.861223348Z File "/code/program.py", line 2498, in main 2022-05-22T16:54:03.861228653Z pass_manager = swap_pass_manager_creator( 2022-05-22T16:54:03.861234044Z File "/code/program.py", line 2332, in swap_pass_manager_creator 2022-05-22T16:54:03.861239404Z SwapStrategyCreator( 2022-05-22T16:54:03.861246991Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/basepasses.py", line 29, in call 2022-05-22T16:54:03.861252786Z pass_instance = type.call(cls, args, kwargs) 2022-05-22T16:54:03.861258508Z File "/code/program.py", line 1930, in init 2022-05-22T16:54:03.861264140Z raise QiskitError( 2022-05-22T16:54:03.861297294Z qiskit.exceptions.QiskitError: 'Cannot create a swap strategy if the backend does not have a coupling map.' 2022-05-22T16:54:03.861303406Z 2022-05-22T16:54:03.861309108Z During handling of the above exception, another exception occurred: 2022-05-22T16:54:03.861314525Z 2022-05-22T16:54:03.861321951Z Traceback (most recent call last): 2022-05-22T16:54:03.861327904Z File "/usr/local/lib/python3.8/site-packages/nats/aio/client.py", line 1186, in _select_next_server 2022-05-22T16:54:03.861333531Z r, w = await asyncio.wait_for( 2022-05-22T16:54:03.861339209Z File "/usr/local/lib/python3.8/asyncio/tasks.py", line 501, in wait_for 2022-05-22T16:54:03.861344800Z raise exceptions.TimeoutError() 2022-05-22T16:54:03.861350430Z asyncio.exceptions.TimeoutError 2022-05-22T16:54:07.865972399Z 05/22/2022 04:54:07 PM - programruntime.clients.api.nats_client - ERROR An unexpected error occurred when communicating with the server 2022-05-22T16:54:07.865987212Z Traceback (most recent call last): 2022-05-22T16:54:07.865995861Z File "/provider/programruntime/program_starter_wrapper.py", line 70, in execute 2022-05-22T16:54:07.866003420Z final_result = self.main(backend, self.messenger, self.user_params) 2022-05-22T16:54:07.866010517Z File "/code/program.py", line 2498, in main 2022-05-22T16:54:07.866016472Z pass_manager = swap_pass_manager_creator( 2022-05-22T16:54:07.866023292Z File "/code/program.py", line 2332, in swap_pass_manager_creator 2022-05-22T16:54:07.866029707Z SwapStrategyCreator( 2022-05-22T16:54:07.866035774Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/basepasses.py", line 29, in call 2022-05-22T16:54:07.866043953Z pass_instance = type.call(cls, args, kwargs) 2022-05-22T16:54:07.866071137Z File "/code/program.py", line 1930, in init 2022-05-22T16:54:07.866077771Z raise QiskitError( 2022-05-22T16:54:07.866084132Z qiskit.exceptions.QiskitError: 'Cannot create a swap strategy if the backend does not have a coupling map.' 2022-05-22T16:54:07.866090432Z 2022-05-22T16:54:07.866096826Z During handling of the above exception, another exception occurred: 2022-05-22T16:54:07.866102298Z 2022-05-22T16:54:07.866108295Z Traceback (most recent call last): 2022-05-22T16:54:07.866115963Z File "/usr/local/lib/python3.8/site-packages/nats/aio/client.py", line 1186, in _select_next_server 2022-05-22T16:54:07.866121888Z r, w = await asyncio.wait_for( 2022-05-22T16:54:07.866127627Z File "/usr/local/lib/python3.8/asyncio/tasks.py", line 501, in wait_for 2022-05-22T16:54:07.866133673Z raise exceptions.TimeoutError() 2022-05-22T16:54:07.866140249Z asyncio.exceptions.TimeoutError 2022-05-22T16:54:11.396438327Z 05/22/2022 04:54:11 PM - programruntime.clients.api.usermessengernatsclient - ERROR Timed out waiting for ack on jobs.error.{execution_id} after 0.5 seconds 2022-05-22T16:54:11.403412028Z 05/22/2022 04:54:11 PM - jaeger_tracing - INFO Span publisher exited 2022-05-22T16:54:11.406017860Z Traceback (most recent call last): 2022-05-22T16:54:11.406062178Z File "/code/program_starter.py", line 52, in 2022-05-22T16:54:11.406074491Z starter.execute() 2022-05-22T16:54:11.406084629Z File "/provider/programruntime/program_starter_wrapper.py", line 76, in execute 2022-05-22T16:54:11.406095103Z raise ex 2022-05-22T16:54:11.406104600Z File "/provider/programruntime/program_starter_wrapper.py", line 70, in execute 2022-05-22T16:54:11.406117133Z final_result = self.main(backend, self.messenger, self.user_params) 2022-05-22T16:54:11.406125802Z File "/code/program.py", line 2498, in main 2022-05-22T16:54:11.406133780Z pass_manager = swap_pass_manager_creator( 2022-05-22T16:54:11.406142654Z File "/code/program.py", line 2332, in swap_pass_manager_creator 2022-05-22T16:54:11.406151582Z SwapStrategyCreator( 2022-05-22T16:54:11.406161340Z File "/usr/local/lib/python3.8/site-packages/qiskit/transpiler/basepasses.py", line 29, in call 2022-05-22T16:54:11.406170922Z pass_instance = type.call(cls, args, kwargs) 2022-05-22T16:54:11.406179093Z File "/code/program.py", line 1930, in init 2022-05-22T16:54:11.406189223Z raise QiskitError( 2022-05-22T16:54:11.406197179Z qiskit.exceptions.QiskitError: 'Cannot create a swap strategy if the backend does not have a coupling map.'

If I set use_swap_strategies to False, the job runs without error in both ibmq_belem and ibmq_qasm_simulator

Steps to reproduce

from qiskit import IBMQ from qiskit.opflow import Z provider = IBMQ.load_account() qaoa_program = provider.runtime.program("qaoa") H1 = Z^Z options = {"backend_name": "ibmq_belem"}

options = {"backend_name": "ibmq_qasm_simulator"}

runtime_inputs = {"operator": H1} job = provider.runtime.run(program_id="qaoa", options=options, inputs=runtime_inputs)

Expected behavior

Running without error

Suggested solutions

Additional Information

eggerdj commented 2 years ago

With the code below:

from qiskit import IBMQ
from qiskit.opflow import Z
provider = IBMQ.load_account()
qaoa_program = provider.runtime.program("qaoa")
H1 = Z^Z
options = {"backend_name": "ibmq_belem"}

runtime_inputs = {"operator": H1}
job = provider.runtime.run(program_id="qaoa", options=options, inputs=runtime_inputs)

I got a different bug which at first glance does not seem related to the swap strategy issue above:

...
2022-06-02T17:22:09.706624741Z     new_dag = pass_.run(dag)
2022-06-02T17:22:09.706624741Z   File "/code/program.py", line 1880, in run
2022-06-02T17:22:09.706624741Z     rebound = qaoa.assign_parameters(op.params)
2022-06-02T17:22:09.706624741Z   File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/library/n_local/n_local.py", line 808, in assign_parameters
2022-06-02T17:22:09.706624741Z     self._build()
2022-06-02T17:22:09.706624741Z   File "/code/program.py", line 1605, in _build
2022-06-02T17:22:09.706624741Z     self._check_configuration()
2022-06-02T17:22:09.706624741Z   File "/code/program.py", line 1542, in _check_configuration
2022-06-02T17:22:09.706624741Z     if self._num_logical_qubits > self._num_physical_qubits:
2022-06-02T17:22:09.706624741Z TypeError: '>' not supported between instances of 'int' and 'NoneType'

This is speculation but it could be due to changes in terra not reflected in the runtime program for QAOA. I'll continue to investigate.

EliasCombarro commented 2 years ago

That is exactly the same error I get on ibmq_belem

eggerdj commented 2 years ago

Ah indeed, I see it in the middle of your stack trace now.

kt474 commented 1 year ago

Putting this on hold, there is PR to update qaoa in progress

jyu00 commented 1 year ago

Closing since QAOA runtime program doesn't exist anymore