1

I have a question regarding linux parallel scripts:

Context: I need to process many .dat files

Code I have so far:

#!/bin/bash
#PBS -S /bin/bash
# set parallel parameters 
#PBS -r n 
#PBS -l walltime=2:00:00 
#PBS -l procs=298 
#PBS -l pmem=1600m 
#PBS -m bea 
#PBS -M [email protected]
#PBS -N FileName

cd /home/user/Data/
# start matlab
module load matlab/2015b
# Choose the MCR directory according to the compiler version used
MCR=/global/software/matlab/mcr/v90
# set up matlab compiler
mcc -R -nodisplay -R -singleCompThread -R -logfile,ResultsOutput.txt -K -m -v -w enable FileName.m

# cycle through all files
# does the for loop send it to different nodes?
for fileID in *.dat
do
  echo "Running on host: `hostname`"
  echo "Current working directory is `pwd`"
  echo "Starting run at: `date`" 
  echo "$fileID"

  ./run_FileName.sh $MCR $fileID > Results_${PBS_JOBID}.out &

  echo "Job finished at: `date`"    
done

need to retain results ??

3
  • I don't know. Do you need to retain results?
    – DopeGhoti
    Commented Jan 26, 2017 at 21:38
  • Sorry, but we don't know what type of system you are on. It looks like you're using a queuing system on some sort of compute farm? PBS?
    – Kusalananda
    Commented Jan 26, 2017 at 21:41
  • What is the question? Commented Jan 29, 2017 at 0:35

1 Answer 1

3

I think you should look at GNU Parallel https://www.gnu.org/software/parallel/.

parallel "./run_FileName.sh $MCR {} > Results_${PBS_JOBID}.out" ::: *.dat

And you probably want to use the option --joblog and --sshloginfile too.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.