CrossDeviceOps 的分层副本all-reduce 实现。
继承自:CrossDeviceOps
用法
tf.distribute.HierarchicalCopyAllReduce(
num_packs=1
)
参数
-
num_packs
一个非负整数。要将值拆分成的包数。如果为零,则不进行打包。
抛出
-
如果
num_packs
为负,则出现 ValueError。
它在某些层次结构中沿边减少到一个 GPU,并沿同一路径广播回每个 GPU。对于批处理 API,张量将被重新打包或聚合以更有效地 cross-device 传输。
这是为 Nvidia DGX-1 创建的缩减,它假设 GPU 的连接方式与 DGX-1 机器上的连接方式相同。如果您有不同的 GPU inter-connections,它可能会比 tf.distribute.ReductionToOneDevice
慢。
对于不是 all-reduce 的归约,它回退到 tf.distribute.ReductionToOneDevice
。
以下是在 tf.distribute.MirroredStrategy
中使用 HierarchicalCopyAllReduce
的方法:
strategy = tf.distribute.MirroredStrategy(
cross_device_ops=tf.distribute.HierarchicalCopyAllReduce())
相关用法
- Python tf.distribute.OneDeviceStrategy.experimental_distribute_values_from_function用法及代码示例
- Python tf.distribute.TPUStrategy用法及代码示例
- Python tf.distribute.experimental_set_strategy用法及代码示例
- Python tf.distribute.experimental.MultiWorkerMirroredStrategy.gather用法及代码示例
- Python tf.distribute.cluster_resolver.TFConfigClusterResolver用法及代码示例
- Python tf.distribute.experimental.MultiWorkerMirroredStrategy用法及代码示例
- Python tf.distribute.TPUStrategy.experimental_assign_to_logical_device用法及代码示例
- Python tf.distribute.NcclAllReduce用法及代码示例
- Python tf.distribute.OneDeviceStrategy.experimental_distribute_dataset用法及代码示例
- Python tf.distribute.experimental.rpc.Server.create用法及代码示例
- Python tf.distribute.experimental.MultiWorkerMirroredStrategy.experimental_distribute_dataset用法及代码示例
- Python tf.distribute.OneDeviceStrategy.gather用法及代码示例
- Python tf.distribute.MirroredStrategy.reduce用法及代码示例
- Python tf.distribute.Strategy.scope用法及代码示例
- Python tf.distribute.TPUStrategy.reduce用法及代码示例
- Python tf.distribute.experimental.partitioners.Partitioner.__call__用法及代码示例
- Python tf.distribute.DistributedIterator.get_next用法及代码示例
- Python tf.distribute.Strategy.experimental_distribute_values_from_function用法及代码示例
- Python tf.distribute.get_strategy用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.distribute.HierarchicalCopyAllReduce。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。