tf.config.experimental.ClusterDeviceFilters
Represent a collection of device filters for the remote workers in cluster.
tf.config.experimental.ClusterDeviceFilters()
Note: this is an experimental API and subject to changes.
Set device filters for selective jobs and tasks. For each remote worker, the device filters are a list of strings. When any filters are present, the remote worker will ignore all devices which do not match any of its filters. Each filter can be partially specified, e.g. "/job:ps", "/job:worker/replica:3", etc. Note that a device is always visible to the worker it is located on.
For example, to set the device filters for a parameter server cluster:
cdf = tf.config.experimental.ClusterDeviceFilters() for i in range(num_workers): cdf.set_device_filters('worker', i, ['/job:ps']) for i in range(num_ps): cdf.set_device_filters('ps', i, ['/job:worker']) tf.config.experimental_connect_to_cluster(cluster_def, cluster_device_filters=cdf)
The device filters can be partically specified. For remote tasks that do not have device filters specified, all devices will be visible to them.
Methods
set_device_filters
set_device_filters( job_name, task_index, device_filters )
Set the device filters for given job name and task id.
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/config/experimental/ClusterDeviceFilters