Skip to content

Commit 60f59eb

Browse files
author
abacus_fixer
committed
Remove redundant #pragma omp barrier directives in pw_gatherscatter.h. The #pragma omp for directive already performs implicit synchronization at the end of the loop, making explicit barrier redundant.
1 parent 98b6637 commit 60f59eb

1 file changed

Lines changed: 8 additions & 15 deletions

File tree

source/source_basis/module_pw/pw_gatherscatter.h

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,18 @@ void PW_Basis::gatherp_scatters(std::complex<T>* in, std::complex<T>* out) const
4545
const int nplane_gps = this->nplane;
4646
const int* istot2ixy_gps = this->istot2ixy;
4747
#ifdef _OPENMP
48-
#pragma omp parallel
49-
{
50-
#pragma omp for
48+
#pragma omp parallel for
5149
#endif
52-
for (int istot = 0; istot < nstot_gps; ++istot)
50+
for (int istot = 0; istot < nstot_gps; ++istot)
51+
{
52+
int ixy = istot2ixy_gps[istot];
53+
std::complex<T> *outp = &out[istot * nplane_gps];
54+
std::complex<T> *inp = &in[ixy * nplane_gps];
55+
for (int iz = 0; iz < nplane_gps; ++iz)
5356
{
54-
int ixy = istot2ixy_gps[istot];
55-
std::complex<T> *outp = &out[istot * nplane_gps];
56-
std::complex<T> *inp = &in[ixy * nplane_gps];
57-
for (int iz = 0; iz < nplane_gps; ++iz)
58-
{
59-
outp[iz] = inp[iz];
60-
}
57+
outp[iz] = inp[iz];
6158
}
62-
#ifdef _OPENMP
63-
#pragma omp barrier
6459
}
65-
#endif
6660

6761
//exchange data
6862
//(nplane,nstot) to (numz[ip],ns, poolnproc)
@@ -176,7 +170,6 @@ void PW_Basis::gathers_scatterp(std::complex<T>* in, std::complex<T>* out) const
176170
}
177171
}
178172
#ifdef _OPENMP
179-
#pragma omp barrier
180173
}
181174
#endif
182175

0 commit comments

Comments
 (0)