Usage of sample applications

qsim is designed to be extensible to a variety of different applications. The base version is qsim_base; sample extensions are provided in apps. To compile the code, just run make qsim. Binaries of the form qsim_*.x will be added to the apps directory.

Sample circuits are provided in circuits.

qsim_base usage

./qsim_base.x -c circuit_file -d maxtime -t num_threads -f max_fused_size -v verbosity -z
Flag Description
-c circuit_file circuit file to run
-d maxtime maximum time
-t num_threads number of threads to use
-f max_fused_size maximum fused gate size
-v verbosity verbosity level (0,1,2,3,4,5)
-z set flush-to-zero and denormals-are-zeros MXCSR control flags

qsim_base computes all the amplitudes and just prints the first eight of them (or a smaller number for 1- or 2-qubit circuits).

Verbosity levels are described in the following table.

Verbosity level Description
0 no additional information
1 add total simulation runtime
2 add initialization runtime and fuser runtime
3 add basic fuser statistics
4 add simulation runtime for each fused gate
5 additional fuser information (qubit indices for each fused gate)

Example:

./qsim_base.x -c ../circuits/circuit_q24 -d 16 -t 8 -v 1

qsim_von_neumann usage

./qsim_von_neumann.x -c circuit_file -d maxtime -t num_threads -f max_fused_size -v verbosity -z
Flag Description
-c circuit_file circuit file to run
-d maxtime maximum time
-t num_threads number of threads to use
-f max_fused_size maximum fused gate size
-v verbosity verbosity level (0,1,2,3,4,5)
-z set flush-to-zero and denormals-are-zeros MXCSR control flags

qsim_von_neumann computes all the amplitudes and calculates the von Neumann entropy. Note that this can be quite slow for large circuits and small thread numbers as the calculation of logarithms is slow.

Example:

./qsim_von_neumann.x -c ../circuits/circuit_q24 -d 16 -t 4 -v 1

qsim_amplitudes usage

./qsim_amplitudes.x -c circuit_file \
                    -d times_to_save_results \
                    -i input_files \
                    -o output_files \
                    -f max_fused_size \
                    -t num_threads -v verbosity -z
Flag Description
-c circuit_file circuit file to run
-d times_to_save_results comma-separated list of circuit times to save results at
-i input_files comma-separated list of bitstring input files
-o output_files comma-separated list of amplitude output files
-t num_threads number of threads to use
-f max_fused_size maximum fused gate size
-v verbosity verbosity level (0,1,2,3,4,5)
-z set flush-to-zero and denormals-are-zeros MXCSR control flags

qsim_amplitudes reads input files of bitstrings, computes the corresponding amplitudes at specified times and writes them to output files.

Bitstring files should contain bitstings (one bitstring per line) in text format.

Example:

./qsim_amplitudes.x -c ../circuits/circuit_q24 -t 4 -d 16,24 -i ../circuits/bitstrings_q24_s1,../circuits/bitstrings_q24_s2 -o ampl_q24_s1,ampl_q24_s2 -v 1

qsim_qtrajectory_cuda usage

./qsim_qtrajectory_cuda.x -c circuit_file \
                          -d times_to_calculate_observables \
                          -a amplitude_damping_const \
                          -p phase_damping_const \
                          -t traj0 -n num_trajectories \
                          -f max_fused_size \
                          -v verbosity
Flag Description
-c circuit_file circuit file to run
-d times_to_calculate_observables comma-separated list of circuit times to calculate observables at
-a amplitude_damping_const amplitude damping constant
-p phase_damping_const phase damping constant
-t traj0 starting trajectory
-n num_trajectories number of trajectories to run starting with traj0
-f max_fused_size maximum fused gate size
-v verbosity verbosity level (0,1,2,3,4,5)

qsim_qtrajectory_cuda runs on GPUs. qsim_qtrajectory_cuda performs quantum trajactory simulations with amplitude damping and phase damping noise channels. qsim_qtrajectory_cuda calculates observables (operator X at each qubit) at specified times.

Example:

./qsim_qtrajectory_cuda.x -c ../circuits/circuit_q24 -d 8,16,32 -a 0.005 -p 0.005 -t 0 -n 100 -f 4 -v 0