mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
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:
@@ -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 )
|
||||
|
||||
Reference in New Issue
Block a user