Example #1
0
def _InstallAndAuthenticateVm(vm):
  """Install SHOC, ensure correct GPU state, and authenticate the VM for ssh.

  Args:
    vm: vm to operate on.
  """
  vm.Install('shoc_benchmark_suite')
  nvidia_driver.SetAndConfirmGpuClocks(vm)
  vm.AuthenticateVm()  # Configure ssh between vms for MPI
def _PrepareHpcg(vm):
  """Install HPCG on a single vm.

  Args:
    vm: vm to operate on
  """
  logging.info('Installing HPCG on %s', vm)
  vm.Install('hpcg')
  vm.AuthenticateVm()
  nvidia_driver.SetAndConfirmGpuClocks(vm)
def Run(benchmark_spec):
    """Sets the GPU clock speed and runs the CUDA PCIe benchmark.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
        required to run the benchmark.

  Returns:
    A list of sample.Sample objects.
  """
    vm = benchmark_spec.vms[0]
    # Note:  The clock speed is set in this function rather than Prepare()
    # so that the user can perform multiple runs with a specified
    # clock speed without having to re-prepare the VM.
    nvidia_driver.SetAndConfirmGpuClocks(vm)
    num_iterations = FLAGS.gpu_pcie_bandwidth_iterations
    mode = FLAGS.gpu_pcie_bandwidth_mode
    transfer_size_range = FLAGS.gpu_pcie_bandwidth_transfer_sizes
    raw_results = []
    metadata = {}
    metadata.update(cuda_toolkit.GetMetadata(vm))
    metadata['num_iterations'] = num_iterations
    metadata['mode'] = mode
    if mode == 'range':
        metadata['range_start'] = transfer_size_range[0]
        metadata['range_stop'] = transfer_size_range[1]
        metadata['range_step'] = transfer_size_range[2]

    run_command = ('%s/extras/demo_suite/bandwidthTest --device=all' %
                   metadata['cuda_toolkit_home'])
    if mode == 'range':
        run_command += (
            ' --mode=range --start={0} --end={1} --increment={2}'.format(
                transfer_size_range[0], transfer_size_range[1],
                transfer_size_range[2]))

    for i in range(num_iterations):
        stdout, _ = vm.RemoteCommand(run_command, should_log=True)
        raw_results.append(_ParseOutputFromSingleIteration(stdout))
        if 'device_info' not in metadata:
            metadata['device_info'] = _ParseDeviceInfo(stdout)
    return _CalculateMetricsOverAllIterations(raw_results, metadata)