The ampersand method

From CAC Documentation wiki
Revision as of 17:17, 21 September 2015 by Ad876 (talk | contribs) (Created page with "If when you run a program multiple times they all tend to take about the same length of time to run, you can use multiple cores on a node by using simple job control. Start th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

If when you run a program multiple times they all tend to take about the same length of time to run, you can use multiple cores on a node by using simple job control. Start the program with an ampersand to put it in the background. Then wait until the background tasks are done.

This code sits at https://forge.cornell.edu/svn/repos/cacuser/projects/martin_andre/script.

#!/bin/sh
#PBS -l nodes=1,walltime=2:00:00
#PBS -A dal16_0001
#PBS -N trying_ampersands
#PBS -q v4
#PBS -j oe

START_DIR=$HOME/dev/CAC/martin_andre/alm_try0


# copy files
cp $START_DIR/* $TMPDIR

cd $TMPDIR

export LD_LIBRARY_PATH=/cac/contrib/gsl-1.11/lib/
./logregFCHMMv2 3 4 train_d0.5_s1000.txt > res_lgFCHMMv2_d0.5_s1000.txt >&tast1.log.stdout &
./logregFCHMMv2 3 4 train_d0.5_s2000.txt > res_lgFCHMMv2_d0.5_s2000.txt &
./logregFCHMMv2 3 4 train_d0.5_s5000.txt > res_lgFCHMMv2_d0.5_s5000.txt &
./logregFCHMMv2 3 4 train_d0.5_s10000.txt > res_lgFCHMMv2_d0.5_s10000.txt &
wait


# copy output back
cp -f $TMPDIR/res* $START_DIR
cp -f $TMPDIR/log* $START_DIR