MPI工具¶
核心MPI工具¶
-
spinup.utils.mpi_tools.
mpi_fork
(n, bind_to_core=False)[源代码]¶ Re-launches the current script with workers linked by MPI.
Also, terminates the original process that launched it.
Taken almost without modification from the Baselines function of the same name.
参数: - n (int) – Number of process to split into.
- bind_to_core (bool) – Bind each MPI process to a core.
-
spinup.utils.mpi_tools.
mpi_statistics_scalar
(x, with_min_and_max=False)[源代码]¶ Get mean/std and optional min/max of scalar x across MPI processes.
参数: - x – An array containing samples of the scalar to produce statistics for.
- with_min_and_max (bool) – If true, return min and max of x in addition to mean and std.
MPI + Tensorflow 工具¶
spinup.utils.mpi_tf
包含一些工具,可以轻松地在许多MPI流程中使用AdamOptimizer。
这有点极客──如果你正在寻找更复杂和通用的东西,请考虑 horovod。
-
class
spinup.utils.mpi_tf.
MpiAdamOptimizer
(**kwargs)[源代码]¶ Adam optimizer that averages gradients across MPI processes.
The compute_gradients method is taken from Baselines MpiAdamOptimizer. For documentation on method arguments, see the Tensorflow docs page for the base AdamOptimizer.