ONE - On-device Neural Engine
Loading...
Searching...
No Matches
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 32 of file ParallelScheduler.h.

Constructor & Destructor Documentation

◆ ParallelScheduler()

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

Constructs ParallelScheduler object.

Parameters
backendsBackend set

Definition at line 29 of file ParallelScheduler.cc.

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

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 39 of file ParallelScheduler.cc.

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

◆ finish()

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

Block until all jobs are finished.

Definition at line 46 of file ParallelScheduler.cc.

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

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