| 48 | } |
| 49 | |
| 50 | RenamedDevice::RenamedDevice(Device* underlying, |
| 51 | const DeviceAttributes& attributes, |
| 52 | bool owns_underlying_device, |
| 53 | bool isolate_session_state, |
| 54 | thread::ThreadPoolInterface* underlying_threadpool) |
| 55 | : Device(underlying->env(), attributes), |
| 56 | underlying_device_(underlying), |
| 57 | owns_underlying_device_(owns_underlying_device), |
| 58 | isolate_session_state_(isolate_session_state) { |
| 59 | if (underlying_threadpool != nullptr) { |
| 60 | underlying_threadpool_.reset(new thread::ThreadPool(underlying_threadpool)); |
| 61 | eigen_worker_threads_.workers = underlying_threadpool_.get(); |
| 62 | eigen_worker_threads_.num_threads = underlying_threadpool->NumThreads(); |
| 63 | set_tensorflow_cpu_worker_threads(&eigen_worker_threads_); |
| 64 | set_tensorflow_device_thread_pool(underlying_threadpool_.get()); |
| 65 | |
| 66 | Eigen::ThreadPoolDevice eigen_threadpool_device( |
| 67 | underlying_threadpool, underlying_threadpool->NumThreads()); |
| 68 | set_eigen_cpu_device(&eigen_threadpool_device); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | RenamedDevice::~RenamedDevice() { |
| 73 | if (owns_underlying_device_) { |
nothing calls this directly
no test coverage detected