Hoffman2:Submit jobarray (readarray): Difference between revisions

From Center for Cognitive Neuroscience
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
[[Hoffman2|Back to all things Hoffman2]]
[[Hoffman2|Back to all things Hoffman2]]


In this example, subjects are read in from a subjects.txt file. subjects.txt is a text file with a single subject ID on each line.  '''Watch out for non-Linux (Mac or PC) line endings.'''  Line ending issues can be fixed with <code>dos2unix</code>.
In this example, subjects are read in from a subjects.txt file. subjects.txt is a text file with a single subject ID on each line.  '''Watch out for non-Linux (Mac or PC) line endings.'''  Line ending issues can be fixed with <code>dos2unix myscript.sh</code>.


  <nowiki>#!/bin/bash
  <nowiki>#!/bin/bash

Revision as of 19:25, 29 November 2017

Back to all things Hoffman2

In this example, subjects are read in from a subjects.txt file. subjects.txt is a text file with a single subject ID on each line. Watch out for non-Linux (Mac or PC) line endings. Line ending issues can be fixed with dos2unix myscript.sh.

#!/bin/bash
#$ -cwd
# error = Merged with joblog
#$ -o joblog.$JOB_ID.$TASK_ID
#$ -j y
#$ -pe shared 2
#$ -l h_rt=8:00:00,h_data=4G
# Email address to notify
#$ -M $USER@mail
# Notify when
#$ -m a
#  Job array indexes
#$ -t 1-16:1

# Load the job environment:
. /u/local/Modules/default/init/modules.sh
module use /u/project/CCN/apps/modulefiles

# Load the FSL module
module load fsl

# This is optional
# More info here: https://www.ccn.ucla.edu/wiki/index.php/Hoffman2:FSL 
export NO_FSL_JOBS=true

# Set up the subjects list
readarray -t subjects < subjects.txt
(( i=$SGE_TASK_ID - 1 ))

echo "This is sub-job $SGE_TASK_ID"
echo "This is subject ${subjects[$i]}"

# Your script content goes here...