mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 15:10:22 -05:00
#14596 Name the remaining unnamed OpenMP critical sections
All unnamed critical regions map to the same implicit name, so a single process wide lock was shared by summary import, geometry generation, grid bounding box computation and NNC merging. Unrelated parallel loops therefore serialized against each other. Give each region a critical_section_ name describing what it protects. The two regions guarding RifOpmCommonEclipseSummary::sm_createdEsmryFileCount deliberately share one name, as they protect the same counter.
This commit is contained in:
1 parent
63f73a2154
commit
4a6ebedade
8 files changed
+10
-10
No files matched your search
@@ -79,7 +79,7 @@ void RifOpmCommonEclipseSummary::setEnsembleImportState( RifEnsembleImportConfig
|
||||
void RifOpmCommonEclipseSummary::resetEnhancedSummaryFileCount()
|
||||
{
|
||||
// This function can be called from a parallel loop, make it thread safe
|
||||
#pragma omp critical
|
||||
#pragma omp critical( critical_section_createdEsmryFileCount )
|
||||
sm_createdEsmryFileCount = 0;
|
||||
}
|
||||
|
||||
@@ -405,6 +405,6 @@ std::string RifOpmCommonEclipseSummary::keywordForAddress( const RifEclipseSumma
|
||||
void RifOpmCommonEclipseSummary::increaseEsmryFileCount()
|
||||
{
|
||||
// This function can be called from a parallel loop, make it thread safe
|
||||
#pragma omp critical
|
||||
#pragma omp critical( critical_section_createdEsmryFileCount )
|
||||
sm_createdEsmryFileCount++;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ std::pair<std::set<RifEclipseSummaryAddress>, std::map<RifEclipseSummaryAddress,
|
||||
}
|
||||
}
|
||||
|
||||
#pragma omp critical
|
||||
#pragma omp critical( critical_section_RifOpmSummaryTools_buildAddresses )
|
||||
{
|
||||
addresses.insert( threadAddresses.begin(), threadAddresses.end() );
|
||||
addressToKeywordMap.insert( threadAddressToKeywordMap.begin(), threadAddressToKeywordMap.end() );
|
||||
|
||||
@@ -100,7 +100,7 @@ size_t RifSummaryReaderInterface::dataObjectCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifSummaryReaderInterface::increaseSerialNumber()
|
||||
{
|
||||
#pragma omp critical
|
||||
#pragma omp critical( critical_section_RifSummaryReaderInterface_serialNumber )
|
||||
m_serialNumber = m_nextSerialNumber++;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -250,7 +250,7 @@ void RivSurfaceIntersectionGeometryGenerator::calculateArrays()
|
||||
std::array<double, 8> cornerWeights2 =
|
||||
caf::HexInterpolator::vertexWeights( cellCorners, clippedTriangleVxes[triVxIdx + 2] );
|
||||
|
||||
#pragma omp critical
|
||||
#pragma omp critical( critical_section_RivSurfaceIntersectionGeometryGenerator_computeArrays )
|
||||
{
|
||||
outputTriangleVertices.emplace_back( point0 );
|
||||
outputTriangleVertices.emplace_back( point1 );
|
||||
|
||||
+1
-1
@@ -219,7 +219,7 @@ std::vector<cvf::Vec4d>
|
||||
// Add critical section here due to a weird bug when running in a single thread
|
||||
// Running multi threaded does not require this critical section, as we use a thread local data
|
||||
// structure
|
||||
#pragma omp critical
|
||||
#pragma omp critical( critical_section_RigContourMapTrianglesGenerator_threadTriangles )
|
||||
threadTriangles[myThread][c].insert( threadTriangles[myThread][c].end(),
|
||||
clippedTriangles.begin(),
|
||||
clippedTriangles.end() );
|
||||
|
||||
@@ -115,7 +115,7 @@ cvf::StructGridInterface::FaceType RigCellFaceGeometryTools::calculateCellFaceOv
|
||||
|
||||
void assignThreadConnections( RigConnectionContainer& allConnections, RigConnectionContainer& threadConnections )
|
||||
{
|
||||
#pragma omp critical
|
||||
#pragma omp critical( critical_section_RigCellFaceGeometryTools_assignThreadConnections )
|
||||
{
|
||||
allConnections.push_back( threadConnections );
|
||||
}
|
||||
|
||||
@@ -989,7 +989,7 @@ void RigMainGrid::buildCellSearchTree() const
|
||||
threadIndicesForBoundingBoxes.shrink_to_fit();
|
||||
threadBoundingBoxes.shrink_to_fit();
|
||||
|
||||
#pragma omp critical
|
||||
#pragma omp critical( critical_section_RigMainGrid_buildCellSearchTree )
|
||||
{
|
||||
cellIndicesForBoundingBoxes.insert( cellIndicesForBoundingBoxes.end(),
|
||||
threadIndicesForBoundingBoxes.begin(),
|
||||
|
||||
@@ -496,7 +496,7 @@ bool AABBTree::buildTree()
|
||||
{
|
||||
bThreadRes = bThreadRes && buildTree(m_previousLevelNodes[i].node, m_previousLevelNodes[i].fromIdx, m_previousLevelNodes[i].toIdx, 4);
|
||||
}
|
||||
#pragma omp critical
|
||||
#pragma omp critical(critical_section_BoundingBoxTree_buildTree)
|
||||
{
|
||||
bRes = bRes && bThreadRes;
|
||||
}
|
||||
@@ -860,7 +860,7 @@ cvf::BoundingBox BoundingBoxTreeImpl::createLeaves()
|
||||
m_ppLeaves[i] = leaf;
|
||||
threadBox.addValid(m_validBoundingBoxes[i]);
|
||||
}
|
||||
#pragma omp critical
|
||||
#pragma omp critical(critical_section_BoundingBoxTree_createLeaves)
|
||||
{
|
||||
box.addValid(threadBox);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user