diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-09-20 18:35:09 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-20 18:39:18 -0700 |
commit | f283f3ac5d7b6de8cadc9c1cee6886b187319afd (patch) | |
tree | ccb4315c049ef96fb4aaf11bb1bc743e97386ead /tensorflow/core/util | |
parent | 684b3e02e098cb6fda5569fb7f7990ff57248e5a (diff) |
Add an API which gives explicit control over shard sizes and introspection into the number of shards used. This is a variant of threadpool::parallelFor
PiperOrigin-RevId: 213920649
Diffstat (limited to 'tensorflow/core/util')
-rw-r--r-- | tensorflow/core/util/work_sharder.cc | 2 | ||||
-rw-r--r-- | tensorflow/core/util/work_sharder.h | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/tensorflow/core/util/work_sharder.cc b/tensorflow/core/util/work_sharder.cc index f4bd2950e9..74f0713a61 100644 --- a/tensorflow/core/util/work_sharder.cc +++ b/tensorflow/core/util/work_sharder.cc @@ -50,6 +50,8 @@ void Shard(int max_parallelism, thread::ThreadPool* workers, int64 total, max_parallelism); } +// DEPRECATED: Prefer threadpool->TransformRangeConcurrently, which allows you +// to directly specify the shard size. void Sharder::Do(int64 total, int64 cost_per_unit, const Work& work, const Runner& runner, int max_parallelism) { cost_per_unit = std::max(int64{1}, cost_per_unit); diff --git a/tensorflow/core/util/work_sharder.h b/tensorflow/core/util/work_sharder.h index b12c31c1ae..9db85a54c6 100644 --- a/tensorflow/core/util/work_sharder.h +++ b/tensorflow/core/util/work_sharder.h @@ -23,6 +23,9 @@ limitations under the License. namespace tensorflow { +// DEPRECATED: Prefer threadpool->TransformRangeConcurrently, which allows you +// to directly specify the shard size. Use this function only if you want to +// manually cap parallelism. // Shards the "total" unit of work assuming each unit of work having // roughly "cost_per_unit". Each unit of work is indexed 0, 1, ..., // total - 1. Each shard contains 1 or more units of work and the |