Abstract threadpool interface. More...
#include <dnnl_threadpool_iface.hpp>
Public Member Functions | |
virtual int | get_num_threads () const =0 |
Returns the number of worker threads. | |
virtual bool | get_in_parallel () const =0 |
Returns true if the calling thread belongs to this threadpool. | |
virtual void | parallel_for (int n, const std::function< void(int, int)> &fn)=0 |
Submits n instances of a closure for execution in parallel: More... | |
virtual uint64_t | get_flags () const =0 |
Returns threadpool behavior flags bit mask (see below). | |
Static Public Attributes | |
static constexpr uint64_t | ASYNCHRONOUS = 1 |
If set, parallel_for() returns immediately and oneDNN needs implement waiting for the submitted closures to finish execution on its own. More... | |
Abstract threadpool interface.
The users are expected to subclass this interface and pass an object to the library during CPU stream creation or directly in case of BLAS functions.
|
pure virtual |
Submits n instances of a closure for execution in parallel:
for (int i = 0; i < n; i++) fn(i, n);
|
static |
If set, parallel_for() returns immediately and oneDNN needs implement waiting for the submitted closures to finish execution on its own.