Generalization of a task that can be run in parallel.
More...
Inherits Task.
Inherited by AGC< T >, Array1DStacker< fT, ArrT >, Array2DCopier< T >, Array2DInterpol, Array2DReSampler< T, TT >, Array3DCopier< T >, Array3DFloodfill< T >, Array3DUdfTrcRestorer< T >, ArrayMath::ArrOperExec< OperType, ArrType >, ArrayMath::CumArrOperExec< RT, AT >, ArrayMath::CumSumExec< T >, ArrayNDDataExtracter< T >, ArrayUdfValReplacer< T >, ArrayUdfValRestorer< T >, BendPointFinderBase, BodyVolumeCalculator, ColTab::MapperTask< T >, Convolver2D< T >, Convolver3D< T >, Convolver3D< float >, DelaunayTriangulator, DensityCalc, DPSDensityCalcND, DPSFromVolumeFiller, EM::EMObjectPosSelector, EM::EMObjectRowColSelRemoval, EM::Expl2ImplBodyExtracter, EM::HorizonMerger, FaultTraceExtractor, Fourier::CC::CC1D, FourierInterpol1D, FourierInterpol2D, FourierInterpol3D, Geometry::ArrayTesselator, ImageResizer, Implicit2MarchingCubes, Line2DInterSectionFinder, LogCubeCreator, MarchingCubes2Implicit, MarchingCubesSurfaceEditor, MemCopier< T >, MemSetter< T >, MemValReplacer< T >, MuteArrayExtracter< T >, Stats::ParallelCalc< float >, ParallelDTetrahedralator, ParallelSorter< T >, PreStack::AngleMuteComputer, PreStack::Processor, RayTracer1D, RayTracerRunner, ReflectivitySampler, SampledExtremeFinderND< T >, Seis::MultiTraceSynthGenerator, Seis::ParallelReader, Seis::ParallelReader2D, Seis::RaySynthGenerator, SeisDataPackFromDPS, SeisDataPackZAxisTransformer, SeisZAxisStretcher, Smoother1D< T >, Smoother1D< float >, Stats::ParallelCalc< T >, ValueSeriesGetAll< T >, VDA2DBitMapGenerator [private]
, Vel::VolumeConverter, visBase::HorizonSectionTilePosSetup, visBase::HorizonTileRenderPreparer, visBase::HorizonTileResolutionTesselator, VolProc::StatsCalculatorTask, Well::LogSampler, ZAxisTransformer, and ZAxisTransformPointGenerator.
|
virtual bool | doWork (int64_t start, int64_t stop, int threadidx)=0 |
|
virtual bool | doPrepare (int nrthreads) |
|
virtual bool | doFinish (bool success) |
|
|
static uiString | tr (const char *text, const char *disambiguation=0, int pluralnr=-1) |
|
static uiString | legacyTr (const char *text, const char *disambiguation=0, int pluralnr=-1) |
|
Generalization of a task that can be run in parallel.
Any task that has a fixed number of computations that are independent (i.e. they don't need to be done in a certain order) can inherit ParallelTask and be executed in parallel by calling the ParallelTask::execute().
Example of usage:
float result[N];
for ( int idx=0; idx<N; idx++ )
result[idx] = input1[idx]* function( idx, other, variables );
Could be made parallel by adding the class:
{
public:
{
{
result[idx] = input1[idx] *
function( idx, other, variables );
}
return true;
}
};
and in use that instead of the for-loop:
CalcClass myclass( N, my, parameters );
myclass.exectute();
virtual ParallelTask::~ParallelTask |
( |
| ) |
|
|
virtual |
ParallelTask::ParallelTask |
( |
const char * |
nm = 0 | ) |
|
|
protected |
void ParallelTask::addToNrDone |
( |
int64_t |
increment | ) |
|
|
protected |
Call this from within your thread to say that you have done something. Do NOT call in very fast loops at every idx since it can impact negatively performance
int64_t ParallelTask::calculateThreadSize |
( |
int64_t |
totalnr, |
|
|
int |
nrthreads, |
|
|
int |
thread |
|
) |
| const |
|
protected |
virtual bool ParallelTask::doFinish |
( |
bool |
success | ) |
|
|
inlineprivatevirtual |
Called after all doWork have finished.
- Parameters
-
success | indicates whether all doWork returned true. |
Reimplemented in ArrayMath::CumSumExec< T >, ArrayMath::CumArrOperExec< RT, AT >, Stats::ParallelCalc< T >, FaultTraceExtractor2D, FaultTraceExtractor, FourierInterpol3D, Seis::ParallelReader2D, Line2DInterSectionFinder, visBase::HorizonSectionTilePosSetup, ParallelSorter< T >, FourierInterpol2D, LogCubeCreator, Seis::ParallelReader, MarchingCubesSurfaceEditor, FourierInterpol1D, EM::Horizon3DMerger, Stats::ParallelCalc< T >, Stats::ParallelCalc< float >, SeisZAxisStretcher, PreStack::AngleMuteComputer, Vel::VolumeConverter, ReflectivitySampler, BendPointFinderBase, SeisDataPackZAxisTransformer, ZAxisTransformPointGenerator, and ImageResizer.
virtual bool ParallelTask::doPrepare |
( |
int |
nrthreads | ) |
|
|
inlineprivatevirtual |
Called once, before any doWork is called.
Reimplemented in MuteArrayExtracter< T >, ArrayUdfValReplacer< T >, ArrayMath::CumSumExec< T >, ArrayMath::ArrOperExec< OperType, ArrType >, ArrayMath::CumArrOperExec< RT, AT >, Array3DCopier< T >, Array2DCopier< T >, Well::LogSampler, Seis::RaySynthGenerator, FaultTraceExtractor2D, FaultTraceExtractor3D, Seis::MultiTraceSynthGenerator, FaultTraceExtractor, TriangulationArray2DInterpol, MarchingCubes2Implicit, FourierInterpol3D, MemValReplacer< T >, DelaunayTriangulator, ParallelDTetrahedralator, Seis::ParallelReader2D, ParallelSorter< T >, MemCopier< T >, EM::Expl2ImplBodyExtracter, FourierInterpol2D, Array2DInterpol, PreStack::AngleMute, RayTracer1D, LogCubeCreator, InverseDistanceArray2DInterpol, Seis::ParallelReader, visBase::HorizonTileRenderPreparer, Fourier::CC::CC1D, MarchingCubesSurfaceEditor, MemSetter< T >, FourierInterpol1D, Convolver2D< T >, Smoother1D< T >, Stats::ParallelCalc< T >, Smoother1D< float >, Stats::ParallelCalc< float >, SeisZAxisStretcher, visBase::HorizonTileResolutionTesselator, PreStack::AngleMuteComputer, Vel::VolumeConverter, ZAxisTransformer, EM::EMObjectRowColSelRemoval, ReflectivitySampler, BendPointFinderBase, EM::EMObjectPosSelector, Array1DStacker< fT, ArrT >, SeisDataPackZAxisTransformer, AGC< T >, ZAxisTransformPointGenerator, SeisDataPackFromDPS, ContinuousCurvatureArray2DInterpol, and ImageResizer.
virtual bool ParallelTask::doWork |
( |
int64_t |
start, |
|
|
int64_t |
stop, |
|
|
int |
threadidx |
|
) |
| |
|
privatepure virtual |
bool ParallelTask::execute |
( |
| ) |
|
|
inlinevirtual |
Runs the process the desired number of times.
- Note
- that the function has static threads (normally the same number as there are processors on the machine), and these static threads will be shared by all instances of ParallelTask::execute.
Implements Task.
virtual bool ParallelTask::executeParallel |
( |
bool |
parallel | ) |
|
|
virtual |
static uiString ParallelTask::legacyTr |
( |
const char * |
text, |
|
|
const char * |
disambiguation = 0 , |
|
|
int |
pluralnr = -1 |
|
) |
| |
|
inlinestaticprivate |
virtual int ParallelTask::maxNrThreads |
( |
| ) |
const |
|
protectedvirtual |
virtual int ParallelTask::minThreadSize |
( |
| ) |
const |
|
inlineprotectedvirtual |
int64_t ParallelTask::nrDone |
( |
| ) |
const |
|
virtual |
virtual int64_t ParallelTask::nrIterations |
( |
| ) |
const |
|
protectedpure virtual |
- Returns
- the number of times the process should be run.
Implemented in MuteArrayExtracter< T >, Array3DUdfTrcRestorer< T >, ArrayUdfValRestorer< T >, ArrayUdfValReplacer< T >, ArrayMath::CumSumExec< T >, ArrayMath::ArrOperExec< OperType, ArrType >, ArrayMath::CumArrOperExec< RT, AT >, Array3DCopier< T >, Array2DCopier< T >, ArrayNDDataExtracter< T >, Well::LogSampler, DPSFromVolumeFiller, Seis::RaySynthGenerator, ExtensionArray2DInterpol, ValueSeriesGetAll< T >, Seis::MultiTraceSynthGenerator, FaultTraceExtractor, MarchingCubes2Implicit, TriangulationArray2DInterpol, FourierInterpol3D, DelaunayTriangulator, ParallelDTetrahedralator, MemValReplacer< T >, ColTab::MapperTask< T >, Seis::ParallelReader2D, VDA2DBitMapGenerator, ParallelSorter< T >, Implicit2MarchingCubes, Line2DInterSectionFinder, visBase::HorizonSectionTilePosSetup, FourierInterpol2D, EM::Expl2ImplBodyExtracter, PreStack::AngleMute, MemCopier< T >, Array1DStacker< fT, ArrT >, RayTracer1D, LogCubeCreator, Convolver2D< T >, VolProc::StatsCalculatorTask, InverseDistanceArray2DInterpol, Fourier::CC::CC1D, Seis::ParallelReader, visBase::HorizonTileRenderPreparer, MarchingCubesSurfaceEditor, PreStack::TrimStatics, Array2DReSampler< T, TT >, FourierInterpol1D, PreStack::Mute, Array3DFloodfill< T >, PreStack::Processor, MemSetter< T >, PreStack::LateralStack, EM::Horizon3DMerger, SeisZAxisStretcher, Smoother1D< T >, Smoother1D< float >, Convolver3D< T >, Stats::ParallelCalc< T >, Convolver3D< float >, Stats::ParallelCalc< float >, Convolver2D< T >, PreStack::AngleMuteComputer, Vel::VolumeConverter, ZAxisTransformer, PreStack::Stack, visBase::HorizonTileResolutionTesselator, AGC< T >, RayTracerRunner, EM::EMObjectRowColSelRemoval, ReflectivitySampler, SeisDataPackZAxisTransformer, SampledExtremeFinderND< T >, ZAxisTransformPointGenerator, EM::EMObjectPosSelector, DensityCalc, BodyVolumeCalculator, SeisDataPackFromDPS, ContinuousCurvatureArray2DInterpol, Geometry::ArrayTesselator, DPSDensityCalcND, BendPointFinderBase, and ImageResizer.
void ParallelTask::quickAddToNrDone |
( |
int64_t |
loopidx | ) |
|
|
protected |
Call this from within your thread to say that you have done something, but not very often
void ParallelTask::resetNrDone |
( |
| ) |
|
|
protected |
static uiString ParallelTask::sPosFinished |
( |
| ) |
|
|
inlinestatic |
virtual bool ParallelTask::stopAllOnFailure |
( |
| ) |
const |
|
inlineprotectedvirtual |
If one thread fails, should an attempt be made to stop the others? If true, enableWorkControl will be enabled, and threads should call shouldContinue() regularly.
Reimplemented in LogCubeCreator.
static uiString ParallelTask::sTrcFinished |
( |
| ) |
|
|
inlinestatic |
int64_t ParallelTask::totalNr |
( |
| ) |
const |
|
inlinevirtual |
static uiString ParallelTask::tr |
( |
const char * |
text, |
|
|
const char * |
disambiguation = 0 , |
|
|
int |
pluralnr = -1 |
|
) |
| |
|
inlinestaticprivate |
friend class ParallelTaskRunner |
|
friend |
int64_t ParallelTask::nrdonebigchunksz_ |
|
private |
int64_t ParallelTask::totalnrcache_ |
|
private |