RayLightningEnvironment#

class ray.train.lightning.RayLightningEnvironment(*args: Any, **kwargs: Any)[source]#

Bases: LightningEnvironment

Setup Lightning DDP training environment for Ray cluster.

PublicAPI (beta): This API is in beta and may change before becoming stable.

Methods

global_rank

Return this worker's rank across all workers.

local_rank

Return this worker's rank among the workers on its node.

node_rank

Return the rank of the node this worker runs on.

set_global_rank

Do nothing, because global_rank() reads the Ray Train context.

set_world_size

Do nothing, because world_size() reads the Ray Train context.

teardown

Do nothing, in place of the parent environment's teardown.

world_size

Return the number of workers in the training run.