From 67f982146fd2a8affb3a61d470ba50a93d046a9a Mon Sep 17 00:00:00 2001 From: Tim Behrens <behrens@fmrib.ox.ac.uk> Date: Wed, 25 Aug 2004 15:19:14 +0000 Subject: [PATCH] *** empty log message *** --- eddy_correct | 2 +- old_bedpost | 27 +++++++++++++++++++-------- old_bedpost_cleanup | 12 ++++++++++++ old_bedpost_kill_all | 9 +++++++++ old_bedpost_kill_pid | 16 ++++++++++++++++ 5 files changed, 57 insertions(+), 9 deletions(-) create mode 100755 old_bedpost_cleanup create mode 100755 old_bedpost_kill_all create mode 100755 old_bedpost_kill_pid diff --git a/eddy_correct b/eddy_correct index db9c0da..1f03db6 100644 --- a/eddy_correct +++ b/eddy_correct @@ -13,7 +13,7 @@ input=`${FSLDIR}/bin/remove_ext ${1}` output=`${FSLDIR}/bin/remove_ext ${2}` ref=${3} -if [ ! `${FSLDIR}/bin/imtest $input` ];then +if [ `${FSLDIR}/bin/imtest $input` -eq 0 ];then echo "Input does not exist or is not in analyze format" exit fi diff --git a/old_bedpost b/old_bedpost index 5451982..7c79372 100755 --- a/old_bedpost +++ b/old_bedpost @@ -18,9 +18,11 @@ Clean_Exit(){ if [ -d ${subjdir}.bedpost/logs/pid_${$} ];then i=`ls ${subjdir}.bedpost/logs/pid_${$}` for j in ${i};do - host=`echo $j | awk --field-separator=_fdt_ '{print $1}'` - pid=`echo $j | awk --field-separator=_fdt_ '{print $2}'` - ${FSL_REMOTE_CALL} $host "kill -KILL $pid" #this leaves one child process per processor - what can you do? + host=`echo $j | awk -F _fdt_ '{print $1}'` + pid=`echo $j | awk -F _fdt_ '{print $2}'` +# ${FSL_REMOTE_CALL} $host "kill -KILL $pid" #this leaves one child process per processor - what can you do? + $FSL_REMOTE_CALL $host "if [ -r /etc/fslconf/fsl.sh ];then . /etc/fslconf/fsl.sh; elif [ -r /usr/local/etc/fslconf/fsl.sh ];then . /usr/local/etc/fslconf/fsl.sh; elif [ -r \${HOME}/.fslconf/fsl.sh ]; then . \${HOME}/.fslconf/fsl.sh; fi; if [ x\${FSLDIR} != "x" ];then \${FSLDIR}/bin/bedpost_kill_pid ${pid} >/dev/null 2>&1; else echo FSLDIR not set in any default location on machine `hostname`;fi" >/dev/null 2>&1 & + rm ${subjdir}.bedpost/logs/pid_${$}/${j} done fi @@ -127,29 +129,38 @@ mkdir -p ${subjdir}.bedpost/logs/pid_${$} nslices=`avwval ${subjdir}/data dim3` -#${FSLDIR}/bin/avwslice ${subjdir}/data -#${FSLDIR}/bin/avwslice ${subjdir}/nodif_brain_mask +${FSLDIR}/bin/avwslice ${subjdir}/data +${FSLDIR}/bin/avwslice ${subjdir}/nodif_brain_mask #following need to be setup elsewhere -#FSL_MACHINE_LIST="cayenne0 cayenne0 cayenne2 cayenne3" -#FSL_REMOTE_CALL="ssh" +#FSL_MACHINE_LIST="list of machines (can be duplicated for two processors etc. )" +#FSL_REMOTE_CALL="ssh (or rsh or whatever you want to use)" if [ "$FSL_MACHINE_LIST" = "" ] ; then + echo "processing data on local host" ${FSLDIR}/bin/bedpost_proc $subjdir $nslices else + echo "processing data on hosts: $FSL_MACHINE_LIST" for machine in $FSL_MACHINE_LIST; do $FSL_REMOTE_CALL $machine "if [ -r /etc/fslconf/fsl.sh ];then . /etc/fslconf/fsl.sh; elif [ -r /usr/local/etc/fslconf/fsl.sh ];then . /usr/local/etc/fslconf/fsl.sh; elif [ -r \${HOME}/.fslconf/fsl.sh ]; then . \${HOME}/.fslconf/fsl.sh; fi; if [ x\${FSLDIR} != "x" ];then \${FSLDIR}/bin/bedpost_proc $subjdir $nslices ${subjdir}.bedpost/logs/pid_${$}; else echo FSLDIR not set in any default location on machine `hostname`;fi" & done fi + +b=0 finished=0; while [ $finished -eq 0 ];do + b=`expr $b + 1 ` sleep 60; - nfin=`ls ${subjdir}.bedpost/logs/.*_finished |wc -w` #fix this (see Bedpost) + nfin=`echo ${subjdir}.bedpost/logs/.*_finished | grep -v ".\*" |wc -w` if [ $nfin -eq $nslices ];then finished=1; fi + if [ $b -eq 10 ]; then + echo "$nfin slices processed" + b=0 + fi done #postprocessing diff --git a/old_bedpost_cleanup b/old_bedpost_cleanup new file mode 100755 index 0000000..1243fef --- /dev/null +++ b/old_bedpost_cleanup @@ -0,0 +1,12 @@ +#!/bin/sh + +if [ "$FSL_MACHINE_LIST" = "" ] ; then + ${FSLDIR}/bin/bedpost_kill_all +else + unique_machines=`echo $FSL_MACHINE_LIST |tr " " \\\n |sort -u` + echo $unique_machines; + for machine in $unique_machines; do + $FSL_REMOTE_CALL $machine "if [ -r /etc/fslconf/fsl.sh ];then . /etc/fslconf/fsl.sh; elif [ -r /usr/local/etc/fslconf/fsl.sh ];then . /usr/local/etc/fslconf/fsl.sh; elif [ -r \${HOME}/.fslconf/fsl.sh ]; then . \${HOME}/.fslconf/fsl.sh; fi; if [ x\${FSLDIR} != "x" ];then \${FSLDIR}/bin/bedpost_kill_all; else echo FSLDIR not set in any default location on machine `hostname`;fi" & + done +fi + diff --git a/old_bedpost_kill_all b/old_bedpost_kill_all new file mode 100755 index 0000000..a524252 --- /dev/null +++ b/old_bedpost_kill_all @@ -0,0 +1,9 @@ +#!/bin/sh +j=`ps -U $USER |grep -v grep | grep bedpost|grep -v bedpost_kill | awk '{print $1}'` +if [ "x${j}" != "x" ];then + kill -KILL $j +fi +i=`ps -U $USER |grep -v grep | grep diff_pvm| awk '{print $1}'` +if [ "x${i}" != "x" ];then + kill -KILL $i +fi diff --git a/old_bedpost_kill_pid b/old_bedpost_kill_pid new file mode 100755 index 0000000..e319f1e --- /dev/null +++ b/old_bedpost_kill_pid @@ -0,0 +1,16 @@ +#!/bin/sh +Usage(){ + echo "bedpost_kill_pid <pid>" + echo "" + echo "<pid> is the pid of the bedpost_proc" + echo "kills this process + all diff_pvm children" + echo "" + exit +} + +[ "$1" = "" ] && Usage +pid=$1 + +i=`ps -fU $USER |grep -v grep | grep diff_pvm |grep ${pid}| awk '{print $2}'` +kill -KILL $pid $i + -- GitLab