oneAPI Deep Neural Network Library (oneDNN)
Performance library for Deep Learning
1.96.0
dnnl::threadpool_interop::threadpool_iface Struct Referenceabstract

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...
 

Detailed Description

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.

Member Function Documentation

◆ parallel_for()

virtual void dnnl::threadpool_interop::threadpool_iface::parallel_for ( int  n,
const std::function< void(int, int)> &  fn 
)
pure virtual

Submits n instances of a closure for execution in parallel:

for (int i = 0; i < n; i++) fn(i, n);

Member Data Documentation

◆ ASYNCHRONOUS

constexpr uint64_t dnnl::threadpool_interop::threadpool_iface::ASYNCHRONOUS = 1
static

If set, parallel_for() returns immediately and oneDNN needs implement waiting for the submitted closures to finish execution on its own.


The documentation for this struct was generated from the following file: