code: def test_timings(self):
      for n in range(2, workspace.NumGpuDevices()):
          for in_place in [False, True]:
              xs = [
                  np.random.randn(1e7).astype(np.float32)
                  for i in range(n)
              ]
              inputs = [str("x_{}".format(i)) for i in range(n)]
              prefix = "" if in_place else "o"
              outputs = [
                  str("{}x_{}".format(prefix, i)) for i in range(n)
              ]
  
              net = core.Net("test")
              net.NCCLAllreduce(inputs, outputs)
              net.RunAllOnGPU()
              for i in range(n):
                  self.ws.create_blob(inputs[i]).feed(
                      xs[i], gpu_device(i)
                  )
              self.ws.run(net)
              net_time = benchmark(self.ws, net)
              vanilla = core.Net("vanilla")
              muji.Allreduce(vanilla, inputs)
              vanilla_time = benchmark(self.ws, vanilla)
              print(
                  "Speedup for NCCL: {:.2f}".format(
                      vanilla_time / net_time
                  )
              )
  
file_path: pytorch/caffe2/contrib/nccl/nccl_ops_test.py
imports: import unittest
  import hypothesis.strategies
  from hypothesis import given, assume
  import numpy
  import time
  import os
  from caffe2.proto import caffe2_pb2
  from caffe2.python import core, workspace, muji, dyndep
  import caffe2.python.hypothesis_test_util
label_desc: Use image node_id 7 for calling the NCCLOpsTest obj's underlying member method code with example usage: obj.test_timings() without return types