1/*******************************************************************************
2* Copyright 2022 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#include "oneapi/dnnl/dnnl_config.h"
18
19#if DNNL_CPU_THREADING_RUNTIME == DNNL_RUNTIME_THREADPOOL
20
21#include "oneapi/dnnl/dnnl_threadpool.h"
22
23#include "c_types_map.hpp"
24#include "dnnl_thread.hpp"
25#include "utils.hpp"
26
27dnnl_status_t dnnl_threadpool_interop_set_max_concurrency(int max_concurrency) {
28 using namespace dnnl::impl;
29 threadpool_utils::get_threadlocal_max_concurrency() = max_concurrency;
30 return status::success;
31}
32
33dnnl_status_t dnnl_threadpool_interop_get_max_concurrency(
34 int *max_concurrency) {
35 using namespace dnnl::impl;
36 if (max_concurrency == nullptr) return status::invalid_arguments;
37
38 *max_concurrency = threadpool_utils::get_threadlocal_max_concurrency();
39 return status::success;
40}
41
42#endif
43