oneflow.env

Environment

oneflow.env.get_world_size()

Returns the number of processes in the current process group.

Returns

The world size of the process group.

oneflow.env.get_rank()

Returns the rank of current process group. Rank is globally unique, range of which is [0, world_size).

Returns

The rank of the process group.

oneflow.env.get_local_rank()

Returns the local rank of current machine. Local rank is not globally unique. It is only unique per process on a machine.

Returns

The the local rank of process on current machine.

oneflow.env.get_node_size()

Returns the number of machines in the current process group.

Returns

The the number of machines in the process group.

oneflow.env.init_rdma()

Init RDMA in the current envirment. If the current envirment support RDMA, turning on RDMA by calling oneflow.env.init_rdma() can speed up data transfer.

Note

  • Make sure to avoid using fork() after oneflow.env.init_rdma() is invoked. Otherwise, data corruption or segmentation fault may result!

  • Requires all devices to execute oneflow.env.init_rdma() simultaneously. Otherwise, deadlock may result!

oneflow.env.rdma_is_initialized()

Returns whether RDMA is initialized in the current envirment or not.

Returns

Whether RDMA is initialized or not.