HPC MPI Exercise 1: Generating a Hosts File for MPI

Once you can launch processes to a Gold or Maroon lab workstation without having to enter a password, your next task is to create your own personal file of randomly-ordered workstation names. We will tell MPI to use the hosts in this file to launch your processes, so if the order of the hosts in everyone's file is randomized, that should spread the processes out "evenly" among the lab machines.

Creating A Hosts File

To make this easy, download this Perl script 'genHosts.pl'. You will need to run this script frequently, so save it somewhere convenient. You will need to change the file's permissions to allow execution:

   chmod +x genHosts.pl

Then run it and redirect its output to a file (e.g., hosts):

   ./genHosts.pl > hosts
This will generate a randomized list of all the ulab machines that are currently booted and running Linux.

Note that if other students enter the lab and boot a workstation into Windows, or shut a workstation down, that workstation will no longer be running Linux, so you will need to re-run your script to generate a new hosts file.

We will tell MPI to launch processes on remote workstations in the order they are listed in this hosts file, so you may want to ensure that the workstation on which you are currently working occurs first in this file. (Or feel free to alter the script so that it does this automatically.)

Once you can launch remote processes on the ulab machines without entering a password and have your own "randomized" personal machines file, your are ready to complete today's hands-on lab exercise.

CS > 374 > Exercises > 01 > Creating a Hosts File

This page maintained by Joel Adams.