Caffe2 - C++ API
A deep learning, cross platform ML framework
pthreadpool.h
1 
17 // pthreadpool header from https://github.com/Maratyszcza/pthreadpool
18 // for NNPACK
19 #ifndef CAFFE2_UTILS_PTHREADPOOL_H_
20 #define CAFFE2_UTILS_PTHREADPOOL_H_
21 
22 #include "ThreadPoolCommon.h"
23 
24 
25 #include <stddef.h> // for size_t
26 
27 typedef struct pthreadpool* pthreadpool_t;
28 
29 typedef void (*pthreadpool_function_1d_t)(void*, size_t);
30 typedef void (*pthreadpool_function_1d_tiled_t)(void*, size_t, size_t);
31 typedef void (*pthreadpool_function_2d_t)(void*, size_t, size_t);
32 typedef void (*pthreadpool_function_2d_tiled_t)(void*, size_t, size_t, size_t, size_t);
33 typedef void (*pthreadpool_function_3d_t)(void*, size_t, size_t, size_t);
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
49 pthreadpool_t pthreadpool_create(size_t threads_count);
50 
58 size_t pthreadpool_get_threads_count(pthreadpool_t threadpool);
59 
60 
76 void pthreadpool_compute_1d(
77  pthreadpool_t threadpool,
78  pthreadpool_function_1d_t function,
79  void* argument,
80  size_t range);
81 
82 void pthreadpool_compute_1d_tiled(
83  pthreadpool_t threadpool,
84  pthreadpool_function_1d_tiled_t function,
85  void* argument,
86  size_t range,
87  size_t tile);
88 
89 void pthreadpool_compute_2d(
90  pthreadpool_t threadpool,
91  pthreadpool_function_2d_t function,
92  void* argument,
93  size_t range_i,
94  size_t range_j);
95 
96 void pthreadpool_compute_2d_tiled(
97  pthreadpool_t threadpool,
98  pthreadpool_function_2d_tiled_t function,
99  void* argument,
100  size_t range_i,
101  size_t range_j,
102  size_t tile_i,
103  size_t tile_j);
104 
113 void pthreadpool_destroy(pthreadpool_t threadpool);
114 
115 #ifdef __cplusplus
116 } /* extern "C" */
117 #endif
118 
119 #endif // CAFFE2_UTILS_PTHREADPOOL_H_