def Prepare(bm_spec: benchmark_spec.BenchmarkSpec) -> None:
    """Installs omb on the VM.

  Args:
    bm_spec: The benchmark specification. Contains all data that is required to
      run the benchmark.
  """
    vms = bm_spec.vms
    vms[0].Install('omb')
    omb.PrepareWorkers(vms)
  def testPrepareWorkers(self):
    # to export /usr/.../osu-microbenchmarks
    mock_nfs_osu = self.enter_context(
        mock.patch.object(nfs_service, 'NfsExportAndMount'))
    mpi_dir = '/usr/local/libexec/osu-micro-benchmarks/mpi'
    vm = mock.Mock(internal_ip='10.0.0.1')
    vm.RemoteCommand.side_effect = [(f'{mpi_dir}/startup/osu_hello', '')]
    vm.RobustRemoteCommand.side_effect = [('Hello World', '')]
    vms = [vm, mock.Mock(internal_ip='10.0.0.2')]

    omb.PrepareWorkers(vms)

    mock_nfs_osu.assert_called_with(vms, mpi_dir)
    vm.Install.assert_called_with('openmpi')
    vm.RemoteCommand.assert_called_with(f'ls {mpi_dir}/*/osu_hello')
    vm.RobustRemoteCommand.assert_called_with(
        'mpirun -report-bindings -display-map -n 2 -npernode 1 '
        '--use-hwthread-cpus -host 10.0.0.1:slots=2,10.0.0.2:slots=2 '
        f'{mpi_dir}/startup/osu_hello')
  def testPrepareWorkers(self):
    # to export /opt/intel
    mock_nfs_opt_intel = self.enter_context(
        mock.patch.object(intelmpi, 'NfsExportIntelDirectory'))
    # to export /usr/.../osu-microbenchmarks
    mock_nfs_osu = self.enter_context(
        mock.patch.object(nfs_service, 'NfsExportAndMount'))
    mpi_dir = '/usr/local/libexec/osu-micro-benchmarks/mpi'
    vm = mock.Mock(internal_ip='10.0.0.1')
    vm.RemoteCommand.side_effect = [(f'{mpi_dir}/startup/osu_hello', '')]
    vm.RobustRemoteCommand.side_effect = [('Hello World', '')]
    vms = [vm, mock.Mock(internal_ip='10.0.0.2')]

    omb.PrepareWorkers(vms)

    mock_nfs_opt_intel.assert_called_with(vms)
    mock_nfs_osu.assert_called_with(vms, mpi_dir)
    vm.RemoteCommand.assert_called_with(f'ls {mpi_dir}/*/osu_hello')
    vm.RobustRemoteCommand.assert_called_with(
        '. mpivars.sh; mpirun -perhost 1 -n 2 '
        f'-hosts 10.0.0.1,10.0.0.2 {mpi_dir}/startup/osu_hello')