Commit 5b206be6 authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers 🖥

readme updates for running this on the cluster

parent fef5b870
Pipeline #239 passed with stages
in 1 minute and 21 seconds
......@@ -10,5 +10,35 @@ This is designed to allow the development of bots which play the board game [han
* research/ - Materials for research purposes
* target/ - Maven compiled artifacts
## Assumptions
* stdout is for data (we write the code as filters)
* stderr is for debug logging (this might change if we use it for competitions)
* enviroment variables are awesome (webpigeon spent too much time around docker) and therefor we'll use them for configuration
## Adding new agents
New agents must be added to either buildAgent method in order to run. Most of these are calls to factory methods elseware in the codebase. This is because most of the rule based AIs are the same agent with different rules set. Therefore, your agent is expected to be present as a case statement in build agent.
Again, for a competition runner, this might change (to use reflection) - at the moment it's coded this way for ease of development.
Sample agents live under ``````.
## Running the code
### Running locally
1. checkout this repo
2. use `````` or `````` to collect data - these scripts will also generate a log for you
3. you can also run App2CsvMulti or MixedAgentGame from the jarfile instead (they will write their csv data to standard out).
4. analyise data
### Running me on YARCC
The game engine has been designed to make it possible to run on YARCC. In src/main/scripts you will find the jobfile and scripts needed to make this work. The basic process can be summed up as:
1. checkout this repo
2. use src/main/scripts/ to generate matchups
3. use qsub to submit a job (edit runParamterJob in src/main/scripts before running!)
4. use to generate results.csv from the job outputs
5. copy results.csv to somewhere else and analyise it (my analysis scripts will be made public soon)
#! /bin/bash
# Make the damn thing work on the yarcc cluster
# Generate matchups for the cluster runner, 1 argument set per line.
# This should be usedwith the MixedAgentGameSingle class to run the approprate game.
# YARCC defaults to java 5, we use lambdas.
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk.x86_64
git pull
module load maven
# Rebuild the project incase something changed
git pull
mvn clean package
# setup our envrioment variables
export FIREWORKS_NUM_SEEDS=250 # 250 = 5000 jobs (maximum permitted by the cluster) at current number of agents
# Generate the matchups for pure and mixed games
$JAVA_HOME/bin/java -cp target/fireworks-0.1-SNAPSHOT.jar > mixedArgs.txt
$JAVA_HOME/bin/java -cp target/fireworks-0.1-SNAPSHOT.jar > pureArgs.txt
# output the number of matchups, this MUST be less than 5000
wc --lines mixedArgs.txt
wc --lines pureArgs.txt
#! /bin/bash
# YARCC hanabi agregation script
# take YARCC cluster out and error log, seperate them by job and combine standard outs to form results.csv
shopt -s extglob
# take the log directory (INDIR), extract job name and task id from the files and put them into jobid folders in OUTDIR
# new files will be of the format $OUTDIR/jobid/{o,e}/taskid.out
for FILENAME in $(ls -1 $INDIR)
NEW_FILENAME=$(echo $FILENAME | awk 'BEGIN { FS = "."; } { printf "%s/%s/%s.out\n", substr($2,2),substr($2,0,1),$3}')
mkdir -p $OUTDIR/$(dirname $NEW_FILENAME)
# Aggregate the outfiles into a csv (outfiles are already valid CSVs which end in newline)
for DIRNAME in $(ls -1 $OUTDIR)
cat $OUTDIR/$DIRNAME/o/*.out > $OUTDIR/$DIRNAME/results.csv
......@@ -11,7 +11,7 @@
#$ -e ./results/mx_yarcc
export FIREWORKS_RUN_COUNT=1 # Repeat each game only once
vmArgs="-Xmx1024m -XX:ParallelGCThreads=1"
filename=$(awk NR=$SGE_TASK_ID arguments.txt)
java $vmArgs -cp target/fireworks-0.1-SNAPSHOT.jar $filename
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