parameters: (x, *, comm=MPI_py_comm)
return_statement: return ar
docstring: Computes the elementwise sum of an array or a scalar across all MPI processes.
      Attempts to perform this sum inplace if possible, but for some types a copy
      might be returned.
  
      Args:
          a: The input array, which will usually be overwritten in place.
      Returns:
          out: The reduced array.
docstring_summary: Computes the elementwise sum of an array or a scalar across all MPI processes.
      Attempts to perform this sum inplace if possible, but for some types a copy
      might be returned.
docstring_tokens: Computes the elementwise sum of an array or a scalar across all MPI processes . Attempts to perform this sum inplace if possible but for some types a copy might be returned .
function: def mpi_sum(x, *, comm=MPI_py_comm):
      """
      Computes the elementwise sum of an array or a scalar across all MPI processes.
      Attempts to perform this sum inplace if possible, but for some types a copy
      might be returned.
  
      Args:
          a: The input array, which will usually be overwritten in place.
      Returns:
          out: The reduced array.
      """
      ar = np.asarray(x)
  
      if n_nodes > 1:
          comm.Allreduce(MPI.IN_PLACE, ar.reshape(-1), op=MPI.SUM)
  
      return ar
function_tokens: def mpi_sum ( x , * , comm = MPI_py_comm ) : ar = np . asarray ( x ) if n_nodes > 1 : comm . Allreduce ( MPI . IN_PLACE , ar . reshape ( - 1 ) , op = MPI . SUM ) return ar