Commit 27edd488 authored by Prasanna's avatar Prasanna
Browse files

readme update

parent 4af36d2f
......@@ -50,8 +50,61 @@ optional arguments:
Example
=======
```
mpiexec -np 2 python async-search.py --prob_dir=../benchmarks/qmcp --exp_dir=../experiments/ --exp_id=exp-01 --max_evals=10 --max_time=60
mpiexec -np 2 python async-search.py --prob_dir=../benchmarks/prob --exp_dir=../experiments/ --exp_id=exp-01 --max_evals=10 --max_time=60
```
How to define your own autotuning problem
=========================================
This will be illustrated with the example in /benchmarks/prob directory.
In this example, we want to tune the executable.py that gets four command line parameters and returns the output value
```
python executable.py --help
usage: executable.py [-h] [--p1 [P1]] [--p2 [P2]] [--p3 [P3]] [--p4 [P4]]
optional arguments:
-h, --help show this help message and exit
--p1 [P1] parameter p1 value
--p2 [P2] parameter p2 value
--p3 [P3] parameter p3 value
--p4 [P4] parameter p4 value
```
For example,
```
python executable.py --p1=2 --p2=2 --p3=4 --p4=a
OUTPUT:16.000
```
The search space and a default starting point is defined in problem.py
```
from collections import OrderedDict
class Problem():
def __init__(self):
space = OrderedDict()
#problem specific parameters
space['p1'] = (2, 10)
space['p2'] = (8, 1024)
space['p3'] = [2 , 4, 8, 16, 32, 64, 128]
space['p4'] = ['a', 'b', 'c']
self.space = space
self.params = self.space.keys()
self.starting_point = [2, 8, 2, 'c']
```
In evalaute.py, you have to define three functions.
First define how to construct the command line in
```
def commandLine(x, params)
```
Second define how to evalaute a point in
```
def evaluate(x, evalCounter, params, prob_dir, job_dir, result_dir):
```
Third define how to read the results in
```
def readResults(fname, evalnum):
```
Finally, in job.tmpl, call the executable
\ No newline at end of file
#!/bin/bash -x
#COBALT -n 1
#COBALT -q debug-flat-quad
#COBALT -A Performance
#COBALT -t 30
outputfile=$outputfile
ut=$$(date '+%s')
echo START TIME:$$ut > $outputfile
echo INPUT:"$inpstr" >> $outputfile
OMP_NUM_THREADS=$ompn /nfs2/pbalapra/Projects/qmcpack/miniqmc/build-openmp/bin/check_spo -g "2 2 2" -i 5 $cmd >> $outputfile
ut=$$(date '+%s')
echo END TIME:$$ut>> $outputfile
echo
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment