From 76308e7fd277ad962a87724040670da827a27db4 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Fri, 3 Jun 2016 16:28:58 -0700 Subject: Add CurrentThreadId and NumThreads methods to Eigen threadpools and TensorDeviceThreadPool. --- unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h index d31b0ad38..90fded8ad 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h @@ -172,6 +172,10 @@ struct ThreadPoolDevice { pool_->Schedule(func); } + EIGEN_STRONG_INLINE size_t currentThreadId() const { + return pool_->CurrentThreadId(); + } + // parallelFor executes f with [0, n) arguments in parallel and waits for // completion. F accepts a half-open interval [first, last). // Block size is choosen based on the iteration cost and resulting parallel -- cgit v1.2.3