oneAPI Deep Neural Network Library (oneDNN)
1.4.0
Performance library for Deep Learning
Toggle main menu visibility
Loading...
Searching...
No Matches
include
dnnl_threadpool_iface.hpp
1
/*******************************************************************************
2
* Copyright 2020 Intel Corporation
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*******************************************************************************/
16
17
#ifndef DNNL_THREADPOOL_IFACE_HPP
18
#define DNNL_THREADPOOL_IFACE_HPP
19
20
#include <functional>
21
22
namespace
dnnl
{
23
27
struct
threadpool_iface
{
29
virtual
int
get_num_threads
()
const
= 0;
30
32
virtual
bool
get_in_parallel
()
const
= 0;
33
38
virtual
void
parallel_for
(
int
n,
const
std::function<
void
(
int
,
int
)> &fn)
39
= 0;
40
42
virtual
uint64_t
get_flags
()
const
= 0;
43
46
static
constexpr
uint64_t
ASYNCHRONOUS
= 1;
47
48
virtual
~threadpool_iface
() {}
49
};
50
51
}
// namespace dnnl
52
53
#endif
dnnl
oneDNN namespace
Definition
dnnl.hpp:81
dnnl::threadpool_iface
Abstract threadpool interface.
Definition
dnnl_threadpool_iface.hpp:27
dnnl::threadpool_iface::ASYNCHRONOUS
static constexpr uint64_t ASYNCHRONOUS
If set, parallel_for() returns immediately and oneDNN needs implement waiting for the submitted closu...
Definition
dnnl_threadpool_iface.hpp:46
dnnl::threadpool_iface::get_num_threads
virtual int get_num_threads() const =0
Returns the number of worker threads.
dnnl::threadpool_iface::get_in_parallel
virtual bool get_in_parallel() const =0
Returns true if the calling thread belongs to this threadpool.
dnnl::threadpool_iface::parallel_for
virtual void parallel_for(int n, const std::function< void(int, int)> &fn)=0
Submits n instances of a closure for execution in parallel:
dnnl::threadpool_iface::get_flags
virtual uint64_t get_flags() const =0
Returns threadpool behavior flags bit mask (see below).