mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
27 lines
719 B
C++
27 lines
719 B
C++
#include "caffe2/utils/threadpool/pthreadpool.h"
|
|
#include "caffe2/utils/threadpool/pthreadpool_impl.h"
|
|
#include "caffe2/utils/threadpool/ThreadPool.h"
|
|
|
|
#if CAFFE2_THREADPOOL_MOBILE
|
|
|
|
//
|
|
// External API
|
|
//
|
|
|
|
void pthreadpool_compute_1d(struct pthreadpool* threadpool,
|
|
pthreadpool_function_1d_t function,
|
|
void* argument,
|
|
size_t range) {
|
|
threadpool->pool_->run(
|
|
[function, argument](int threadId, size_t workId) {
|
|
function(argument, workId);
|
|
},
|
|
range);
|
|
}
|
|
|
|
size_t pthreadpool_get_threads_count(struct pthreadpool* threadpool) {
|
|
return threadpool->pool_->getNumThreads();
|
|
}
|
|
|
|
#endif // CAFFE2_THREADPOOL_MOBILE
|