annotate trunk/experiments/scripts/cnbh-syllables/feature_generation/run_aimcopy.sh @ 706:f8e90b5d85fd tip

Delete CARFAC code from this repository. It has been moved to https://github.com/google/carfac Please email me with your github username to get access. I've also created a new mailing list to discuss CARFAC development: https://groups.google.com/forum/#!forum/carfac-dev
author ronw@google.com
date Thu, 18 Jul 2013 20:56:51 +0000
parents cac1f386e8d9
children
rev   line source
tomwalters@335 1 #!/bin/bash
tomwalters@335 2
tomwalters@335 3 # Test for the existence of AIMCopy in the path
tomwalters@335 4 AIMCOPY=`which AIMCopy`
tomwalters@353 5 if [ "$AIMCOPY" == "" ]; then
tomwalters@335 6 echo "Please build AIM-C and make AIMCopy available in the path"
tomwalters@415 7 exit -1
tomwalters@335 8 fi
tomwalters@335 9
tomwalters@335 10 set -e
tomwalters@335 11 set -u
tomwalters@335 12
tomwalters@413 13 AIMCOPY_CONFIGURATION_FILE=$1
tomwalters@413 14 FEATURES_DIR=$2
tomwalters@413 15 MACHINE_CORES=$3
tomwalters@335 16 FILE_LIST=feature_generation_script
tomwalters@335 17
tomwalters@335 18 echo "Splitting data files over cores..."
tomwalters@335 19 total_cores=$(($MACHINE_CORES))
tomwalters@335 20 echo -n $total_cores
tomwalters@335 21 echo " cores available"
tomwalters@335 22 total_files=`cat $FEATURES_DIR/$FILE_LIST | wc -l | sed 's/ *//'`
tomwalters@335 23 echo -n $total_files
tomwalters@335 24 echo " files to process"
tomwalters@335 25 files_per_core=$(($total_files/$total_cores+1))
tomwalters@335 26 echo -n $files_per_core
tomwalters@335 27 echo " files per core"
tomwalters@335 28 split -l $files_per_core $FEATURES_DIR/$FILE_LIST $FEATURES_DIR/split_list
tomwalters@335 29 splits=( $(ls $FEATURES_DIR/split_list*))
tomwalters@335 30 element=0
tomwalters@335 31 echo -n "Spawning "
tomwalters@335 32 echo -n $total_cores
tomwalters@335 33 echo " tasks..."
tomwalters@335 34 for ((c=1;c<=$MACHINE_CORES;c+=1)); do
tomwalters@335 35 s=${splits[$element]}
tomwalters@415 36 AIMCopy -C $AIMCOPY_CONFIGURATION_FILE -D $FEATURES_DIR/aimcopy_config.out -S $s -G $FEATURES_DIR/aimcopy_graph.dot &
tomwalters@335 37 let element=element+1
tomwalters@335 38 done
tomwalters@335 39
tomwalters@335 40 echo "Waiting for tasks to complete..."
tomwalters@335 41 wait
tomwalters@335 42 echo "Done!"