def _CreateIntelMpiRunCommand(vms: List[linux_vm.BaseLinuxVirtualMachine], dimensions: HpccDimensions) -> Tuple[str, int]: """Creates the command to run HPL for Intel compiled linpack. Args: vms: List of virtual machines to run on. dimensions: The HpccDimensions for the run Returns: Tuple of the mpirun command and the number of processes to be used. """ headnode = vms[0] # Create the file for mpirun to execute hpl_path = '/opt/intel/mkl/benchmarks/mp_linpack/xhpl_intel64_static' bash_script = inspect.cleandoc(f''' #!/bin/bash export HPL_HOST_NODE=$((PMI_RANK % {headnode.numa_node_count})) {hpl_path} ''') run_file = './hpl_run' for vm in vms: vm_util.CreateRemoteFile(vm, bash_script + '\n', run_file) vm.RemoteCommand(f'chmod +x {run_file}') logging.info('Using precompiled HPL at %s', hpl_path) num_processes = dimensions.num_rows * dimensions.num_columns hosts = ','.join([vm.internal_ip for vm in vms]) mpi_cmd = (f'{intelmpi.SourceMpiVarsCommand(headnode)}; ' 'mpirun ' f'-perhost {headnode.numa_node_count} {_MpiEnv("-genv")} ' f'-np {num_processes} -host {hosts} {run_file}') return mpi_cmd, num_processes
def _ConfigureSpec(prime_client, clients, benchmark, load=None, num_runs=None, incr_load=None): """Configures SPEC SFS 2014 on the prime client. This function modifies the default configuration file (sfs_rc) which can be found either in the SPEC SFS 2014 user guide or within the iso. It also creates a file containing the client mountpoints so that SPEC can run in a distributed manner. Args: prime_client: The VM from which SPEC will be controlled. clients: A list of SPEC client VMs (including the prime_client). benchmark: The sub-benchmark to run. load: List of ints. The LOAD parameter to SPECSFS. num_runs: The NUM_RUNS parameter to SPECSFS. incr_load: The INCR_LOAD parameter to SPECSFS. """ config_path = posixpath.join(_SPEC_DIR, _SPEC_CONFIG) prime_client.RemoteCommand('sudo cp {0}.bak {0}'.format(config_path)) stdout, _ = prime_client.RemoteCommand('pwd') exec_path = posixpath.join(stdout.strip(), _SPEC_DIR, 'binaries', 'linux', 'x86_64', 'netmist') load = load or FLAGS.specsfs2014_load num_runs = num_runs or FLAGS.specsfs2014_num_runs incr_load = incr_load or FLAGS.specsfs2014_incr_load configuration_overrides = { 'USER': prime_client.user_name, 'EXEC_PATH': exec_path.replace('/', r'\/'), 'CLIENT_MOUNTPOINTS': _MOUNTPOINTS_FILE, 'BENCHMARK': benchmark, 'LOAD': ' '.join([str(x) for x in load]), 'NUM_RUNS': num_runs, 'INCR_LOAD': incr_load, 'WARMUP_TIME': 60, } # Any special characters in the overrides dictionary should be escaped so # that they don't interfere with sed. sed_expressions = ' '.join([ '-e "s/{0}=.*/{0}={1}/"'.format(k, v) for k, v in six.iteritems(configuration_overrides) ]) sed_cmd = 'sudo sed -i {0} {1}'.format(sed_expressions, config_path) prime_client.RemoteCommand(sed_cmd) mount_points = [ f'{client.internal_ip} {_MOUNT_POINT}' for client in clients ] vm_util.CreateRemoteFile(prime_client, '\n'.join(mount_points), posixpath.join(_SPEC_DIR, _MOUNTPOINTS_FILE))
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}')