def test_online_devices(self): """Test if there are online backends (which are devices). If all correct some should exists. NEED internet connection for this. """ # TODO: Jay should we check if we the QX is online before runing. qp = QuantumProgram(specs=QPS_SPECS) qp.set_api(API_TOKEN, URL) online_devices = qp.online_devices() # print(online_devices) self.assertTrue(isinstance(online_devices, list))
ran_qasm = result.get_ran_qasm('Circuit') print(ran_qasm) # You can use # `qp.execute(circuits) # to combine the compile and run in a single step. out = qp.execute(circuits, backend, wait=2, timeout=240) print(out) ## Execute on a Real Device qp.set_api(Qconfig.APItoken, Qconfig.config['url']) # set the APIToken and API url real_device_backend = [ backend for backend in qp.online_devices() if qp.get_backend_configuration(backend)['n_qubits'] == 5 and qp.get_backend_status(backend)['available'] == True ] print(qp.online_devices()) for backend in qp.online_devices(): print(qp.get_backend_configuration(backend)) print(qp.get_backend_status(backend)) # find and appropriate real device backend that your APIToken has access to run that has 5 qubits and is available print(real_device_backend) backend = real_device_backend[ 0] # Backend where you execute your programl in this case, on the real Quatum Chip online circuits = ['Circuit'] # Group of circuits to execute shots = 1024 # Number of shots to run the program (experiment); maximum is 8192 shots.