Skip to content

Commit a2b2a7d

Browse files
committed
patched openmp warning
some compilers give a warning about the OpenMP atomic pragmas when compiling without OpenMP also standardised use of 'density-matrix' in unit test sections
1 parent 6e25723 commit a2b2a7d

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

QuEST/src/CPU/QuEST_cpu.c

+4
Original file line numberDiff line numberDiff line change
@@ -3459,7 +3459,9 @@ void statevec_calcProbOfAllOutcomesLocal(qreal* outcomeProbs, Qureg qureg, int*
34593459
prob = stateRe[i]*stateRe[i] + stateIm[i]*stateIm[i];
34603460

34613461
// atomicly update corresponding outcome array element
3462+
# ifdef _OPENMP
34623463
# pragma omp atomic update
3464+
# endif
34633465
outcomeProbs[outcomeInd] += prob;
34643466
}
34653467
}
@@ -3528,7 +3530,9 @@ void densmatr_calcProbOfAllOutcomesLocal(qreal* outcomeProbs, Qureg qureg, int*
35283530
outcomeInd += extractBit(qubits[q], basisStateInd) * (1LL << q);
35293531

35303532
// atomicly update corresponding outcome array element
3533+
# ifdef _OPENMP
35313534
# pragma omp atomic update
3535+
# endif
35323536
outcomeProbs[outcomeInd] += stateRe[index];
35333537
}
35343538
}

tests/test_calculations.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ TEST_CASE( "calcProbOfAllOutcomes", "[calculations]" ) {
934934
REQUIRE( areEqual(refProbs, probs) );
935935
}
936936
}
937-
SECTION( "density matrix" ) {
937+
SECTION( "density-matrix" ) {
938938

939939
SECTION( "normalised" ) {
940940

tests/test_operators.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ TEST_CASE( "applyMultiVarPhaseFunc", "[operators]" ) {
593593
int numQubitsPerReg[] = {2,3};
594594
int qubits[] = {0,1,2,3,4};
595595

596-
SECTION( "density matrix" ) {
596+
SECTION( "density-matrix" ) {
597597

598598
Qureg dens = quregVec;
599599
dens.isDensityMatrix = 1;
@@ -821,7 +821,7 @@ TEST_CASE( "applyMultiVarPhaseFuncOverrides", "[operators]" ) {
821821
int numQubitsPerReg[] = {2,3};
822822
int qubits[] = {0,1,2,3,4};
823823

824-
SECTION( "density matrix" ) {
824+
SECTION( "density-matrix" ) {
825825

826826
Qureg dens = quregVec;
827827
dens.isDensityMatrix = 1;
@@ -1072,7 +1072,7 @@ TEST_CASE( "applyNamedPhaseFunc", "[operators]" ) {
10721072
int numQubitsPerReg[] = {2,3};
10731073
int regs[] = {0,1,2,3,4};
10741074

1075-
SECTION( "density matrix" ) {
1075+
SECTION( "density-matrix" ) {
10761076

10771077
Qureg dens = quregVec;
10781078
dens.isDensityMatrix = 1;
@@ -1292,7 +1292,7 @@ TEST_CASE( "applyNamedPhaseFuncOverrides", "[operators]" ) {
12921292
int numQubitsPerReg[] = {2,3};
12931293
int regs[] = {0,1,2,3,4};
12941294

1295-
SECTION( "density matrix" ) {
1295+
SECTION( "density-matrix" ) {
12961296

12971297
Qureg dens = quregVec;
12981298
dens.isDensityMatrix = 1;
@@ -1663,7 +1663,7 @@ TEST_CASE( "applyParamNamedPhaseFunc", "[operators]" ) {
16631663
int numQubitsPerReg[] = {2,3};
16641664
int regs[] = {0,1,2,3,4};
16651665

1666-
SECTION( "density matrix" ) {
1666+
SECTION( "density-matrix" ) {
16671667

16681668
Qureg dens = quregVec;
16691669
dens.isDensityMatrix = 1;
@@ -2053,7 +2053,7 @@ TEST_CASE( "applyParamNamedPhaseFuncOverrides", "[operators]" ) {
20532053
int numQubitsPerReg[] = {2,3};
20542054
int regs[] = {0,1,2,3,4};
20552055

2056-
SECTION( "density matrix" ) {
2056+
SECTION( "density-matrix" ) {
20572057

20582058
Qureg dens = quregVec;
20592059
dens.isDensityMatrix = 1;
@@ -2435,7 +2435,7 @@ TEST_CASE( "applyPhaseFunc", "[operators]" ) {
24352435
int numQubits = 3;
24362436
int qubits[] = {0,1,2};
24372437

2438-
SECTION( "density matrix" ) {
2438+
SECTION( "density-matrix" ) {
24392439

24402440
Qureg dens = quregVec;
24412441
dens.isDensityMatrix = 1;
@@ -2597,7 +2597,7 @@ TEST_CASE( "applyPhaseFuncOverrides", "[operators]" ) {
25972597
int numQubits = 3;
25982598
int qubits[] = {0,1,2};
25992599

2600-
SECTION( "density matrix" ) {
2600+
SECTION( "density-matrix" ) {
26012601

26022602
Qureg dens = quregVec;
26032603
dens.isDensityMatrix = 1;

0 commit comments

Comments
 (0)