code: def test_parallel_random_seed_setting_for_context():
      seed_to_test = 1234
      dev_type = mx.context.current_context().device_type
      for dtype in ["float16", "float32", "float64"]:
          samples_imp = []
          samples_sym = []
          # Collect random number samples from the generators of all devices, each seeded with the same number.
          for dev_id in range(
              0, mx.device.num_gpus() if dev_type == "gpu" else 1
          ):
              with mx.Context(dev_type, dev_id):
                  ctx = mx.context.current_context()
                  # Avoid excessive test cpu runtimes.
                  num_temp_seeds = 25 if dev_type == "gpu" else 1
                  # To flush out a possible race condition, run multiple times.
                  for _ in range(20):
                      # Create enough samples such that we get a meaningful distribution.
                      shape = (200, 200)
                      params = {"low": -1.5, "high": 3.0}
                      params.update(shape=shape, dtype=dtype)
  
                      # Check imperative. `uniform` uses parallel rng.
                      seed = set_seed_variously_for_context(
                          ctx, 1, num_temp_seeds, seed_to_test
                      )
                      rnds = mx.nd.random.uniform(**params)
                      samples_imp.append(rnds.asnumpy())
  
                      # Check symbolic. `uniform` uses parallel rng.
                      X = mx.sym.Variable("X")
                      Y = mx.sym.random.uniform(**params) + X
                      x = mx.nd.zeros(shape, dtype=dtype)
                      xgrad = mx.nd.zeros(shape, dtype=dtype)
                      yexec = Y._bind(ctx, {"X": x}, {"X": xgrad})
                      set_seed_variously_for_context(
                          ctx, seed, num_temp_seeds, seed_to_test
                      )
                      yexec.forward(is_train=True)
                      yexec.backward(yexec.outputs[0])
                      samples_sym.append(yexec.outputs[0].asnumpy())
          # The samples should be identical across different gpu devices.
          for i in range(1, len(samples_imp)):
              assert same(samples_imp[i - 1], samples_imp[i])
          for i in range(1, len(samples_sym)):
              assert same(samples_sym[i - 1], samples_sym[i])
  
imports: import os
  import math
  import itertools
  import mxnet
  from mxnet.test_utils import verify_generator, gen_buckets_probs_with_ppf, assert_almost_equal
  import numpy
  import random
  from common import retry, random_seed
  import scipy.stats
  import unittest
  import pytest
  from mxnet.test_utils import *
  from mxnet.base import MXNetError
  from common import assertRaises
label_desc: Use image node_id 10 for calling a global function with example usage: test_parallel_random_seed_setting_for_context() without return types