code: def UQ(start, end, lower, upper):
      # from pyina.launchers import Mpi as Pool
      from pathos.pools import ProcessPool as Pool
  
      # from pool_helper import func_pickle  # if fails to pickle, try using a helper
  
      # run optimizer for each subdiameter
      lb = [lower + [lower[i]] for i in range(start, end + 1)]
      ub = [upper + [upper[i]] for i in range(start, end + 1)]
      nb = [nbins[:] for i in range(start, end + 1)]
      for i in range(len(nb)):
          nb[i][-1] = nb[i][i]
      cf = [costFactory(i) for i in range(start, end + 1)]
      # cf = [func_pickle(i)     for i in cf]
      # cn = [cost.name          for cost in cf]
      nnodes = len(lb)
  
      # construct cost function and run optimizer
      results = Pool(nnodes).map(optimize, cf, lb, ub, nb)
      # print("results = %s" % results)
  
      results = list(zip(*results))
      diameters = list(results[0])
      function_evaluations = list(results[1])
  
      total_func_evals = sum(function_evaluations)
      total_diameter = sum(diameters)
  
      print("subdiameters (squared): %s" % diameters)
      print("diameter (squared): %s" % total_diameter)
      print(
          "func_evals: %s => %s"
          % (function_evaluations, total_func_evals)
      )
  
      return total_diameter
  
imports: from surrogate import ballistic_limit
label_desc: Use image node_id 3 for calling a global function with example usage: UQ(start, end, lower, upper) and returns: total_diameter