view trunk/experiments/scripts/cnbh-syllables/feature_generation/run_aimcopy.sh @ 402:69466da9745e

- Massive refactoring to make module tree stuff work. In theory we now support configuration files again. The graphics stuff is untested as yet.
author tomwalters
date Mon, 18 Oct 2010 04:42:28 +0000
parents 683df686f40d
children 786166d87205
line wrap: on
line source
#!/bin/bash

# Test for the existence of AIMCopy in the path
AIMCOPY=`which AIMCopy`
if [ "$AIMCOPY" == "" ]; then
  echo "Please build AIM-C and make AIMCopy available in the path"
fi

set -e
set -u

FEATURES_DIR=$1
MACHINE_CORES=$2
FILE_LIST=feature_generation_script

echo "Splitting data files over cores..."
total_cores=$(($MACHINE_CORES))
echo -n $total_cores
echo " cores available"
total_files=`cat $FEATURES_DIR/$FILE_LIST | wc -l | sed 's/ *//'`
echo -n $total_files
echo " files to process"
files_per_core=$(($total_files/$total_cores+1))
echo -n $files_per_core
echo " files per core"
split -l $files_per_core $FEATURES_DIR/$FILE_LIST $FEATURES_DIR/split_list
splits=( $(ls $FEATURES_DIR/split_list*))
element=0
echo -n "Spawning "
echo -n $total_cores
echo " tasks..."
for ((c=1;c<=$MACHINE_CORES;c+=1)); do
  s=${splits[$element]}
  AIMCopy -D $FEATURES_DIR/aimcopy_config.out -S $s &
  let element=element+1
done

echo "Waiting for tasks to complete..."
wait
echo "Done!"