The Quantum Exact Simulation Toolkit v4.3.0
Loading...
Searching...
No Matches
 TEST_CASE ("initQuESTEnv", TEST_CATEGORY)
 
 TEST_CASE ("initCustomQuESTEnv", TEST_CATEGORY)
 
 TEST_CASE ("initCustomMpiQuESTEnv", TEST_CATEGORY)
 
 TEST_CASE ("finalizeQuESTEnv", TEST_CATEGORY)
 
 TEST_CASE ("syncQuESTEnv", TEST_CATEGORY)
 
 TEST_CASE ("isQuESTEnvInit", TEST_CATEGORY)
 
 TEST_CASE ("getQuESTEnv", TEST_CATEGORY)
 

Detailed Description

Function Documentation

◆ TEST_CASE() [1/7]

TEST_CASE ( "finalizeQuESTEnv" ,
TEST_CATEGORY  )

Definition at line 104 of file environment.cpp.

104 {
105
106 SECTION( LABEL_CORRECTNESS ) {
107
108 // cannot be meaningfully tested since calling
109 // mid-tests will break subsequent testing
110 SUCCEED( );
111 }
112
113 SECTION( LABEL_VALIDATION ) {
114
115 // cannot be validated since calling it once
116 // is always valid but would break subsequent tests
117 SUCCEED( );
118 }
119}

◆ TEST_CASE() [2/7]

TEST_CASE ( "getQuESTEnv" ,
TEST_CATEGORY  )

Definition at line 155 of file environment.cpp.

155 {
156
157 SECTION( LABEL_CORRECTNESS ) {
158
159 QuESTEnv env = getQuESTEnv();
160
161 REQUIRE( env.rank >= 0 );
162 REQUIRE( env.numNodes >= 0 );
163
164 if (!env.isDistributed) {
165 REQUIRE( env.rank == 0 );
166 REQUIRE( env.numNodes == 1 );
167 }
168
169 bool isNumNodesPow2 = ((env.numNodes & (env.numNodes - 1)) == 0);
170 REQUIRE( isNumNodesPow2 );
171 }
172
173 SECTION( LABEL_VALIDATION ) {
174
175 // performs no validation
176 SUCCEED( );
177 }
178}
QuESTEnv getQuESTEnv()

◆ TEST_CASE() [3/7]

TEST_CASE ( "initCustomMpiQuESTEnv" ,
TEST_CATEGORY  )

Definition at line 86 of file environment.cpp.

86 {
87
88 SECTION( LABEL_CORRECTNESS ) {
89
90 // cannot be meaningfully tested since env already active
91 SUCCEED( );
92 }
93
94 SECTION( LABEL_VALIDATION ) {
95
96 REQUIRE_THROWS_WITH( initCustomMpiQuESTEnv(0,0,0,0), ContainsSubstring( "already been initialised") );
97
98 // cannot check arguments since env-already-initialised
99 // validation is performed first
100 }
101}
void initCustomMpiQuESTEnv(int useDistrib, bool userOwnsMpi, int useGpuAccel, int useMultithread)

◆ TEST_CASE() [4/7]

TEST_CASE ( "initCustomQuESTEnv" ,
TEST_CATEGORY  )

Definition at line 68 of file environment.cpp.

68 {
69
70 SECTION( LABEL_CORRECTNESS ) {
71
72 // cannot be meaningfully tested since env already active
73 SUCCEED( );
74 }
75
76 SECTION( LABEL_VALIDATION ) {
77
78 REQUIRE_THROWS_WITH( initCustomQuESTEnv(0,0,0), ContainsSubstring( "already been initialised") );
79
80 // cannot check arguments since env-already-initialised
81 // validation is performed first
82 }
83}
void initCustomQuESTEnv(int useDistrib, int useGpuAccel, int useMultithread)

◆ TEST_CASE() [5/7]

TEST_CASE ( "initQuESTEnv" ,
TEST_CATEGORY  )

TESTS

Definition at line 46 of file environment.cpp.

46 {
47
48 SECTION( LABEL_CORRECTNESS ) {
49
50 // cannot be meaningfully tested since env already active
51 SUCCEED( );
52 }
53
54 SECTION( LABEL_VALIDATION ) {
55
56 REQUIRE_THROWS_WITH( initQuESTEnv(), ContainsSubstring( "already been initialised") );
57
58 // cannot automatically check other validations, such as:
59 // - has env been previously initialised then finalised?
60 // - is env distributed over power-of-2 nodes?
61 // - are environment-variables valid?
62 // - is max 1 MPI process bound to each GPU?
63 // - is GPU compatible with cuQuantum (if enabled)?
64 }
65}
void initQuESTEnv()

◆ TEST_CASE() [6/7]

TEST_CASE ( "isQuESTEnvInit" ,
TEST_CATEGORY  )

Definition at line 139 of file environment.cpp.

139 {
140
141 SECTION( LABEL_CORRECTNESS ) {
142
143 // cannot test for other outcome
144 REQUIRE( isQuESTEnvInit() == 1 );
145 }
146
147 SECTION( LABEL_VALIDATION ) {
148
149 // performs no validation
150 SUCCEED( );
151 }
152}
int isQuESTEnvInit()

◆ TEST_CASE() [7/7]

TEST_CASE ( "syncQuESTEnv" ,
TEST_CATEGORY  )

Definition at line 122 of file environment.cpp.

122 {
123
124 SECTION( LABEL_CORRECTNESS ) {
125
126 // always legal to call
127 REQUIRE_NOTHROW( syncQuESTEnv() );
128 }
129
130 SECTION( LABEL_VALIDATION ) {
131
132 // cannot test validation (that env is already
133 // created) since we cannot call before initQuESTEnv
134 SUCCEED( );
135 }
136}
void syncQuESTEnv()