qobj_dicts = [qobj_to_dict(qob) for qob in self.qobjs]
pickle.dump({"qobjs":qobj_dicts, "mappings":self.mappings}, cache_handler, protocol=pickle.HIGHEST_PROTOCOL)
cache_handler.close()
logger.debug("Circuit cache saved to file.")
def try_loading_cache_from_file(self):
if len(self.qobjs) == 0 and self.cache_file is not None and len(self.cache_file) > 0:
cache_handler = open(self.cache_file, "rb")
After Change
op_graph.get(type_and_qubits, []) + [i]
mapping = []
for compiled_gate_index, compiled_gate in enumerate(qobj.experiments[circ_num].instructions):
if not hasattr(compiled_gate, "params"): continue
type_and_qubits = compiled_gate.name + compiled_gate.qubits.__str__()
if len(op_graph[type_and_qubits]) > 0:
uncompiled_gate_index = op_graph[type_and_qubits].pop(0)
uncompiled_gate = raw_gates[uncompiled_gate_index]