JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
jevois::ParallelForAPIjevois Class Reference

#include <jevois/Util/ThreadPool.H>

A parallel API to make OpenCV use our thread pool.

The goal is to avoid over-subscribing our cores by having several disjoint parallelization mechanisms: our JeVois ThreadPool, and OpenCV's parallel_for backend (which may be TBB, OpenMP, etc). We can also enforce here that OpenCV tasks will only run on big cores, while the default OpenCV behavior is to use all cores. This can lead to bad delays if little A53 cores are chosen for tome tasks, as they are much slower than the big A73 cores.

Definition at line 79 of file ThreadPool.H.

Inheritance diagram for jevois::ParallelForAPIjevois:
Collaboration diagram for jevois::ParallelForAPIjevois:

Public Member Functions

 ParallelForAPIjevois (ThreadPool *tp)
 Constructor from an existing ThreadPool.
 
virtual ~ParallelForAPIjevois ()
 Virtual destructor for save inheritance.
 
virtual void parallel_for (int tasks, cv::parallel::ParallelForAPI::FN_parallel_for_body_cb_t body_callback, void *callback_data) override
 Run a parallelized OpenCV task.
 
virtual int getThreadNum () const override
 Get some index for the current thread.
 
virtual int getNumThreads () const override
 Get number of threads for concurrency (always 4 on JeVois-Pro, unless changed by setNumThreads() here)
 
virtual int setNumThreads (int nThreads) override
 Set number of threads for OpenCV. NOTE: currently does nothing, we always use 4 big A73 threads.
 
virtual char const * getName () const override
 Get the name: 'jevois'.
 

Protected Attributes

ThreadPoolitsThreadpool
 
int itsNumThreads
 

Constructor & Destructor Documentation

◆ ParallelForAPIjevois()

jevois::ParallelForAPIjevois::ParallelForAPIjevois ( jevois::ThreadPool tp)

Constructor from an existing ThreadPool.

Definition at line 126 of file ThreadPool.C.

◆ ~ParallelForAPIjevois()

jevois::ParallelForAPIjevois::~ParallelForAPIjevois ( )
virtual

Virtual destructor for save inheritance.

Definition at line 130 of file ThreadPool.C.

Member Function Documentation

◆ getName()

char const * jevois::ParallelForAPIjevois::getName ( ) const
overridevirtual

Get the name: 'jevois'.

Definition at line 173 of file ThreadPool.C.

◆ getNumThreads()

int jevois::ParallelForAPIjevois::getNumThreads ( ) const
overridevirtual

Get number of threads for concurrency (always 4 on JeVois-Pro, unless changed by setNumThreads() here)

Definition at line 161 of file ThreadPool.C.

◆ getThreadNum()

int jevois::ParallelForAPIjevois::getThreadNum ( ) const
overridevirtual

Get some index for the current thread.

Definition at line 155 of file ThreadPool.C.

◆ parallel_for()

void jevois::ParallelForAPIjevois::parallel_for ( int  tasks,
cv::parallel::ParallelForAPI::FN_parallel_for_body_cb_t  body_callback,
void *  callback_data 
)
overridevirtual

Run a parallelized OpenCV task.

Definition at line 134 of file ThreadPool.C.

References jevois::joinall(), and LDEBUG.

◆ setNumThreads()

int jevois::ParallelForAPIjevois::setNumThreads ( int  nThreads)
overridevirtual

Set number of threads for OpenCV. NOTE: currently does nothing, we always use 4 big A73 threads.

Definition at line 165 of file ThreadPool.C.

References LERROR.

Member Data Documentation

◆ itsNumThreads

int jevois::ParallelForAPIjevois::itsNumThreads
protected

Definition at line 108 of file ThreadPool.H.

◆ itsThreadpool

ThreadPool* jevois::ParallelForAPIjevois::itsThreadpool
protected

Definition at line 107 of file ThreadPool.H.


The documentation for this class was generated from the following files: