The Quantum Exact Simulation Toolkit v4.3.0
Loading...
Searching...
No Matches

Testing utilities for loading environment variables which configure the unit tests, independent of QuEST's internal environment variable facilities. More...

Functions

int getDefaultNumGpuThreadsPerBlock ()
 
int getMaxNumTestedQubitPermutations ()
 
int getMaxNumTestedSuperoperatorTargets ()
 
int getNumQubitsInUnitTestedQuregs ()
 
int getNumTestedMixedDeploymentRepetitions ()
 
bool getWhetherToTestAllDeployments ()
 

Variables

const int QUEST_TEST_MAX_NUM_QUBIT_PERMUTATIONS = 0
 
const int QUEST_TEST_MAX_NUM_SUPEROP_TARGETS = 4
 
const int QUEST_TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS = 10
 
const int QUEST_TEST_NUM_QUBITS_IN_QUREG = 6
 
const int QUEST_TEST_TRY_ALL_DEPLOYMENTS = 1
 

Detailed Description

Testing utilities for loading environment variables which configure the unit tests, independent of QuEST's internal environment variable facilities.

Function Documentation

◆ getDefaultNumGpuThreadsPerBlock()

int getDefaultNumGpuThreadsPerBlock ( )

Definition at line 82 of file config.cpp.

82 {
83
84 // when the env-var is not present, we MUST return the default assumed by the QuEST src code,
85 // which at the time of writing, is a fixed 128 (rather than hardware-specific value)
86 const int compileTimeDefaultTPB = 128;
87
88 // when the env-var is present, we consult that, just like QuEST
89 static int value = getIntEnvVarValueOrDefault("QUEST_NUM_GPU_THREADS_PER_BLOCK", compileTimeDefaultTPB);
90 return value;
91}

◆ getMaxNumTestedQubitPermutations()

int getMaxNumTestedQubitPermutations ( )

Definition at line 52 of file config.cpp.

52 {
53
54 static int value = getIntEnvVarValueOrDefault("QUEST_TEST_MAX_NUM_QUBIT_PERMUTATIONS", 0);
55 return value;
56}

◆ getMaxNumTestedSuperoperatorTargets()

int getMaxNumTestedSuperoperatorTargets ( )

Definition at line 58 of file config.cpp.

58 {
59
60 static int value = getIntEnvVarValueOrDefault("QUEST_TEST_MAX_NUM_SUPEROP_TARGETS", 4);
61 return value;
62}

◆ getNumQubitsInUnitTestedQuregs()

int getNumQubitsInUnitTestedQuregs ( )

Definition at line 46 of file config.cpp.

46 {
47
48 static int value = getIntEnvVarValueOrDefault("QUEST_TEST_NUM_QUBITS_IN_QUREG", 6);
49 return value;
50}

◆ getNumTestedMixedDeploymentRepetitions()

int getNumTestedMixedDeploymentRepetitions ( )

Definition at line 64 of file config.cpp.

64 {
65
66 static int value = getIntEnvVarValueOrDefault("QUEST_TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS", 10);
67 return value;
68}

◆ getWhetherToTestAllDeployments()

bool getWhetherToTestAllDeployments ( )

Definition at line 70 of file config.cpp.

70 {
71
72 static bool value = getIntEnvVarValueOrDefault("QUEST_TEST_TRY_ALL_DEPLOYMENTS", 1);
73 return value;
74}

Variable Documentation

◆ QUEST_TEST_MAX_NUM_QUBIT_PERMUTATIONS

const int QUEST_TEST_MAX_NUM_QUBIT_PERMUTATIONS = 0
Note
This entity is actually an environment variable.

Specifies the maximum number of control and target qubit permutations for which to unit test each relevant API function.

Many QuEST functions accept a varying number of target qubits (like applyCompMatr()) and/or control qubits (like applyMultiControlledCompMatr()). The unit tests will run these functions, passing every possible number of target qubits (alongside every possible number of control qubits, if possible), from one (zero) up to the number contained within the tested Qureg (minus the number of target qubits).

For each of these tested number-of-targets and number-of-controls combinations, there are factorially-many possible choices of the arbitrarily-ordered qubit indices, i.e. sub-permutations of all Qureg qubits. By default, the unit tests deterministically check every permutation in-turn. This can become prohibitively slow when the tested Qureg are large. For example, there are 604,800 unique, non-overlapping choices of 4 targets and 3 controls in a Qureg containing 10 qubits.

When this environment variable is set to a non-zero value, the unit tests will forego testing every permutation and instead perform only the number specified, randomising the involved qubits. This can significantly speed up the tests though risks missing esoteric edge-cases. The runtime of the tests are approximately linearly proportional to the specified number of permutations. When the specified non-zero value exceeds the number of unique permutations, the tests will revert to deterministically evaluating each once.

Values
  • set to 0 (default) to systematically test all permutations.
  • set to a positive integer (e.g. 50) to test (at most) that many random permutations and accelerate the tests.
Author
Tyson Jones

Definition at line 67 of file config.hpp.

◆ QUEST_TEST_MAX_NUM_SUPEROP_TARGETS

const int QUEST_TEST_MAX_NUM_SUPEROP_TARGETS = 4
Note
This entity is actually an environment variable.

Definition at line 70 of file config.hpp.

◆ QUEST_TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS

const int QUEST_TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS = 10
Note
This entity is actually an environment variable.

Definition at line 76 of file config.hpp.

◆ QUEST_TEST_NUM_QUBITS_IN_QUREG

const int QUEST_TEST_NUM_QUBITS_IN_QUREG = 6
Note
This entity is actually an environment variable.

Definition at line 36 of file config.hpp.

◆ QUEST_TEST_TRY_ALL_DEPLOYMENTS

const int QUEST_TEST_TRY_ALL_DEPLOYMENTS = 1
Note
This entity is actually an environment variable.

Definition at line 73 of file config.hpp.