Revision d5c974ac9ce897791737b6f4e0cee5de2254e6f6 authored by Andreas Stuhlmueller on 31 January 2017, 02:56:40 UTC, committed by Andreas Stuhlmueller on 31 January 2017, 02:56:40 UTC
1 parent 22b8f88
parallelRun
#!/usr/bin/env bash
# Example: To run two processes that both execute /path/to/model.wppl
# with parameter id my-params run:
# ./parallelRun /path/to/model.wppl 2 my-params
# You can pass additional options to the webppl script, for example:
# ./parallelRun /path/to/model.wppl 2 my-params --require webppl-json
set -e
realpath() {
echo $(cd $(dirname $1); pwd)/$(basename $1);
}
wpplScript="$( dirname "${BASH_SOURCE[0]}" )/../webppl"
wpplFile=$(realpath $1)
numProcesses=$2
paramId=$3
# Now shift the command-line params so that we can pass on the
# unused # params to webppl
shift 3
for ((n=0;n<numProcesses;n++)); do
$wpplScript $wpplFile --param-store mongo --param-id $paramId "$@" &
# We sleep a bit so that, when we run many processes in parallel,
# they don't all try to connect to MongoDB at the same time.
sleep 0.5s
done
wait
Computing file changes ...