Several OpenMP improvements

Several optimizations based on profiling of 20M grid model. These fixes will improve the largest performance issues, but there are still more operations that can be refactored.

* OpenMP: Use in fault geometry generator
* OpenMP: Use when computing statistics for result values
* OpenMP: Use multithreading on fault detection
* Add RiaOpenMPTools
* VizFwk: Use openMP for texture generation
This commit is contained in:
Magne Sjaastad
2022-12-19 13:49:03 +01:00
committed by GitHub
parent 254c74be13
commit a423ecf95f
12 changed files with 244 additions and 110 deletions

View File

@@ -18,6 +18,7 @@
#include "RimContourMapProjection.h"
#include "RiaOpenMPTools.h"
#include "RiaWeightedGeometricMeanCalculator.h"
#include "RiaWeightedHarmonicMeanCalculator.h"
#include "RiaWeightedMeanCalculator.h"
@@ -45,10 +46,6 @@
#include <algorithm>
#ifdef USE_OPENMP
#include <omp.h>
#endif
namespace caf
{
template <>
@@ -861,19 +858,13 @@ void RimContourMapProjection::generateTrianglesWithVertexValues()
}
}
#ifdef USE_OPENMP
std::vector<std::vector<std::vector<cvf::Vec4d>>> threadTriangles( omp_get_max_threads() );
#else
std::vector<std::vector<std::vector<cvf::Vec4d>>> threadTriangles( 1 );
#endif
int numberOfThreads = RiaOpenMPTools::availableThreadCount();
std::vector<std::vector<std::vector<cvf::Vec4d>>> threadTriangles( numberOfThreads );
#pragma omp parallel
{
#ifdef USE_OPENMP
int myThread = omp_get_thread_num();
#else
int myThread = 0;
#endif
int myThread = RiaOpenMPTools::currentThreadIndex();
threadTriangles[myThread].resize( std::max( (size_t)1, m_contourPolygons.size() ) );
#pragma omp for schedule( dynamic )