Roborumble/MassiveRun.sh

From Robowiki
< Roborumble
Revision as of 10:25, 20 July 2019 by Xor (talk | contribs) (fix)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

I'm running 8 instances of roborumble@home now, and here is a util script for managing them, provided for whom wanted to run many instances at once. The code below should be self-documented.

#!/usr/bin/env bash

params='-Xmx512M -cp libs/robocode.jar:libs/roborumble.jar:libs/bcel-6.2.jar:libs/codesize-1.2.jar -XX:+IgnoreUnrecognizedVMOptions --add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.desktop/sun.awt=ALL-UNNAMED roborumble.RoboRumbleAtHome'
rumble='roborumble'
cores=8

cd "${0%/*}"

echo Copying rumble config...

for i in `seq 1 ${cores}`; do
  rm -rf robocode-$i/roborumble;
  cp -r rumble_config robocode-$i/roborumble;
done

echo Launching ${rumble}...

mkdir -p logs

for i in `seq 1 ${cores}`; do
  pushd robocode-$i > /dev/null

  log="../logs/${rumble}-$i.log"
  echo "["`date`"]" >> ${log}
  nohup java ${params} ./roborumble/${rumble}.txt >> ${log} 2>&1 &

  popd > /dev/null
done

echo Displaying log...

tail -f logs/${rumble}-1.log