BTC_04_PH: Parent Hamiltonian
This part of the repository is associated with the Benchmark Test Case (BTC) 04: Parent Hamiltonian. Configure the kernel_configuration dictionary in final part of the my_benchmark_execution.py file. The number of qubits for executing should be provided as a python list to the variable: list_of_qbits. The different depths for executing should be provided as a python list to the key depth of the kernel_configuration dictionary.
The mandatory configuration files for the ansatz (they have the word parameters in their names) and for the different Pauli decomposition (they have the word Pauli in their names) can be found under the configuration_files folder.
The number of qubits for the ansatz could be from 3 to 30 qubits.
The depth of the ansatz can be from 1 to 4.
The files will be saved in the Results folder (you can change the folder in key argument saving_folder of the benchmark_arguments dictionary). Then you should execute the following command line:
python my_benchmark_execution.py
If you want a complete execution and create the complete JSON file with the complete information of the benchmark results following the NEASQC JSON Schema you can instead execute the script benchmark_exe.sh:
bash benchmark_exe.sh
All the results files and the corresponding JSON will be stored in the Results folder.
my_benchmark_execution
This module execute a complete BTC of the PH kernel
- class tnbs.BTC_04_PH.my_benchmark_execution.KERNEL_BENCHMARK(**kwargs)
Bases:
object
Class for execute a Kernerl benchmark
- exe()
Execute complete Benchmark WorkFlow
- save(save, save_name, input_pdf, save_mode)
For saving panda DataFrames to csvs
- Parameters:
save (bool) – For saving or not
save_nam (str) – name for file
input_pdf (pandas DataFrame)
save_mode (str) – saving mode: overwrite (w) or append (a)
- tnbs.BTC_04_PH.my_benchmark_execution.build_iterator(**kwargs)
For building the iterator of the benchmark
- tnbs.BTC_04_PH.my_benchmark_execution.compute_samples(**kwargs)
This function computes the number of executions of the benchmark for ensuring an error r with a confidence level of alpha
- Parameters:
kwargs (keyword arguments) – For configuring the sampling computation
- Returns:
samples – DataFrame with the number of executions for each integration interval
- Return type:
pandas DataFrame
- tnbs.BTC_04_PH.my_benchmark_execution.run_code(iterator_step, repetitions, stage_bench, **kwargs)
For configuration and execution of the benchmark kernel.
- Parameters:
iterator_step (tuple) – tuple with elements from iterator built from build_iterator.
repetitions (list) – number of repetitions for each execution
stage_bench (str) – benchmark stage. Only: benchmark, pre-benchamrk
kwargs (keyword arguments) – for configuration of the benchmark kernel
- Returns:
metrics (pandas DataFrame) – DataFrame with the desired metrics obtained for the integral computation
save_name (string) – Desired name for saving the results of the execution
- tnbs.BTC_04_PH.my_benchmark_execution.summarize_results(**kwargs)
Create summary with statistics
my_benchmark_info
This module gathers all mandatory information for Benchmarks field of NEASQC JSON report for a BTC PH kernel execution.
- tnbs.BTC_04_PH.my_benchmark_info.my_api(**kwargs)
Collect the information about the used APIs
- tnbs.BTC_04_PH.my_benchmark_info.my_benchmark_info(**kwargs)
Complete WorkFlow for getting all the benchmar informated related info
- tnbs.BTC_04_PH.my_benchmark_info.my_benchmark_kernel(**kwargs)
Name for the benchmark Kernel
- tnbs.BTC_04_PH.my_benchmark_info.my_classical_compilation(**kwargs)
Information about the classical compilation part of the benchmark
- tnbs.BTC_04_PH.my_benchmark_info.my_endtime(**kwargs)
Providing the end time of the benchmark
- tnbs.BTC_04_PH.my_benchmark_info.my_metadata_info(**kwargs)
Other important info user want to store in the final json.
- tnbs.BTC_04_PH.my_benchmark_info.my_programlanguage(**kwargs)
Getting the programing language used for benchmark
- tnbs.BTC_04_PH.my_benchmark_info.my_programlanguage_vendor(**kwargs)
Getting the version of the programing language used for benchmark
- tnbs.BTC_04_PH.my_benchmark_info.my_programlanguage_version(**kwargs)
Getting the version of the programing language used for benchmark
- tnbs.BTC_04_PH.my_benchmark_info.my_quantum_compilation(**kwargs)
Information about the quantum compilation part of the benchmark
- tnbs.BTC_04_PH.my_benchmark_info.my_starttime(**kwargs)
Providing the start time of the benchmark
- tnbs.BTC_04_PH.my_benchmark_info.my_timemethod(**kwargs)
Providing the method for getting the times
my_benchmark_summary
This module is for properly formating the Results sub-field of Benchmarks field of the NEASQC JSON report by gathering the results of a complete BTC of the PH kernel.
- tnbs.BTC_04_PH.my_benchmark_summary.summarize_results(**kwargs)
Mandatory code for properly present the benchmark results following the NEASQC jsonschema
my_environment_info
Module for gathering different hardware information for main fields of NEASQC report generation for reporting BTC of a PL kernel
- tnbs.BTC_04_PH.my_environment_info.my_QPUCPUConnection(**kwargs)
Connection between the QPU and the CPU used in the benchmark
- tnbs.BTC_04_PH.my_environment_info.my_cpu_model(**kwargs)
model of the cpu used in the benchmark
- tnbs.BTC_04_PH.my_environment_info.my_frecuency(**kwargs)
Frcuency of the used CPU
- tnbs.BTC_04_PH.my_environment_info.my_ideal_qpu(**kwargs)
Define an ideal qpu
- tnbs.BTC_04_PH.my_environment_info.my_machine_name(**kwargs)
Name of the machine where the benchmark was performed
- tnbs.BTC_04_PH.my_environment_info.my_network(**kwargs)
Network connections if several QPUs are used
- tnbs.BTC_04_PH.my_environment_info.my_noisy_qpu(qpu_config)
Define an ideal qpu
- tnbs.BTC_04_PH.my_environment_info.my_organisation(**kwargs)
Given information about the organisation how uploads the benchmark
- tnbs.BTC_04_PH.my_environment_info.my_qpu(**kwargs)
Complete info about the used QPU
- tnbs.BTC_04_PH.my_environment_info.my_qpu_model(**kwargs)
Name of the model of the QPU
neasqc_benchmark
Module for complete generation of NEASQC Benhmark Test Case report for a BTC PH kernel
- class tnbs.BTC_04_PH.neasqc_benchmark.BENCHMARK
Bases:
object
Generic class for benchmark applications in NEASQC
- exe(info)
Method for filling the report.
- Parameters:
info (dictionary)
- save(filename)
Method for saving the generated benchmark report
- Parameters:
filename (string) – pathf for storing the benchmark report
- set_benchmark_info(benchmark_info)
Method for filling Benchmarks field.
- Parameters:
benchmark_info (OrderedDict)
- set_cpu_model(cpu_model)
Method for filling CPUModel field.
- Parameters:
cpu_model (str)
- set_frecuency(frecuency)
Method for filling Frequency field.
- Parameters:
frecuency (int)
- set_machine_name(node_name)
Method for filling MachineName field.
- Parameters:
node_name (string)
- set_network(network)
Method for filling Network field.
- Parameters:
network (OrderedDict)
- set_organisation(organisation)
Method for filling ReportOrganization field.
- Parameters:
organisation (string)
- set_qpu_cpu_connection(qpu_cpu_connection)
Method for filling QPUCPUConnection field.
- Parameters:
qpu_cpu_connection (OrderedDict)
- set_qpu_description(qpu_description)
Method for filling QPUDescription field.
- Parameters:
qpu_description (OrderedDict)
- set_qpu_model(qpu_model)
Method for filling QPUModel field.
- Parameters:
qpu_model (str)
- validate()
Method for validating the generated benchmark report.