Cache the kernel schedules to avoid running DP multiple times for an unchanged circuit, adding functions Schedule::from_file and Schedule::save_to_file (benchmark_dp now caches the schedules)
Add a function to run ILP and DP together to also avoid running ILP multiple times (test_simulation now calls this)
Add functions Kernel::to_qasm_style_string and Kernel::from_qasm_style_string to serialize/deserialize kernels
Wrap Kernel::gates with std::unique_ptr for better memory management
Changes in general parts:
Add functions CircuitSeq::to_qasm_style_string and CircuitSeq::from_qasm_style_string to serialize/deserialize from QASM-style strings in addition to QASM files
If a parameter is 0, output 0 instead of 0.000000000000000 into the QASM file
Add a file quartz/utils/string_utils.h to serialize vectors
Add a constant constexpr int kDefaultQASMParamPrecision = 15; in quartz/utils/utils.h
The cache file structure:
If the file cache_file_name_prefix + ".schedule" exists, we have the schedule cached. This file stores a single number num_stages.
For each 0 <= i < num_stages, the file cache_file_name_prefix + ".stage" + std::to_string(i) + ".schedule" stores the schedule for the i-th stage. Schedule::from_file(ctx, cache_file_name_prefix + ".stage" + std::to_string(i) + ".schedule") reads the schedule from the file.
Changes to the simulator:
Schedule::from_file
andSchedule::save_to_file
(benchmark_dp
now caches the schedules)test_simulation
now calls this)Kernel::to_qasm_style_string
andKernel::from_qasm_style_string
to serialize/deserialize kernelsKernel::gates
withstd::unique_ptr
for better memory managementChanges in general parts:
CircuitSeq::to_qasm_style_string
andCircuitSeq::from_qasm_style_string
to serialize/deserialize from QASM-style strings in addition to QASM files0
instead of0.000000000000000
into the QASM filequartz/utils/string_utils.h
to serialize vectorsconstexpr int kDefaultQASMParamPrecision = 15;
inquartz/utils/utils.h
The cache file structure:
cache_file_name_prefix + ".schedule"
exists, we have the schedule cached. This file stores a single numbernum_stages
.0 <= i < num_stages
, the filecache_file_name_prefix + ".stage" + std::to_string(i) + ".schedule"
stores the schedule for the i-th stage.Schedule::from_file(ctx, cache_file_name_prefix + ".stage" + std::to_string(i) + ".schedule")
reads the schedule from the file.