Add function to set inter-op thread pool size in cluster after initialization of session-specific threadpools

PiperOrigin-RevId: 205146586
This commit is contained in:
A. Unique TensorFlower 2018-07-18 15:21:35 -07:00 committed by TensorFlower Gardener
parent 6619dd5fdc
commit 7d79c72ba0
2 changed files with 11 additions and 0 deletions
tensorflow/core/grappler/clusters

View File

@ -29,6 +29,14 @@ void Cluster::AllowSoftPlacement(bool soft_placement_state) {
options_.config.set_allow_soft_placement(soft_placement_state);
}
void Cluster::SetNumInterOpThreads(int num_threads) {
for (int i = 0; i < options_.config.session_inter_op_thread_pool_size();
++i) {
options_.config.mutable_session_inter_op_thread_pool(i)->set_num_threads(
num_threads);
}
}
void Cluster::SetNumWarmupSteps(int num_steps) {
options_.config.mutable_graph_options()->set_build_cost_model_after(
num_steps);

View File

@ -65,6 +65,9 @@ class Cluster {
// with reftype input(s) which are from CPU.
void AllowSoftPlacement(bool soft_placement_state);
// Update the number of inter-op threads for each per-session threadpool
void SetNumInterOpThreads(int num_threads);
// Set the number of steps required to warmup TensorFlow. Must be called
// before Provision().
void SetNumWarmupSteps(int num_steps);