CCL | Software | Install | Manuals | Forum | Papers
CCL Home

Research

Software Community Operations

Makeflow Tutorial

Download and Installation

First log into india.futuregrid.org using ssh, putty, or a similar tool. Download and install the cctools software in your home directory as follows:
cd $HOME
wget http://ccl.cse.nd.edu/software/files/cctools-4.2.2-source.tar.gz
tar xvzf cctools-4.2.2-source.tar.gz
cd cctools-4.2.2-source
./configure --with-python-path /N/u/dthain/python-2.4.3 --with-readline-path /N/u/dthain/readline-6.3
make
make install
cd $HOME
If you use bash then do this to set your path:
export PATH=${PATH}:${HOME}/cctools/bin
If you use tcsh instead, then do this:
setenv PATH ${PATH}:${HOME}/cctools/bin
Now double check that you can run the various commands, like this:
makeflow -v
work_queue_worker -v
work_queue_status

Makeflow Example

Let's being by using Makeflow to run a handful of simulation codes. First, make and enter a clean directory to work in:
mkdir tutorial
cd tutorial
Now, download this program, which performs a highly sophisticated simulation of black holes colliding together:
wget http://ccl.cse.nd.edu/software/tutorials/acic14/simulation.py
Try running it once, just to see what it does:
chmod 755 simulation.py
./simulation.py 5
Now, let's use Makeflow to run several simulations. Create a file called example.makeflow and paste the following text into it:
input.txt:
	LOCAL /bin/echo "Hello Makeflow!" > input.txt

output.1: simulation.py input.txt
	./simulation.py 1 < input.txt > output.1

output.2: simulation.py input.txt
	./simulation.py 2 < input.txt > output.2

output.3: simulation.py input.txt
	./simulation.py 3 < input.txt > output.3

output.4: simulation.py input.txt
	./simulation.py 4 < input.txt > output.4
To run it on your local machine, one job at a time:
makeflow example.makeflow -J 1 
Note that if you run it a second time, nothing will happen, because all of the files are built:
makeflow example.makeflow
makeflow: nothing left to do
Use the -c option to clean everything up before trying it again:
makeflow -c example.makeflow
India uses the Torque batch system, so you can run the jobs through Torque like this:
makeflow -T torque example.makeflow
Or, if you have a Condor Pool, then you can direct Makeflow to run your jobs there:
makeflow -T condor example.makeflow

Running Makeflow with Work Queue

You will notice that a workflow can run very slowly if you submit each batch job to Torque, because it typically takes 30 seconds or so to start each batch job running. To get around this limitation, we provide the Work Queue system. This allows Makeflow to function as a master process that quickly dispatches work to remote worker processes.
makeflow -c example.makeflow
makeflow -T wq example.makeflow -p 0
listening for workers on port XXXX.
...
Now open up another shell and run a single worker process:
work_queue_worker localhost XXXX
Go back to your first shell and observe that the makeflow has finished. Of course, remembering port numbers all the time gets old fast, so try the same thing again, but using a project name:
makeflow -c example.makeflow
makeflow -T wq example.makeflow -N MYPROJECT
listening for workers on port XXXX
...
Now open up another shell and run your worker with a project name:
work_queue_worker -N MYPROJECT

Running Workers in Torque

Of course, we don't really want to run workers on the head node, so let's instead start five workers using Torque:
torque_submit_workers -N MYPROJECT 5
Creating worker submit scripts in dthain-workers...
2065026.i136
2065027.i136
2065028.i136
2065029.i136
2065030.i136

Use the qstat command to observe that they are submitted to Torque:
qstat
2065027.i136               worker.sh        dthain                 0 R batch
2065028.i136               worker.sh        dthain                 0 R batch
2065029.i136               worker.sh        dthain                 0 R batch 
2065030.i136               worker.sh        dthain                 0 R batch
Now, restart your Makeflow and it will use the workers already running in Torque:
makeflow -c example.makeflow
makeflow -T wq example.makeflow -N MYPROJECT
listening for workers on port XXXX.
...
You can leave the workers running there, if you want to start another Makeflow. They will remain until they have been idle for fifteen minutes, then will stop automatically.

If you add the -d all option to Makeflow, it will display debugging information that shows where each task was sent, when it was returned, and so forth:

makeflow -c example.makeflow
makeflow -T wq example.makeflow -N MYPROJECT -d all
listening for workers on port XXXX.

If you finish all that, then go on to the Homework Assignment.