parameters: (program, dist_context=None)
return_statement: return dist_attr
docstring: Get distributed attribute of current rank.
  
      Args:
          program(Program): main program for training
docstring_summary: Get distributed attribute of current rank.
docstring_tokens: Get distributed attribute of current rank .
function: def get_dist_attr(program, dist_context=None):
      """ 
      Get distributed attribute of current rank.
  
      Args:
          program(Program): main program for training
      """
      from .dist_context import get_default_distributed_context
  
      assert isinstance(program, paddle.fluid.framework.Program)
      if dist_context is None:
          dist_context = get_default_distributed_context()
      dist_attr = {}
      for var in program.list_vars():
          if is_parameter(var) or is_belong_to_optimizer(var):
              tensor_dist_attr = dist_context.get_tensor_dist_attr_for_program(
                  var)
              process_mesh = tensor_dist_attr.process_mesh
              dims_mapping = tensor_dist_attr.dims_mapping
              dist_attr[var.name] = {
                  "process_shape": process_mesh.topology,
                  "process_group": process_mesh.processes,
                  "dims_mapping": dims_mapping
              }
      return dist_attr
function_tokens: def get_dist_attr ( program , dist_context = None ) : from . dist_context import get_default_distributed_context assert isinstance ( program , paddle . fluid . framework . Program ) if dist_context is None : dist_context = get_default_distributed_context ( ) dist_attr = { } for var in program . list_vars ( ) : if is_parameter ( var ) or is_belong_to_optimizer ( var ) : tensor_dist_attr = dist_context . get_tensor_dist_attr_for_program ( var ) process_mesh = tensor_dist_attr . process_mesh dims_mapping = tensor_dist_attr . dims_mapping dist_attr [ var . name ] = { "process_shape" : process_mesh . topology , "process_group" : process_mesh . processes , "dims_mapping" : dims_mapping } return dist_attr