Compute Library
 21.11
SchedulerFactory Class Reference

Scheduler Factory. More...

#include <SchedulerFactory.h>

Public Types

enum  Type { ST, CPP, OMP }
 Scheduler type. More...
 

Static Public Member Functions

static std::unique_ptr< ISchedulercreate (Type type=_default_type)
 Create a scheduler depending on the scheduler type. More...
 

Detailed Description

Scheduler Factory.

Definition at line 34 of file SchedulerFactory.h.

Member Enumeration Documentation

◆ Type

enum Type
strong

Scheduler type.

Enumerator
ST 

Single thread.

CPP 

C++11 threads.

OMP 

OpenMP.

Definition at line 38 of file SchedulerFactory.h.

39  {
40  ST, /**< Single thread. */
41  CPP, /**< C++11 threads. */
42  OMP, /**< OpenMP. */
43  };

Member Function Documentation

◆ create()

std::unique_ptr< IScheduler > create ( Type  type = _default_type)
static

Create a scheduler depending on the scheduler type.

Parameters
[in]typeType of scheduler to create
Returns
Scheduler

Definition at line 49 of file SchedulerFactory.cpp.

References ARM_COMPUTE_ERROR, SchedulerFactory::CPP, SchedulerFactory::OMP, and SchedulerFactory::ST.

Referenced by arm_compute::test::validation::TEST_CASE().

50 {
51  switch(type)
52  {
53  case Type::ST:
54  {
55  return std::make_unique<SingleThreadScheduler>();
56  }
57  case Type::CPP:
58  {
59 #if ARM_COMPUTE_CPP_SCHEDULER
60  return std::make_unique<CPPScheduler>();
61 #else /* ARM_COMPUTE_CPP_SCHEDULER */
62  ARM_COMPUTE_ERROR("Recompile with cppthreads=1 to use C++11 scheduler.");
63 #endif /* ARM_COMPUTE_CPP_SCHEDULER */
64  }
65  case Type::OMP:
66  {
67 #if ARM_COMPUTE_OPENMP_SCHEDULER
68  return std::make_unique<OMPScheduler>();
69 #else /* ARM_COMPUTE_OPENMP_SCHEDULER */
70  ARM_COMPUTE_ERROR("Recompile with openmp=1 to use openmp scheduler.");
71 #endif /* ARM_COMPUTE_OPENMP_SCHEDULER */
72  }
73  default:
74  {
75  break;
76  }
77  }
78  ARM_COMPUTE_ERROR("Invalid Scheduler type");
79 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
decltype(strategy::transforms) typedef type

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