ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
onert::exec::ParallelScheduler Class Reference

#include <ParallelScheduler.h>

Public Member Functions

 ParallelScheduler (const BackendSet &backends)
 Constructs ParallelScheduler object.
 
void assign (std::unique_ptr< IFunction > &&fn, const backend::Backend *backend)
 Assign a task to the given backend.
 
void finish ()
 Block until all jobs are finished.
 

Detailed Description

Definition at line 30 of file ParallelScheduler.h.

Constructor & Destructor Documentation

◆ ParallelScheduler()

onert::exec::ParallelScheduler::ParallelScheduler ( const BackendSet backends)

Constructs ParallelScheduler object.

Parameters
backendsBackend set

Definition at line 27 of file ParallelScheduler.cc.

28{
29 assert(!backends.empty());
30
31 for (auto &&backend : backends)
32 {
33 _thread_pools[backend] = std::make_unique<ThreadPool>();
34 }
35}

Member Function Documentation

◆ assign()

void onert::exec::ParallelScheduler::assign ( std::unique_ptr< IFunction > &&  fn,
const backend::Backend backend 
)

Assign a task to the given backend.

Parameters
[in]fnFunction to be assigned
[in]fnTarget backend

Definition at line 37 of file ParallelScheduler.cc.

38{
39 assert(!_thread_pools.empty());
40
41 _thread_pools.at(backend)->enqueue(std::move(fn));
42}

◆ finish()

void onert::exec::ParallelScheduler::finish ( )

Block until all jobs are finished.

Definition at line 44 of file ParallelScheduler.cc.

45{
46 for (auto &&itr : _thread_pools)
47 {
48 itr.second->finish();
49 }
50}

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