def _PrepareBinaries(headnode_vm: linux_vm.BaseLinuxVirtualMachine,
                     vm: linux_vm.BaseLinuxVirtualMachine) -> None:
    """Prepares the binaries on the vm."""
    vm.Install('fortran')
    headnode_vm.MoveFile(vm, 'hpcc', 'hpcc')
    headnode_vm.MoveFile(vm, '/usr/bin/orted', 'orted')
    vm.RemoteCommand('sudo mv orted /usr/bin/orted')
    if FLAGS.hpcc_math_library == hpcc.HPCC_MATH_LIBRARY_MKL:
        intel_repo.CopyIntelFiles(headnode_vm, vm)
def CreateHpccinf(vm: linux_vm.BaseLinuxVirtualMachine,
                  benchmark_spec: bm_spec.BenchmarkSpec) -> HpccDimensions:
    """Creates the HPCC input file."""
    dimensions = _CalculateHpccDimensions(len(benchmark_spec.vms),
                                          vm.NumCpusForBenchmark(),
                                          vm.total_free_memory_kb)
    vm.RemoteCommand(f'rm -f {HPCCINF_FILE}')
    vm.RenderTemplate(data.ResourcePath(LOCAL_HPCCINF_FILE),
                      remote_path=HPCCINF_FILE,
                      context=dataclasses.asdict(dimensions))
    return dimensions
def _CreateHpccWrapper(vm: linux_vm.BaseLinuxVirtualMachine) -> None:
    """Creates a bash script to run HPCC on the VM.

  This is required for when MKL is installed via the Intel repos as the
  libiomp5.so file is not in /lib but rather in one found via sourcing the
  mklvars.sh file.

  Args:
    vm: Virtual machine to put file on.
  """
    text = ['#!/bin/bash', mkl.SourceVarsCommand(), './hpcc']
    vm_util.CreateRemoteFile(vm, '\n'.join(text), HPCC_WRAPPER)
    vm.RemoteCommand(f'chmod +x {HPCC_WRAPPER}')