summaryrefslogtreecommitdiff
path: root/code/glue/da-controlled-sim-wrapper
diff options
context:
space:
mode:
Diffstat (limited to 'code/glue/da-controlled-sim-wrapper')
-rwxr-xr-xcode/glue/da-controlled-sim-wrapper62
1 files changed, 62 insertions, 0 deletions
diff --git a/code/glue/da-controlled-sim-wrapper b/code/glue/da-controlled-sim-wrapper
new file mode 100755
index 0000000..918de4a
--- /dev/null
+++ b/code/glue/da-controlled-sim-wrapper
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# check param count
+if [ ! $# -eq 7 ]; then
+ echo 'wrong parameter count (see the source for parameter order)' >&2
+ # 1. model name (e.g. the "if" from "sim-if")
+ # 2. controller name (relative to trainer-dir)
+ # 3. input_neuron_file
+ # 4. input_synapse_file
+ # 5. output_neuron_file
+ # 6. output_synapse_file
+ # 7. performance output
+ exit 1
+fi
+
+# determine the path of the simulaton program
+SIM=`dirname $0`/../core/sim-$1
+if [ ! -x $SIM ]; then
+ echo "executable ($SIM) does not exist" >&2
+ exit 1
+fi
+
+# determine the path of the controller programm
+CTL=`dirname $0`/../trainer/$2-$1
+if [ ! -x $CTL ]; then
+ echo "executable ($CTL) does not exist" >&2
+ exit 1
+fi
+
+
+# create tmp dir
+FIFODIR=`mktemp -td fasimu.XXXXXXXXXX`
+
+# create fifos
+mkfifo $FIFODIR/spike_in
+mkfifo $FIFODIR/spike_out
+mkfifo $FIFODIR/trace_in
+mkfifo $FIFODIR/global_in
+mkfifo $FIFODIR/global_out
+
+# TODO: check if an additional i/o file is an executable
+
+# launch controller and simulator
+#echo $CTL - $FIFODIR/trace_in $FIFODIR/global_in $FIFODIR/global_out $FIFODIR/spike_in $FIFODIR/spike_out "2> trainer.err &"
+$CTL $7 $FIFODIR/trace_in $FIFODIR/global_in $FIFODIR/global_out $FIFODIR/spike_in $FIFODIR/spike_out 2> trainer.err &
+
+#echo $SIM "2> sim.err" $3 $4 $FIFODIR/spike_in $FIFODIR/global_in $5 $6 $FIFODIR/spike_out $FIFODIR/global_out $FIFODIR/trace_in
+$SIM 2> sim.err $3 $4 $FIFODIR/spike_in $FIFODIR/global_in $5 $6 $FIFODIR/spike_out $FIFODIR/global_out $FIFODIR/trace_in
+
+# hint: simulator params are
+ # input_neuron_file
+ # input_synapse_file
+ # input_spike_file
+ # input_global_file
+ # output_neuron_file
+ # output_synapse_file
+ # output_spike_file
+ # output_global_file
+ # trace_commando_file
+
+# delete tmp dir
+rm -R $FIFODIR
contact: Jan Huwald // Impressum