Skip to content
Snippets Groups Projects
Commit f50a4408 authored by Moises Fernandez's avatar Moises Fernandez
Browse files

If not is set SGE_ROOT don't use any queue. Improve monitor if not SGE

parent 66b7e065
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,7 @@ subjdir=`echo $subjdir | sed 's/\/$/$/g'`
echo subjectdir is $subjdir
#parse option arguments
queue=cuda.q
queue="-q cuda.q"
njobs=1
nfibres=2
fudge=1
......@@ -73,12 +73,15 @@ njumps=1250
sampleevery=25
model=1
gflag=0
if [ "x$SGE_ROOT" = "x" ]; then
queue=''
fi
shift
while [ ! -z "$1" ]
do
case "$1" in
-Q) queue=$2;shift;;
-Q) queue=-q $2;shift;;
-NJOBS) njobs=$2;shift;;
-n) nfibres=$2;shift;;
-w) fudge=$2;shift;;
......@@ -147,6 +150,8 @@ if [ `${FSLDIR}/bin/imtest ${subjdir}/nodif` = 1 ] ; then
${FSLDIR}/bin/fslmaths ${subjdir}/nodif -mas ${subjdir}/nodif_brain_mask ${subjdir}.bedpostX/nodif_brain
fi
nvox=`${FSLDIR}/bin/fslstats $subjdir.bedpostX/nodif_brain_mask -V | cut -d ' ' -f1 `
echo Queuing parallel processing stage
[ -f ${subjdir}.bedpostX/commands.txt ] && rm ${subjdir}.bedpostX/commands.txt
if [ "x$SGE_ROOT" = "x" ]; then
......@@ -158,24 +163,33 @@ if [ "x$SGE_ROOT" = "x" ]; then
#!/bin/sh
finished=0
logdir=${subjdir}.bedpostX/logs
#voxels processed in each subpart are 12800 or more if the last one is less than 6400 (1 part less)
nsubparts=\$(($nvox/12800))
if [ \$nsubparts%12800 != 0 ];then
nsubparts=\$((\$nsubparts + 1))
fi
last_part=\$(($nvox-(((\$nsubparts-1))*12800)))
if [ \$last_part -lt 6400 ];then
nsubparts=\$((\$nsubparts - 1))
fi
check() {
if [ \$finished -eq 1 ];then
echo "\$nfin parts processed of "$njobs
echo "\$nfin parts processed of "$nsubparts
else
nfin=0
part=0
while [ "\$part" -le $njobs ];do
subpart=0
while [ "\$subpart" -le \$nsubparts ];do
partzp=\`\$FSLDIR/bin/zeropad \$part 4\`
if [ -f ${subjdir}.bedpostX/diff_parts/data_part_\$partzp/mean_S0samplesJ ];then
if [ -f ${subjdir}.bedpostX/diff_parts/data_part_0000/mean_S0samples_\$subpart ];then
nfin=\$((\$nfin + 1))
fi
part=\$((\$part + 1))
subpart=\$((\$subpart + 1))
done
if [ \$nfin -eq $njobs ] ; then
if [ \$nfin -eq \$nsubparts ] ; then
finished=1
fi
echo "\$nfin parts processed of "$njobs
echo "\$nfin parts processed of "\$nsubparts
fi
}
exit_test() {
......@@ -193,7 +207,7 @@ check
n=0
while [ \$finished -eq 0 ] ; do
sleep 10
if [ \$n -eq 60 ] ; then
if [ \$n -eq 6 ] ; then
check
n=0
else
......@@ -221,11 +235,10 @@ do
part=$(($part + 1))
done
bedpostid=`${FSLDIR}/bin/fsl_sub -q $queue -l ${subjdir}.bedpostX/logs -M $mailto -N bedpostx_gpu -t ${subjdir}.bedpostX/commands.txt`
bedpostid=`${FSLDIR}/bin/fsl_sub $queue -l ${subjdir}.bedpostX/logs -M $mailto -N bedpostx_gpu -t ${subjdir}.bedpostX/commands.txt`
echo Queuing post processing stage
nvox=`${FSLDIR}/bin/fslstats $subjdir.bedpostX/nodif_brain_mask -V | cut -d ' ' -f1 `
mergeid=`${FSLDIR}/bin/fsl_sub -q $queue -j $bedpostid -m as -N bpx_postproc -l ${subjdir}.bedpostX/logs ${FSLDEVDIR}/bin/bedpostx_postproc_gpu.sh --data=${subjdir}/data --mask=$subjdir.bedpostX/nodif_brain_mask -b ${subjdir}.bedpostX/bvals -r ${subjdir}.bedpostX/bvecs --forcedir --logdir=$subjdir.bedpostX/diff_parts $gopts $nvox $njobs ${subjdir}`
mergeid=`${FSLDIR}/bin/fsl_sub $queue -j $bedpostid -m as -N bpx_postproc -l ${subjdir}.bedpostX/logs ${FSLDEVDIR}/bin/bedpostx_postproc_gpu.sh --data=${subjdir}/data --mask=$subjdir.bedpostX/nodif_brain_mask -b ${subjdir}.bedpostX/bvals -r ${subjdir}.bedpostX/bvecs --forcedir --logdir=$subjdir.bedpostX/diff_parts $gopts $nvox $njobs ${subjdir}`
[ "x$SGE_ROOT" = "x" ] && kill -USR1 $monitorpid
if [ "x$SGE_ROOT" != "x" ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment