The Quantum Exact Simulation Toolkit
v4.2.0
Loading...
Searching...
No Matches
modes.h
1
/** @file
2
* Constants related to configuring QuEST runtime modes,
3
* and documentation of environment variables
4
*
5
* @author Tyson Jones
6
*
7
* @defgroup modes Modes
8
* @ingroup api
9
* @brief Constants and environment variables for controlling QuEST execution.
10
* @{
11
*/
12
13
#ifndef MODES_H
14
#define MODES_H
15
16
17
18
// document environment variables
19
20
// spoof env-vars as consts to doc (hackily and hopefully temporarily)
21
#if 0
22
23
24
/** @envvardoc
25
*
26
* Specifies whether to permit multiple MPI processes to deploy to the same GPU.
27
*
28
* @attention
29
* This environment variable has no effect when either (or both) of distribution or
30
* GPU-acceleration are disabled.
31
*
32
* In multi-GPU execution, which combines distribution with GPU-acceleration, it is
33
* prudent to assign each GPU to at most one MPI process in order to avoid superfluous
34
* slowdown. Hence by default, initQuESTEnv() will forbid assigning multiple MPI processes
35
* to the same GPU. This environment variable can be set to `1` to disable this validation,
36
* permitting sharing of a single GPU, as is often useful for debugging or unit testing
37
* (for example, testing multi-GPU execution when only a single GPU is available).
38
*
39
* @warning
40
* Permitting GPU sharing may cause unintended behaviour when additionally using cuQuantum.
41
*
42
* @envvarvalues
43
* - forbid sharing: @p 0, @p '0', @p '', @p , (unspecified)
44
* - permit sharing: @p 1, @p '1'
45
*
46
* @author Tyson Jones
47
*/
48
const
int
PERMIT_NODES_TO_SHARE_GPU
= 0;
49
50
51
/** @envvardoc
52
*
53
* Specifies the default validation epsilon.
54
*
55
* Specifying `DEFAULT_VALIDATION_EPSILON` to a positive, real number overrides the
56
* precision-specific default (`1E-5`, `1E-12`, `1E-13` for single, double and quadruple
57
* precision respectively). The specified epsilon is used by QuEST for numerical validation
58
* unless overriden at runtime via setValidationEpsilon(), in which case it can be
59
* restored to that specified by this environment variable using setValidationEpsilonToDefault().
60
*
61
* @envvarvalues
62
* - setting @p DEFAULT_VALIDATION_EPSILON=0 disables numerical validation, as if the value
63
* were instead infinity.
64
* - setting @p DEFAULT_VALIDATION_EPSILON='' is equivalent to _not_ specifying the variable,
65
* adopting instead the precision-specific default above.
66
* - setting @p DEFAULT_VALIDATION_EPSILON=x where `x` is a positive, valid `qreal` in any
67
* format accepted by `C` or `C++` (e.g. `0.01`, `1E-2`, `+1e-2`) will use `x` as the
68
* default validation epsilon.
69
*
70
* @constraints
71
* The function initQuESTEnv() will throw a validation error if:
72
* - The specified epsilon must be `0` or positive.
73
* - The specified epsilon must not exceed that maximum or minimum value which can be stored
74
* in a `qreal`, which is specific to its precision.
75
*
76
* @author Tyson Jones
77
*/
78
const
qreal
DEFAULT_VALIDATION_EPSILON
= 0;
79
80
81
#endif
82
83
84
85
// user flags for choosing automatic deployment; only accessible by C++
86
// backend and C++ users; C users must hardcode -1
87
88
#ifdef __cplusplus
89
90
namespace
modeflag {
91
92
extern
int
USE_AUTO;
93
}
94
95
#endif
// __cplusplus
96
97
98
99
#endif
// MODES_H
100
101
/** @} */
// (end file-wide doxygen defgroup)
DEFAULT_VALIDATION_EPSILON
const qreal DEFAULT_VALIDATION_EPSILON
Definition
modes.h:78
PERMIT_NODES_TO_SHARE_GPU
const int PERMIT_NODES_TO_SHARE_GPU
Definition
modes.h:48
quest
include
modes.h
Generated by
1.12.0