CS87, Week 2 Thurs Lab

Resources for Running Lab 1 Experiments

I'm going to show you some tools that may be useful for running Lab 1 experiments.

Look at the Useful Utilities and Resources part of the Lab 01 page for links to more information about some of these.

Also, my Help Pages documentation has information about useful tools and utilities.

Machine Specs page from the "cs lap help" link off the main cs page, list specs for all the CS mahines. Sort the Machines Table by #ofCores to find 8 and 16 core machines.

You should run timed runs of different experiments, and multiple instances of each experiment. Present results as the average over runs, and note standard deviations. See the Lab 1 assigment for more details.

Here are some measures that you may want to use to present results:

Example of using some tools for running experiments

Example Code to try out

Here is some example code you can try out with these tools (cd into this directory or just grab a copy):
cp -r ~newhall/public/cs87/experiment_tools .

see if a machine is idle

See the lab 1 page, but run who to see who is logged in, and top -H to see what is running on a machine are good ways to guess if it is available for you to use. Let top run for a minute or so to be certain it is idle.


Useful for logining in, starting something running in a screen session, and then loging out (what you are running in the screen session stays running).
  1. login and run screen to start a screen session:
  2. start what you plan to run in this session. I suggest running a bash script of experiements inside a script session (details below).
  3. detach from the screen session:
    Cntl-A  d  
  4. then logout of the computer if you'd like
To reattach to a screen session:
  1. login to the computer
  2. run
     screen -r
You can detach from the screen session as above if your experiments are still running.

script and dos2unix

script captures a terminal session to a file. dos2unix cleans up the resulting file after quit script. See more details here: script and dos2unix

Python is a nice language to use to process the resulting typescript file to pull out timing results for related runs, compute average, std dev, spit out results in a nice form.

bash script

Write a bash script to fire off a bunch of experiments. Then just run the bash script and come back later when done. Its good to have some echo commands in your bash script to print out some information about particular runs: this will help with your post-processing scripts to find timing results and compute averages and std dev. With the lab01 starting point code was one example bash script, try that out to see what it does. I also have links to bash programming off my help pages: bash

When you create a bash script, make sure the file is executable to run it:

vim runexper.sh  # or emacs 
chmod 777 runexper.sh  # set to executable 
ls -l
Also, try running your bash script a few times before starting it up in screen and coming back later: make sure it is doing what you think it is. You can always comment out the call to gol program in the script to see if it is doing what you want (# is the bash single line comment):

for((n=256; n <= 2049; n=n*2))
for ((t=1; t <= 32; t=t*2))
     echo ""
     echo "gol -t $t -n $n -m $n  -k 1000"
#    time ./gol -t $t -n $n -m $n  -k 1000 -x
If I run the above bash script I'll see all the calls to echo print out parameter configs and see if they are what I expect. Then uncomment and run.

In your bash script make sure you run time ./gol ... to collect runtimes.

Let's try all these steps together in the example you copied over.


  1. ssh into a machine, see if idle
  2. start screen
  3. cd to directory containing gol and bash script
  4. start script
  5. start bash script to run experiments
  6. hit return and type exit (to terminate script...good practice)
  7. detach from script
  8. run top -H just to see if program is running
  9. log out of machine
Then later, ssh back in the machine and re-attach to screen session.