Commit e8e84fa0 by Yida Wang Committed by Tianqi Chen

make ThreadPool thread local (#1152)

* make ThreadPool thread local

* add return
parent d454f570
...@@ -291,9 +291,8 @@ class ThreadPool { ...@@ -291,9 +291,8 @@ class ThreadPool {
return res; return res;
} }
static ThreadPool* Global() { static ThreadPool* ThreadLocal() {
static ThreadPool inst; return dmlc::ThreadLocalStore<ThreadPool>::Get();
return &inst;
} }
private: private:
...@@ -331,7 +330,7 @@ int TVMBackendParallelLaunch( ...@@ -331,7 +330,7 @@ int TVMBackendParallelLaunch(
FTVMParallelLambda flambda, FTVMParallelLambda flambda,
void* cdata, void* cdata,
int num_task) { int num_task) {
int res = tvm::runtime::ThreadPool::Global()->Launch( int res = tvm::runtime::ThreadPool::ThreadLocal()->Launch(
flambda, cdata, num_task, 1); flambda, cdata, num_task, 1);
return res; return res;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment