aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-09-14 09:27:49 -0700
committerThomas White <taw@physics.org>2018-09-14 20:52:37 +0200
commit017b070f74af546b4a2611088cfe1203e7aab79c (patch)
treee1c25dc3b1021a1c765e19027a9a8e7e8a9f9087 /scripts
parentfe29796ba464455d0089c314fc6623b8b0733a80 (diff)
Update turbo-index-lsf to match turbo-index-slurm as much as possible
Diffstat (limited to 'scripts')
-rw-r--r--scripts/turbo-index-lsf78
1 files changed, 64 insertions, 14 deletions
diff --git a/scripts/turbo-index-lsf b/scripts/turbo-index-lsf
index 00e4ec15..1640ec3d 100644
--- a/scripts/turbo-index-lsf
+++ b/scripts/turbo-index-lsf
@@ -1,26 +1,76 @@
#!/bin/sh
-RUN=$1
-NOSAMPLE=`echo $RUN | sed -e 's/\-.*$//'`
+# Split a large indexing job into many small tasks and submit using LSF
-GEOM=my.geom # Name of your geometry file
+# ./turbo-index my-files.lst label my.geom /location/for/streams
-find /path/to/CXI/files/$RUN -name '*.cxi' > files-${RUN}.lst # Set location of files
-list_events -i files-${RUN}.lst -g $GEOM -o events-${RUN}.lst
+# Copyright © 2016-2017 Deutsches Elektronen-Synchrotron DESY,
+# a research centre of the Helmholtz Association.
+#
+# Authors:
+# 2016 Steve Aplin <steve.aplin@desy.de>
+# 2016-2017 Thomas White <taw@physics.org>
+
+SPLIT=1000 # Size of job chunks
+
+INPUT=$1
+RUN=$2
+GEOM=$3
+STREAMDIR=$4
+
+# Set up environment here if necessary
+#source /path/to/crystfel/setup.sh
+
+# Generate event list from file above
+list_events -i $INPUT -g $GEOM -o events-${RUN}.lst
+if [ $? != 0 ]; then
+ echo "list_events failed"
+ exit 1
+fi
+# If you are using single-event files instead of multi-event ("CXI") ones,
+# comment out the above lines and uncomment the following one:
+#cp $INPUT events-${RUN}.lst
+
+# Count total number of events
wc -l events-${RUN}.lst
-rm -f split-events-${RUN}.lst files-${RUN}.lst
-split -d -l 500 events-${RUN}.lst split-events-${RUN}.lst
+
+# Split the events up, will create files with $SPLIT lines
+split -a 3 -d -l $SPLIT events-${RUN}.lst split-events-${RUN}.lst
+
+# Clean up
rm -f events-${RUN}.lst
+# Loop over the event list files, and submit a batch job for each of them
for FILE in split-events-${RUN}.lst*; do
- STREAM=`echo $FILE | sed -e "s/split-events-${RUN}.lst/${RUN}.stream/"`
- NAME=`echo $FILE | sed -e "s/split-events-${RUN}.lst/${NOSAMPLE}-/"`
- echo "$NAME: $FILE ---> $STREAM"
+ # Stream file is the output of crystfel
+ STREAM=`echo $FILE | sed -e "s/split-events-${RUN}.lst/${RUN}.stream/"`
+
+ # Job name
+ NAME=`echo $FILE | sed -e "s/split-events-${RUN}.lst/${RUN}-/"`
+
+ # Job number
+ NUMBER=${NAME##$RUN-}
+ POS=`expr $NUMBER \* $SPLIT + 1`
+
+ echo "$NAME (serial start $POS): $FILE ---> $STREAM"
+
+ SLURMFILE="${NAME}.sh"
+
+ echo "#!/bin/sh" > $SLURMFILE
+ echo >> $SLURMFILE
+
+ # Set up environment here (again) if necessary
+ echo "#source /path/to/crystfel/setup.sh" >> $SLURMFILE
+ echo >> $SLURMFILE
+
+ command="indexamajig -i $FILE -o $STREAMDIR/$STREAM --serial-start=$POS"
+ command="$command -j \`nproc\` -g $GEOM"
+ #command="$command --peaks=zaef" # Indexing parameters here
+
+ echo $command >> $SLURMFILE
- # Set indexing parameters here
- bsub -q psanaq -o $NAME.log -J $NAME -n 12 -R "span[hosts=1]" \
- indexamajig \
- -i $FILE -o $STREAM -j 32 -g $GEOM --peaks=cxi
+ # Set your queue after "-q" below
+ bsub -q myqueue -o $NAME.out -e $NAME.err -J $NAME -x sh $SLURMFILE
done