code: def testCreateLocalCluster(self):
      workers, _ = test.create_local_cluster(num_workers=2, num_ps=2)
      worker_sessions = [session_lib.Session(w.target) for w in workers]
      with ops.device("/job:ps/task:0"):
          var0 = variables.Variable(0.0)
      with ops.device("/job:ps/task:1"):
          var1 = variables.Variable(1.0)
      worker_sessions[0].run([var0.initializer, var1.initializer])
      with ops.device("/job:ps/task:0"):
          var2 = variables.Variable(2.0)
      with ops.device("/job:ps/task:1"):
          var3 = variables.Variable(3.0)
      worker_sessions[1].run([var2.initializer, var3.initializer])
  
      # Read values back in the opposite session
      self.assertAllEqual(0.0, var0.eval(session=worker_sessions[1]))
      self.assertAllEqual(1.0, var1.eval(session=worker_sessions[1]))
      self.assertAllEqual(2.0, var2.eval(session=worker_sessions[0]))
      self.assertAllEqual(3.0, var3.eval(session=worker_sessions[0]))
  
file_path: tensorflow-upstream/tensorflow/python/training/localhost_cluster_performance_test.py
imports: import time
  import numpy
  from tensorflow.python.client import session
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import partitioned_variables
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
  from tensorflow.python.training import device_setter
label_desc: Use image node_id 1 for calling the CreateLocalClusterTest obj's underlying member method code with example usage: obj.testCreateLocalCluster() without return types