diff --git a/README.md b/README.md index 18d57ddee6ac464b5316bcb036fbc06a6681c673..dd4c1ad0d0ae34b2d87e9cca16d6ddc176ea0eb1 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,8 @@ This section shows how to submit a circuit for simulation to JUQCS. --- ## Release History +* 0.9.3 + - The `seed` option can be unspecified (JUQCS will run with a random seed). * 0.9.2 - Added runtime service and job retrieval feature. * 0.9.1 diff --git a/juqcs/backend.py b/juqcs/backend.py index b52855e0d5f76f8bd7f662431586430213086bfa..a065d7c13e38d68a25a82e9305ea4661c92512ec 100644 --- a/juqcs/backend.py +++ b/juqcs/backend.py @@ -94,7 +94,7 @@ class JuqcsBackend(Backend): return False else: return True - + def status(self): '''Return backend status.''' if self._allocation_is_valid(): diff --git a/juqcs/job.py b/juqcs/job.py index 70344b98b375e48bd9e5b27e36870e23a88e1e4c..684ba9128e98682839e38dd9de21c6d0d3123574 100644 --- a/juqcs/job.py +++ b/juqcs/job.py @@ -25,6 +25,7 @@ class JuqcsJob(Job): self._status = JobStatus.INITIALIZING self._result = None self._storage = None + self._circuit_files = [] def _validate(self, run_input): ''' @@ -60,9 +61,9 @@ class JuqcsJob(Job): args = ['--amplitudes'] elif self._backend._result_type == 'counts': args = ['--repetitions', str(int(self._options['shots']))] +\ - ['--seed', str(int(self._options['seed']))] if self._options['seed'] else [] # non-string cause error - circuit_id = uuid4() - circuit_file = f'{str(circuit_id)}.qasm' + ['--seed', str(int(self._options['seed'])) if 'seed' in self._options else '-1'] + # either '-1' or user specified seed value + circuit_file = f'{self._circuit_files[-1]}.qasm' run_arguments = [str(self._backend._allocation_id), circuit_file, str(self._backend._project), str(self._backend._device)] + args run_description = { 'Project': self._backend._project, 'ApplicationName': 'RUN', @@ -84,14 +85,16 @@ class JuqcsJob(Job): start = time() self._time_submit = str(datetime.now().strftime("%Y-%m-%d %H:%M:%S")) self._storage = create_storage(self.job_id()) - self.serialize_job() for circuit in self._inputs: + self._circuit_files.append(str(uuid4())) + self.serialize_job() job = self._submit(circuit) self._unicore_jobs.append(job) # add to unicore_jobs self._time_taken = time() - start self._status = JobStatus.DONE self._result = self.result() self.serialize_job() + self._circuit_files = [] return self def result(self, partial=False): @@ -220,6 +223,7 @@ class JuqcsJob(Job): job_data = { 'job_id' : self.job_id(), 'job_backend' : self._backend.name, + 'job_circuits': self._circuit_files, 'job_submit_time' : self._time_submit, 'job_status' : f'{self.status().name}:{self.status().value}', 'job_done' : self.done(), diff --git a/juqcs/runtime.py b/juqcs/runtime.py index 8219d767a9833a85c5712f91fd18e062e89b7b86..94de7903614891bb1882fd3461459fa8d2b2f571 100644 --- a/juqcs/runtime.py +++ b/juqcs/runtime.py @@ -58,7 +58,7 @@ class JobRet: self._submit_time = job_info["job_submit_time"] self._status = job_info["job_status"] self._done = job_info["job_done"] - self._result = job_info["job_result"] + self._result = job_info["job_result"] def backend(self): return self._backend