forked from siloekse/PythonESN
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_experiments.sh
More file actions
executable file
·71 lines (57 loc) · 1.63 KB
/
Copy pathrun_experiments.sh
File metadata and controls
executable file
·71 lines (57 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# Don't want numpy to use OMP. Parallelization via SCOOP.
export OMP_NUM_THREADS=1
# Find config/data files and names
shopt -s nullglob
BASEDIR=.
CONFIGDIR=configs/user
CONFIGPREFIX=${BASEDIR}/${CONFIGDIR}/
CONFIGFILES=(${CONFIGPREFIX}*.json)
ESNCONFIGDIR=${BASEDIR}/configs/esn
DATADIR=data
DATAPREFIX=$BASEDIR/$DATADIR/
DATAFILES=(${DATAPREFIX}*)
RESULTDIR=$BASEDIR/results
shopt -u nullglob
# Create result and esn config directory
if [ ! -d "$RESULTDIR" ]; then
# Control will enter here if $DIRECTORY doesn't exist.
mkdir $RESULTDIR
fi
if [ ! -d "$ESNCONFIGDIR" ]; then
# Control will enter here if $DIRECTORY doesn't exist.
mkdir $ESNCONFIGDIR
fi
# Remove json file extension (and path for confignames/datanames)
SUFFIX=".json"
idx=0
for i in ${CONFIGFILES[@]}; do
i=${i%$SUFFIX}
CONFIGFILES[idx]=${i}
CONFIGNAMES[idx]=${i#$CONFIGPREFIX}
idx=${idx}+1
done
idx=0
for i in ${DATAFILES[@]}; do
i=${i#$DATAPREFIX}
DATANAMES[idx]=${i}
idx=${idx}+1
done
# Initialize the experiment
idx_i=0
idx_j=0
for DATANAME in ${DATANAMES[@]}; do
for CONFIGNAME in ${CONFIGNAMES[@]}; do
FILENAME=${DATANAME}_${CONFIGNAME}
DATAFILE=${DATAPREFIX}${DATANAME}
CONFIGFILE=${CONFIGPREFIX}${CONFIGNAME}
ESNCONFIG=$ESNCONFIGDIR/$FILENAME
RUNS=32
# Spawn process.
# Note: unbuffer is in the 'expect' package and ensures that the output is flushed to stdout right away.
# 2>&1 | tee ... writes to the file AND shows it in the console.
unbuffer ./run_single_experiment.sh $DATAFILE $CONFIGFILE $ESNCONFIG $RUNS 2>&1 | tee $RESULTDIR/$FILENAME
idx_j=${idx_j}+1
done
idx_i=${idx_i}+1
done