Cooperative Computing Lab
CCL Home Software Community Operations

# Practice Problems for Work Queue

1. Problem 1: Write a Work Queue program to compute the maxima of a simulator.
2. Problem 2: Apply Work Queue in your research

# Problem 1

## Write a Work Queue program to compute the maxima of a simulator.

### Objectives

This problem will illustrate the following:

• Work Queue's support for the construction of large dynamic workflows.
• The execution model of Work Queue.

### Problem Statement

This problem involves a simulator that takes an integer as input (x), applies this input in a function (y=f(x)), and returns the evaluated value (y) as output.

The simulator for this problem is a Python executable. It can be downloaded using:

\$ wget http://www.nd.edu/~ccl/software/tutorials/proposed/wq/simulator.py

It can be executed by specifying an integer as a command-line input argument. For example, to run the simulator with an input of 10 and write the output value to a file named 10.output:

\$ python simulator.py 10 > 10.output

Write a Work Queue program that determines the maxima of this simulator. You will achieve this without any knowledge of the function (f(x)) implemented in the simulator. That is, you will only use the output values returned by the simulator for the given inputs to determine its maxima. Or in other words, you will treat the simulator as a black box.

### Hints

1. Determine the search space (values of x) that you want to explore (e.g., from -300 to 300). Also decide on the granularity at which you want to explore the search space (e.g., in increments of 20).
2. Select values from the search space with the chosen granularity to feed as inputs to the simulator. Create a Work Queue task to run the simulator with a given input value.
3. You can apply techniques similar to binary search to narrow down the search space and lower your search granularity as you gather outputs for the input values fed to the simulator.
4. When you have narrowed down your search space to a single value, you have found the maxima. Note that this maxima is valid only for the chosen search space. Therefore, to determine the global maxima, make sure to chose your search space and search granularity carefully.

For the given simulator, the value of the (global) maxima is given here.

# Problem 2

## Apply Work Queue in your research.

### Problem Statement

In completing the tutorial and Problem 1, you have mastered the fundamentals of transforming and running large dynamic worfklows as Work Queue programs!

Now, can you think of one or two instances in your research where you can apply Work Queue to run computation/simulation workflows?