Request for Changes-63: Refactor threading mechanism in sampling filters

From OTBWiki
Jump to: navigation, search

[Request for Changes - 63] Refactor threading mechanism in sampling filters

Status

  • Author: Guillaume
  • Additional Contributors (if different than authors)
  • Submitted on 21.09.2016
  • Proposed target release : 5.8
  • Adopted : +4 from Julien, Victor, Rémi, Guillaume
  • Merged : e71cdb70cc02e42f10a8fbdea7c928c79bcbab14

Summary

This RFC brings improvements in the threading mechanism in sampling filters.

Rationale

The threading in sampling filters is done by splitting the input set of vectors, not the requested region like a lot of image filters do. So the threading methods should be adapted to avoid corner cases where the requested region can not be divided as much as the input vector set. For further details, see : Multi-threading_support_for_filters_working_on_data_types_other_than_images

Implementation details

Classes and files

M       Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.h
M       Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.txx
M       Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.h
M       Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.txx
M       Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.h
M       Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx


  • The threading is now done on the input vectors. Instead of an image region, each thread receive an ogr::Layer.
  • The handling of in-memory layers (input/output) is more hidden. They can be accessed with accessors. The method AllocateOutputs() does the job previously done by PrepareInputVectors and PrepareOutputVectors.
  • There is now a combo of functions to dispatch input vectors for each thread and to gather them after processing (DispatchInputVectors() / GatherOutputVectors())
  • The standard Before/AfterThreadedGenerateData are not used anymore. They can be freely used by deriving classes.

Applications

N.A.

Tests

Documentation

Additional notes