code: def run():
      from mpi4py import MPI
  
      comm = MPI.COMM_WORLD
      nprocs = comm.Get_size()
      myrank = comm.Get_rank()
  
      if myrank == 0:
          numpy.random.seed(1)
          N = 100000 // nprocs
          samples = numpy.random.random((nprocs, N, 2))
      else:
          samples = None
  
      samples = comm.scatter(samples, root=0)
  
      mypi = compute_pi(samples) / nprocs
  
      pi = comm.reduce(mypi, root=0)
  
      if myrank == 0:
          return pi
  
file_path: ray/python/ray/tests/test_mpi.py
imports: import pytest
  import ray
  import sys
  import os
  import numpy
  from ray.runtime_env import mpi_init
label_desc: Use image node_id 3 for calling a global function with example usage: run() and returns: pi