Update TheadPoolDevice example to include ThreadPool creation and passing pointer into constructor.

This commit is contained in:
Jonathon Koyle 2019-04-10 10:02:33 -06:00
parent 66a885b61e
commit 9a3f06d836

View File

@ -430,8 +430,11 @@ This is exactly the same as not inserting a `device()` call.
#### Evaluating with a Thread Pool #### Evaluating with a Thread Pool
// Create the Eigen ThreadPool
Eigen::ThreadPool pool(8 /* number of threads in pool */)
// Create the Eigen ThreadPoolDevice. // Create the Eigen ThreadPoolDevice.
Eigen::ThreadPoolDevice my_device(4 /* number of threads to use */); Eigen::ThreadPoolDevice my_device(&pool, 4 /* number of threads to use */);
// Now just use the device when evaluating expressions. // Now just use the device when evaluating expressions.
Eigen::Tensor<float, 2> c(30, 50); Eigen::Tensor<float, 2> c(30, 50);