Skip to content

Commit 7cffa8e

Browse files
committed
Fix leftover tsan findings in non-AD code.
1 parent a236b5a commit 7cffa8e

1 file changed

Lines changed: 36 additions & 33 deletions

File tree

Common/src/interface_interpolation/CMirror.cpp

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -192,45 +192,48 @@ void CMirror::SetTransferCoeff(const CConfig* const* config) {
192192

193193
/*--- Loop over the vertices on the target marker, define one row of the transpose matrix. ---*/
194194

195-
SU2_OMP_PARALLEL_(for schedule(dynamic,roundUpDiv(nVertexTarget, 2*omp_get_max_threads())))
196-
for (auto iVertex = 0ul; iVertex < nVertexTarget; ++iVertex) {
197-
198-
auto& target_vertex = targetVertices[markTarget][iVertex];
199-
const auto iPoint = target_geometry->vertex[markTarget][iVertex]->GetNode();
200-
201-
if (!target_geometry->nodes->GetDomain(iPoint)) continue;
202-
203-
/*--- Any point of the donor geometry, that has this target point as a donor, becomes a donor. ---*/
204-
const long targetGlobalIndex = target_geometry->nodes->GetGlobalIndex(iPoint);
205-
206-
/*--- Count donors and safe the binary search results (this is why we sorted the matrix). ---*/
207-
auto nDonor = 0ul;
208-
vector<pair<long*,long*> > ranges(nSend);
209-
for (int iSend = 0; iSend < nSend; ++iSend) {
210-
const auto iProcessor = iSendProcessor[iSend];
211-
const auto numCoeff = allNumNodeDonor[iProcessor];
212-
auto p = equal_range(DonorIndex[iSend], DonorIndex[iSend]+numCoeff, targetGlobalIndex);
213-
nDonor += (p.second - p.first);
214-
ranges[iSend] = p;
215-
}
195+
SU2_OMP_PARALLEL
196+
{
197+
SU2_OMP_FOR_DYN(roundUpDiv(nVertexTarget, 2*omp_get_max_threads()))
198+
for (auto iVertex = 0ul; iVertex < nVertexTarget; ++iVertex) {
199+
200+
auto& target_vertex = targetVertices[markTarget][iVertex];
201+
const auto iPoint = target_geometry->vertex[markTarget][iVertex]->GetNode();
202+
203+
if (!target_geometry->nodes->GetDomain(iPoint)) continue;
204+
205+
/*--- Any point of the donor geometry, that has this target point as a donor, becomes a donor. ---*/
206+
const long targetGlobalIndex = target_geometry->nodes->GetGlobalIndex(iPoint);
207+
208+
/*--- Count donors and safe the binary search results (this is why we sorted the matrix). ---*/
209+
auto nDonor = 0ul;
210+
vector<pair<long*,long*> > ranges(nSend);
211+
for (int iSend = 0; iSend < nSend; ++iSend) {
212+
const auto iProcessor = iSendProcessor[iSend];
213+
const auto numCoeff = allNumNodeDonor[iProcessor];
214+
auto p = equal_range(DonorIndex[iSend], DonorIndex[iSend]+numCoeff, targetGlobalIndex);
215+
nDonor += (p.second - p.first);
216+
ranges[iSend] = p;
217+
}
216218

217-
target_vertex.resize(nDonor);
219+
target_vertex.resize(nDonor);
218220

219-
/*--- Use the search results to set the interpolation coefficients. ---*/
220-
for (int iSend = 0, iDonor = 0; iSend < nSend; ++iSend) {
221-
const auto iProcessor = iSendProcessor[iSend];
221+
/*--- Use the search results to set the interpolation coefficients. ---*/
222+
for (int iSend = 0, iDonor = 0; iSend < nSend; ++iSend) {
223+
const auto iProcessor = iSendProcessor[iSend];
222224

223-
const auto first = ranges[iSend].first - DonorIndex[iSend];
224-
const auto last = ranges[iSend].second - DonorIndex[iSend];
225+
const auto first = ranges[iSend].first - DonorIndex[iSend];
226+
const auto last = ranges[iSend].second - DonorIndex[iSend];
225227

226-
for (auto iCoeff = first; iCoeff < last; ++iCoeff) {
227-
target_vertex.processor[iDonor] = iProcessor;
228-
target_vertex.coefficient[iDonor] = DonorCoeff[iSend][iCoeff];
229-
target_vertex.globalPoint[iDonor] = GlobalIndex[iSend][iCoeff];
230-
++iDonor;
228+
for (auto iCoeff = first; iCoeff < last; ++iCoeff) {
229+
target_vertex.processor[iDonor] = iProcessor;
230+
target_vertex.coefficient[iDonor] = DonorCoeff[iSend][iCoeff];
231+
target_vertex.globalPoint[iDonor] = GlobalIndex[iSend][iCoeff];
232+
++iDonor;
233+
}
231234
}
232235
}
233-
236+
END_SU2_OMP_FOR
234237
}
235238
END_SU2_OMP_PARALLEL
236239

0 commit comments

Comments
 (0)