You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Along with returning the final results, it would be useful to somehow access the result at intermediate steps of the calculation. Perhaps an optional list parameter could be supplied where the results from each step could be appended. Alternatively, a file could be provided where the results are stashed.
The text was updated successfully, but these errors were encountered:
I thought it might be a good idea to allow saving and loading as a feature on the cudaq primitive side.
For example,
importosos.environ["SAVE_PRIMITIVES"] =True# optional? os.environ["SAVE_PRIMITIVES_DIR"] = "./some_nice_directory/"result=cudaq.observe(kernel, operator)
print(result.primitive_id) # prints some id# retrive from idresult2=cudaq.retrieve_primitives(result.primitive_id)
assertresult==result2# you can retrieve the job from the filenameresult3=cudaq.retrieve_primitives("./filename.pr")
assertresult==result3
and user can get the inputs like
# result has the input kernel and operatorassertkernel==result3.kernelassertoperator==result3.spin_operator# or the input could be handled by a separate class.inputs=cudaq.get_primitive_inputs(result.primitive_id)
assertkernel==inputs.kernelassertoperator==inputs.spin_operator
Along with returning the final results, it would be useful to somehow access the result at intermediate steps of the calculation. Perhaps an optional list parameter could be supplied where the results from each step could be appended. Alternatively, a file could be provided where the results are stashed.
The text was updated successfully, but these errors were encountered: