[5] | 1 | disparm acts as a server for text lines. These lines constitute |
---|
| 2 | in general parameters for a command or a whole commandline. |
---|
| 3 | |
---|
| 4 | Using dispar it is possible to arrange that each of many processes, |
---|
| 5 | in general running concurrently on many nodes gets it's own parameterlist. |
---|
| 6 | |
---|
| 7 | The parameterlists are put in a simple database, residing on a shared |
---|
| 8 | file system, which must be readable and writable on the nodes by the |
---|
| 9 | user of dispar. |
---|
| 10 | |
---|
| 11 | Example: |
---|
| 12 | |
---|
| 13 | - Create the parameter database |
---|
| 14 | First, create a text file, each line with a parameter set, for example: |
---|
| 15 | |
---|
| 16 | seq 100 > parmfile |
---|
| 17 | |
---|
| 18 | (this results in a simple parameter file, each line containing one of |
---|
| 19 | the numbers 1-100) |
---|
| 20 | |
---|
| 21 | Then, create the database to be used by disparm: |
---|
| 22 | |
---|
| 23 | disparm -c -i parmfile |
---|
| 24 | |
---|
| 25 | This creates a parameter database with the name 'parmfile.disparm'. |
---|
| 26 | It is a text file, to be managed by subsequent calls to dispar. |
---|
| 27 | |
---|
| 28 | - Get the next, not already used, line: |
---|
| 29 | |
---|
| 30 | eval "`dispar -n`" |
---|
| 31 | |
---|
| 32 | This will create the following environment variables: |
---|
| 33 | |
---|
| 34 | DISPAR_VALUE: the line exactly as present in the original parameter file |
---|
| 35 | DISPAR_KEY: to be used at a next 'dispar -r' call, see below |
---|
| 36 | DISPAR_STATUS: the status of the line in DISPAR, always 0 in |
---|
| 37 | this version of dispar |
---|
| 38 | DISPAR_COMMITTED: the number of times this line has been produced |
---|
| 39 | (minimum 1) |
---|
| 40 | DISPAR_RC: this value should be checked first: only if the value is 'OK', |
---|
| 41 | other values are meaningful |
---|
| 42 | |
---|
| 43 | A shell loop, using dispar to get the next parameters and start a program |
---|
| 44 | using these parameters: |
---|
| 45 | |
---|
| 46 | while true ; do |
---|
| 47 | dispar -n |
---|
| 48 | if ("$DISPAR_RC != "OK") ; then |
---|
| 49 | break |
---|
| 50 | fi |
---|
| 51 | eval "myprogram $DISPAR_VALUE" |
---|
| 52 | done |
---|
| 53 | |
---|
| 54 | If many nodes are running this loop, and if the parameterdatabase is on a |
---|
| 55 | filesystem shared by the nodes (a common case in clusters), the program |
---|
| 56 | 'myprogram' will run many times on those nodes. Every run will use another |
---|
| 57 | line of the original parameterfile. |
---|
| 58 | |
---|
| 59 | Using the -m flag, you can tell dispar to produce a line more than once. |
---|
| 60 | This is useful if you submit a number of jobs, each containing loops as |
---|
| 61 | above, and you expect that some jobs will fail because of a time-limit |
---|
| 62 | for example. |
---|