diff options
author | Tobias Bachmann | 2021-09-05 18:24:38 +0200 |
---|---|---|
committer | Tobias Bachmann | 2021-09-05 18:24:38 +0200 |
commit | 571f0ab136c19eada63d8cef04b6bb9e22c52d48 (patch) | |
tree | f459be15746bafb383b6db92017a18c5b82ba8be | |
parent | 9b1e54e8fa2076db3323b9c65b571c7a5cca017e (diff) | |
download | aur-571f0ab136c19eada63d8cef04b6bb9e22c52d48.tar.gz |
FSL 6.0.5
-rw-r--r-- | .SRCINFO | 35 | ||||
-rw-r--r-- | 002-fix_fsl_exec_empty_errorCode.patch | 12 | ||||
-rw-r--r-- | 003-fix_missing_LIB_PROB.patch | 35 | ||||
-rwxr-xr-x | PKGBUILD | 55 | ||||
-rw-r--r-- | buildSettings.mk | 53 | ||||
-rw-r--r-- | fsl_sub | 544 |
6 files changed, 632 insertions, 102 deletions
@@ -1,7 +1,7 @@ pkgbase = fsl pkgdesc = A comprehensive library of analysis tools for FMRI, MRI and DTI brain imaging data - pkgver = 6.0.4 - pkgrel = 2 + pkgver = 6.0.5 + pkgrel = 1 url = http://www.fmrib.ox.ac.uk/fsl/ arch = x86_64 license = custom @@ -24,34 +24,23 @@ pkgbase = fsl depends = vtk depends = sqlite depends = python3 - depends = fslpy + depends = fslpy>=3.7.0 depends = bc depends = openblas optdepends = cuda - source = https://www.fmrib.ox.ac.uk/fsldownloads/fsl-6.0.4-sources.tar.gz - source = https://www.fmrib.ox.ac.uk/fsldownloads/fsl-6.0.4-feeds.tar.gz + source = https://www.fmrib.ox.ac.uk/fsldownloads/fsl-6.0.5-sources.tar.gz + source = https://www.fmrib.ox.ac.uk/fsldownloads/fsl-6.0.5-feeds.tar.gz source = buildSettings.mk - source = imcp - source = imglob - source = immv + source = fsl_sub source = 001-use_distribution_environment.patch - source = 002-fix_meldata_usage_of_ifstream.patch - source = 003-fix_fsl_exec_empty_errorCode.patch - source = 004-fix_missing_LIB_PROB.patch - source = 005-fix_cuda_thrust_include.patch - source = 006-compile_ptx2_without_std-c++11.patch - sha256sums = 58b88f38e080b05d70724d57342f58e1baf56e2bd3b98506a72b4446cad5033e - sha256sums = 411daed14287d6ba536cb531450941ab1f570309cd561de4e2a4b0ec43a7e9f7 - sha256sums = c7f93adcf037a73182ae42ae6a59d3eb04a492888b6c2a6b528f9cd16539b2b2 - sha256sums = 8aac3a2ea61bb4c38eb363262ab7f89e55c49a5feb9912fd2ff71f2439f11fc9 - sha256sums = b3280bafc86d04dfa8835ef21f50469f2645bf09c36edcdd3f04349ce2c74225 - sha256sums = 8e343b0ff93477280fd9a980822ddc9980afa7201dea51c886376c189c234c99 + source = 002-fix_fsl_exec_empty_errorCode.patch + source = 003-fix_missing_LIB_PROB.patch + sha256sums = df12b0b1161a26470ddf04e4c5d5d81580a04493890226207667ed8fd2b4b83f + sha256sums = e68e1efeb45750f876f350442f56c4830d211e9fb16daa5ad134bb8e1ef1ae18 + sha256sums = 880c46d4ef8a8ee1401e1fdb71dadd0f79aad2154967a03232844845227394a3 + sha256sums = 2516982d151ab9e450a9ac6d5a6fc87099a7acc067514d80422c69950e618170 sha256sums = 906ac7de8068e5a5487b083844b50b6afd7562866088a4175fd88030182affdd - sha256sums = 13d4cf35343e7a73bc2534c94b1b0d4db41c338d374e6982091e4cf7a421d420 sha256sums = 64b4ccefa63a3cf920b185dd52e94b918c24f2cedaebcec8efb767bd80a6418a sha256sums = adea0372f42026e72e385f1bec19ecc8cffa46de1f617271f14c9345c6b83c04 - sha256sums = 9471addfc2f880350eedadcb99cb8b350abf42be1c0652ccddf49e34e5e48734 - sha256sums = ab68cb802243ce715eff0d1136cfa29fa34a3e09934e5e20e02a092d69028df1 pkgname = fsl - diff --git a/002-fix_fsl_exec_empty_errorCode.patch b/002-fix_fsl_exec_empty_errorCode.patch new file mode 100644 index 000000000000..5e8cb0269cd2 --- /dev/null +++ b/002-fix_fsl_exec_empty_errorCode.patch @@ -0,0 +1,12 @@ +--- a/fsl/src/misc_tcl/fsl_exec.tcl 2018-10-23 18:49:44.000000000 +0200 ++++ b/fsl/src/misc_tcl/fsl_exec.tcl 2018-11-25 18:52:30.636934316 +0100 +@@ -175,6 +175,9 @@ + set logout "" + } + ++ # make sure errorCode is set ++ if { ! [ info exists ::errorCode ] } { set ::errorCode "NONE" } ++ + # run and log the actual command + if { $do_logout } { + fsl:echo $logout "\n$thecommand" diff --git a/003-fix_missing_LIB_PROB.patch b/003-fix_missing_LIB_PROB.patch new file mode 100644 index 000000000000..abd3dbb4b631 --- /dev/null +++ b/003-fix_missing_LIB_PROB.patch @@ -0,0 +1,35 @@ +--- a/fsl/src/eddy/Makefile 2019-09-29 21:41:53.118138982 +0200 ++++ b/fsl/src/eddy/Makefile 2019-09-29 21:25:19.118338652 +0200 +@@ -62,7 +62,7 @@ + endif + EXENAME=eddy${TMPNAME_1}${TMPNAME_2} + endif +-USRLDFLAGS=-L${LIB_NEWMAT} -Wl,-rpath,/opt/fmrib/fsl/lib -rdynamic ++USRLDFLAGS=-L${LIB_NEWMAT} -L${LIB_PROB} -Wl,-rpath,/opt/fmrib/fsl/lib -rdynamic + USRINCFLAGS=-I. -I${INC_NEWMAT} -I${INC_PROB} -I${INC_BOOST} -I${INC_CUDA} -I$(CBF_DIR) -I$(INC_BASISFIELD) + + OBJS=eddy.o BiasFieldEstimatorImpl.o MoveBySuscCF.o PostEddyAlignShellsFunctions.o EddyCommandLineOptions.o ECModels.o KMatrix.o HyParEstimator.o ECScanClasses.o EddyUtils.o EddyHelperClasses.o DiffusionGP.o b0Predictor.o + +--- a/fsl/src/asl_mfree/Makefile 2019-09-29 22:52:54.221367251 +0200 ++++ b/fsl/src/asl_mfree/Makefile 2019-09-29 22:53:23.577360889 +0200 +@@ -3,7 +3,7 @@ + PROJNAME = asl_mfree + + USRINCFLAGS = -I${INC_NEWMAT} -I${INC_ZLIB} +-USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_ZLIB} ++USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_ZLIB} -L${LIB_PROB} + + FSLVERSION= $(shell cat ${FSLDIR}/etc/fslversion | head -c 1) + ifeq ($(FSLVERSION), 5) + +--- a/fsl/src/oxford_asl/Makefile 2019-09-29 22:52:27.621373018 +0200 ++++ b/fsl/src/oxford_asl/Makefile 2019-09-29 22:53:41.237357074 +0200 +@@ -3,7 +3,7 @@ + PROJNAME = oxford_asl + + USRINCFLAGS = -I${INC_NEWMAT} -I${INC_ZLIB} +-USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_ZLIB} ++USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_ZLIB} -L${LIB_PROB} + + FSLVERSION= $(shell cat ${FSLDIR}/etc/fslversion | head -c 1) + ifeq ($(FSLVERSION), 5) @@ -1,41 +1,35 @@ # Maintainer: Tobias Bachmann <tobachmann@gmx.de> # Contributor: fishburn <frankthefishburn@gmail.com> +# Set number of parallel compile jobs, default equals number of CPUs +NJOBS=$(nproc) +NJOBS=8 + pkgname=fsl -pkgver=6.0.4 -pkgrel=2 +pkgver=6.0.5 +pkgrel=1 pkgdesc="A comprehensive library of analysis tools for FMRI, MRI and DTI brain imaging data" arch=("x86_64") url="http://www.fmrib.ox.ac.uk/fsl/" license=(custom) -depends=(gd libxml2 libxml++2.6 gsl libpng nlopt newmat tcl tk zlib python glu boost-libs vtk sqlite python3 fslpy bc openblas) +depends=(gd libxml2 libxml++2.6 gsl libpng nlopt newmat tcl tk zlib python glu boost-libs vtk sqlite python3 'fslpy>=3.7.0' bc openblas) makedepends=(boost fftw gcc9) optdepends=(cuda) source=("https://www.fmrib.ox.ac.uk/fsldownloads/fsl-${pkgver}-sources.tar.gz" "https://www.fmrib.ox.ac.uk/fsldownloads/fsl-${pkgver}-feeds.tar.gz" "buildSettings.mk" - "imcp" - "imglob" - "immv" + "fsl_sub" "001-use_distribution_environment.patch" - "002-fix_meldata_usage_of_ifstream.patch" - "003-fix_fsl_exec_empty_errorCode.patch" - "004-fix_missing_LIB_PROB.patch" - "005-fix_cuda_thrust_include.patch" - "006-compile_ptx2_without_std-c++11.patch") + "002-fix_fsl_exec_empty_errorCode.patch" + "003-fix_missing_LIB_PROB.patch") -sha256sums=('58b88f38e080b05d70724d57342f58e1baf56e2bd3b98506a72b4446cad5033e' - '411daed14287d6ba536cb531450941ab1f570309cd561de4e2a4b0ec43a7e9f7' - 'c7f93adcf037a73182ae42ae6a59d3eb04a492888b6c2a6b528f9cd16539b2b2' - '8aac3a2ea61bb4c38eb363262ab7f89e55c49a5feb9912fd2ff71f2439f11fc9' - 'b3280bafc86d04dfa8835ef21f50469f2645bf09c36edcdd3f04349ce2c74225' - '8e343b0ff93477280fd9a980822ddc9980afa7201dea51c886376c189c234c99' +sha256sums=('df12b0b1161a26470ddf04e4c5d5d81580a04493890226207667ed8fd2b4b83f' + 'e68e1efeb45750f876f350442f56c4830d211e9fb16daa5ad134bb8e1ef1ae18' + '880c46d4ef8a8ee1401e1fdb71dadd0f79aad2154967a03232844845227394a3' + '2516982d151ab9e450a9ac6d5a6fc87099a7acc067514d80422c69950e618170' '906ac7de8068e5a5487b083844b50b6afd7562866088a4175fd88030182affdd' - '13d4cf35343e7a73bc2534c94b1b0d4db41c338d374e6982091e4cf7a421d420' '64b4ccefa63a3cf920b185dd52e94b918c24f2cedaebcec8efb767bd80a6418a' - 'adea0372f42026e72e385f1bec19ecc8cffa46de1f617271f14c9345c6b83c04' - '9471addfc2f880350eedadcb99cb8b350abf42be1c0652ccddf49e34e5e48734' - 'ab68cb802243ce715eff0d1136cfa29fa34a3e09934e5e20e02a092d69028df1') + 'adea0372f42026e72e385f1bec19ecc8cffa46de1f617271f14c9345c6b83c04') prepare() { cd "${srcdir}" @@ -48,15 +42,10 @@ prepare() { # Apply patches patch -Np1 -i "${srcdir}"/001-use_distribution_environment.patch - patch -Np1 -i "${srcdir}"/002-fix_meldata_usage_of_ifstream.patch # From https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=fsl;e8fa48c1.1501 patch -Np1 -i "${srcdir}"/003-fix_fsl_exec_empty_errorCode.patch # I'm not sure why -L${LIB_PROB} is missing in some Makefiles patch -Np1 -i "${srcdir}"/004-fix_missing_LIB_PROB.patch - # Adapted from Caspar van Leeuwen's patch: https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=FSL;2b74023.2006 - patch -Np1 -i "${srcdir}"/005-fix_cuda_thrust_include.patch - # ptx2 does not compile when assuming C++11 standard - patch -Np1 -i "${srcdir}"/006-compile_ptx2_without_std-c++11.patch # Insert makepkg build flags into configuration sed -i '0,/${AccumulatedIncFlags}/{s^${AccumulatedIncFlags}^& '"${CFLAGS}"'^}' "${srcdir}/fsl/config/common/vars.mk" @@ -69,16 +58,22 @@ prepare() { build() { export FSLDIR="${srcdir}/fsl" cd "${FSLDIR}" - ./build - - # Install missing binaries, which are no longer shipped (depends on fslpy) - /usr/bin/install -m 755 "${srcdir}"/{imcp,imglob,immv} "${srcdir}/fsl/bin" + MAKEOPTIONS="-j $NJOBS" ./build extras CiftiLib-master utils znzlib NewNifti fslio giftiio miscmaths newimage libvis first_lib meshclass fslvtkio misc_tcl basisfield warpfns bint shapeModel MVdisc + MAKEOPTIONS="" ./build fslsurface # fslsurface does not like parallel compiling + MAKEOPTIONS="-j $NJOBS" ./build libmeshutils newmesh DiscreteOpt FastPDlib MSMRegLib misc_c topup asl_mfree avwutils basil baycest bet2 bianca cluster fsl_deface eddy fabber_core fabber_models_asl fabber_models_cest fabber_models_dce fabber_models_dsc fabber_models_dualecho fabber_models_dwi fabber_models_pet fabber_models_qbold fabber_models_t1 fast4 fdt feat5 film filmbabe first flameo flirt fnirt fslvbm fugue gps lesions mcflirt melodic misc_scripts miscvis mist mm MSM oxford_asl possum ptx2 qboot randomise siena slicetimer susan swe tbss verbena xtract + # Install missing binaries, which are now Python scripts and shipped with fslpy + /usr/bin/install -m 755 /usr/bin/{imcp,imglob,immv} "${srcdir}"/fsl/bin + # Install missing fsl_sub script from 6.0.4 + /usr/bin/install -m 755 "${srcdir}"/fsl_sub "${srcdir}"/fsl/bin + # Create fake fslpython environment (all dependencies have been taken care of system-wide) + ln -s /usr/bin/python "${srcdir}"/fsl/bin/fslpython } check() { export FSLDIR="${srcdir}/fsl" export FEEDSDIR="${srcdir}/feeds" . "${FSLDIR}/etc/fslconf/fsl.sh" + export PATH="${FSLDIR}/bin":${PATH} cd "${FEEDSDIR}" time ./RUN all } diff --git a/buildSettings.mk b/buildSettings.mk index 52b59563fbb3..d15aada3c4d3 100644 --- a/buildSettings.mk +++ b/buildSettings.mk @@ -44,9 +44,9 @@ INC_GSL = /usr/include/gsl # PNG library LIB_PNG = /usr/lib INC_PNG = /usr/include/libpng16 -# PROB library +# PROB library; added -I${FSLEXTINC} for 6.0.5 LIB_PROB = ${FSLEXTLIB} -INC_PROB = ${FSLEXTINC}/cprob +INC_PROB = ${FSLEXTINC}/cprob -I${FSLEXTINC} # CPROB library LIB_CPROB = ${FSLEXTLIB} INC_CPROB = ${FSLEXTINC}/ @@ -73,51 +73,6 @@ INC_XML++CONF = /usr/lib/libxml++-2.6/include INC_NEWMAT = ${FSLEXTINC}/armawrap/armawrap -DARMA_USE_LAPACK -DARMA_USE_BLAS -DARMA_64BIT_WORD ##################################################################### # -# Darwin specific sys vars and ext libs -# -##################################################################### -ifeq ($(SYSTYPE), Darwin) -############### System Vars ##################################### -CC = cc-9 -CXX = c++-9 -CXX11 = clang++-9 -CSTATICFLAGS = -CXXSTATICFLAGS = -CFLAGS = -std=c99 -ARCHFLAGS = -arch x86_64 -ARCHLDFLAGS = -Wl,-search_paths_first -arch x86_64 -PER_ARCH_CFLAGS_x86_64 = -msse3 -OPTFLAGS = -O3 -GNU_ANSI_FLAGS = -Wall -pedantic -ansi -Wno-long-long -ANSI_CFLAGS = ${GNU_ANSI_FLAGS} -ANSI_CXXFLAGS = ${GNU_ANSI_FLAGS} -ansi -RANLIB = ranlib -############### External Libs ##################################### -# Armadillo library -LIB_NEWMAT = ${FSLEXTLIB} -llapack -lblas -# ZLIB library -LIB_ZLIB = /usr/lib -INC_ZLIB = /usr/include -# QT library -QTDIR = /usr -LIB_QT = ${QTDIR}/lib -INC_QT = ${QTDIR}/include/qt -# VTK library -VTKDIR_INC = /Users/cowboy/VTK7/include/vtk-7.0 -VTKDIR_LIB = /Users/cowboy/VTK7/lib -VTKSUFFIX = -7.0 -# CUDA library -CUDAVER := $(or $(CUDAVER),7.5) -CUDA_INSTALLATION = /Developer/NVIDIA/CUDA-${CUDAVER} -GENCODE_FLAGS = $(shell ${FSLDIR}/config/common/supportedGencodes.sh ${CUDA_INSTALLATION}) -LIB_CUDA = ${CUDA_INSTALLATION}/lib -INC_CUDA = ${CUDA_INSTALLATION}/include -NVCC = ${CUDA_INSTALLATION}/bin/nvcc -#Project specific variables -EDDYBUILDPARAMETERS="cuda=1 CUDAVER=7.5" "cpu=1" -endif # if Darwin -##################################################################### -# # Linux specific sys vars and ext libs # Makefile auto-detects gcc version for Linux # @@ -173,8 +128,8 @@ LIB_NEWMAT = /usr/lib -llapack -lopenblas #Project specific variables EDDYBUILDPARAMETERS = "cuda=1 CUDAVER=8.0" "cuda=1 CUDAVER=9.1" "cpu=1" -fdt_MASTERBUILD = COMPILE_GPU = 1 -ptx2_MASTERBUILD = COMPILE_GPU = 1 +fdt_MASTERBUILD = COMPILE_GPU = 0 +ptx2_MASTERBUILD = COMPILE_GPU = 0 define newline diff --git a/fsl_sub b/fsl_sub new file mode 100644 index 000000000000..cf74a2795289 --- /dev/null +++ b/fsl_sub @@ -0,0 +1,544 @@ +#!/bin/bash + +# Copyright (C) 2007-2017 University of Oxford +# Authors: Dave Flitney, Stephen Smith, Matthew Webster and Duncan Mortimer + +# Part of FSL - FMRIB's Software Library +# http://www.fmrib.ox.ac.uk/fsl +# fsl@fmrib.ox.ac.uk +# +# Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance +# Imaging of the Brain), Department of Clinical Neurology, Oxford +# University, Oxford, UK +# +# +# LICENCE +# +# FMRIB Software Library, Release 6.0 (c) 2018, The University of +# Oxford (the "Software") +# +# The Software remains the property of the Oxford University Innovation +# ("the University"). +# +# The Software is distributed "AS IS" under this Licence solely for +# non-commercial use in the hope that it will be useful, but in order +# that the University as a charitable foundation protects its assets for +# the benefit of its educational and research purposes, the University +# makes clear that no condition is made or to be implied, nor is any +# warranty given or to be implied, as to the accuracy of the Software, +# or that it will be suitable for any particular purpose or for use +# under any specific conditions. Furthermore, the University disclaims +# all responsibility for the use which is made of the Software. It +# further disclaims any liability for the outcomes arising from using +# the Software. +# +# The Licensee agrees to indemnify the University and hold the +# University harmless from and against any and all claims, damages and +# liabilities asserted by third parties (including claims for +# negligence) which arise directly or indirectly from the use of the +# Software or the sale of any products based on the Software. +# +# No part of the Software may be reproduced, modified, transmitted or +# transferred in any form or by any means, electronic or mechanical, +# without the express permission of the University. The permission of +# the University is not required if the said reproduction, modification, +# transmission or transference is done without financial return, the +# conditions of this Licence are imposed upon the receiver of the +# product, and all original and amended source code is included in any +# transmitted product. You may be held legally responsible for any +# copyright infringement that is caused or encouraged by your failure to +# abide by these terms and conditions. +# +# You are not permitted under this Licence to use this Software +# commercially. Use for which any financial return is received shall be +# defined as commercial use, and includes (1) integration of all or part +# of the source code or the Software into a product for sale or license +# by or on behalf of Licensee to third parties or (2) use of the +# Software or any derivative of it for research with the final aim of +# developing software products for sale or license to a third party or +# (3) use of the Software or any derivative of it for research with the +# final aim of developing non-software products for sale or license to a +# third party, or (4) use of the Software to provide any service to an +# external organisation for which payment is received. If you are +# interested in using the Software commercially, please contact Oxford +# University Innovation ("OUI"), the technology transfer company of the +# University, to negotiate a licence. Contact details are: +# fsl@innovation.ox.ac.uk quoting Reference Project 9564, FSL. +export LC_ALL=C +export LC_ALL=C + +########################################################################### +# Edit this file in order to setup FSL to use your local compute +# cluster. +########################################################################### +set +o errexit + +########################################################################### +# The following section determines what to do when fsl_sub is called +# by an FSL program. If SGE_ROOT is set it will attempt to pass the +# commands onto the cluster, otherwise it will run the commands +# itself. There are two values for the METHOD variable, "SGE" and +# "NONE". Note that a user can unset SGE_ROOT if they don't want the +# cluster to be used. +########################################################################### +METHOD=SGE +unset module +if [[ "x$SGE_ROOT" = "x" ]] ; then + METHOD=NONE +else + QCONF=$(which qconf) + if [[ "x$QCONF" = "x" ]]; then + METHOD=NONE + echo "Warning: SGE_ROOT environment variable is set but Grid Engine software not found, will run locally" >&2 + fi +fi + +# stop submitted scripts from submitting jobs themselves +if [[ "X$FSLSUBALREADYRUN" = "Xtrue" ]] ; then + METHOD=NONE + echo "Warning: job on queue attempted to submit parallel jobs - running jobs serially instead" >&2 +fi + +if [[ "X$METHOD" = "XNONE" ]]; then + QCONF=echo +fi +FSLSUBALREADYRUN=true +export FSLSUBALREADYRUN + +########################################################################### +# The following auto-decides what cluster queue to use. The calling +# FSL program will probably use the -T option when calling fsl_sub, +# which tells fsl_sub how long (in minutes) the process is expected to +# take (in the case of the -t option, how long each line in the +# supplied file is expected to take). You need to setup the following +# list to map ranges of timings into your cluster queues - it doesn't +# matter how many you setup, that's up to you. +########################################################################### + +map_qname () +{ + if [[ "$1" -le 20 ]] ; then + queue=veryshort.q + elif [[ "$1" -le 120 ]] ; then + queue=short.q + elif [[ "$1" -le 1440 ]] ; then + queue=long.q + else + queue=verylong.q + fi + queueCmd=" -q $queue " + + #echo "Estimated time was $1 mins: queue name is $queue" +} + +########################################################################### +# Don't change the following (but keep scrolling down!) +########################################################################### + +if [[ ! -z "${POSIXLY_CORRECT}" ]]; then + OLD_POSIXLY_CORRECT=${POSIXLY_CORRECT} +fi + +POSIXLY_CORRECT=1 +export POSIXLY_CORRECT +command=$(basename "$0") + +usage () +{ + cat <<EOF + +$command V1.1 - wrapper for job control system such as SGE + +Usage: $command [options] <command> + +$command gzip *.img *.hdr +$command -q short.q gzip *.img *.hdr +$command -a darwin regscript rawdata outputdir ... + + -T <minutes> Estimated job length in minutes, used to auto-set queue name + -q <queuename> Possible values for <queuename> are "verylong.q", "long.q" + and "short.q". See below for details + Default is "long.q". + -a <arch-name> Architecture [e.g., darwin or lx24-amd64] + -p <job-priority> Lower priority [0:-1024] default = 0 + -M <email-address> Who to email, default = $(whoami)@$(hostname -f | cut -d . -f 2-) + -j <jid> Place a hold on this task until job jid has completed + -t <filename> Specify a task file of commands to execute in parallel + -N <jobname> Specify jobname as it will appear on queue + -R <RAM> Max total RAM to use for job (integer in MB) + -l <logdirname> Where to output logfiles + -m <mailoptions> Change the SGE mail options, see qsub for details + -z <output> If <output> image or file already exists, do nothing and exit + -F Use flags embedded in scripts to set SGE queuing options + -s <pename>,<threads> Submit a multi-threaded task - requires a PE (<pename>) to be + configured for the requested queues. + <threads> specifies the number of threads to run + -v Verbose mode. + +Queues: + +There are several batch queues configured on the cluster, each with defined CPU +time limits. All queues, except bigmem.q, have a 8GB memory limit. + +veryshort.q:This queue is for jobs which last under 30mins. +short.q: This queue is for jobs which last up to 4h. +long.q: This queue is for jobs which last less than 24h. Jobs run with a + nice value of 10. +verylong.q: This queue is for jobs which will take longer than 24h CPU time. + There is one slot per node, and jobs on this queue have a nice value + of 15. +bigmem.q: This queue is like the verylong.q but has no memory limits. + +EOF + + exit 1 +} + +nargs=$# +if [[ "$nargs" -eq 0 ]] ; then + usage +fi + +#if the newer whitespace-safe getopt format is available, use it +if [[ $(getopt -T >/dev/null 2>&1; echo $?) == 4 ]]; then + eval set -- $(getopt -s bash T:q:a:p:M:j:t:z:N:R:Fvm:l:s: "$@") + result=$? +else + set -- $(getopt T:q:a:p:M:j:t:z:N:R:Fvm:l:s: "$@") + result=$? +fi +if [[ "$result" != 0 ]] ; then + echo "What? Your arguments make no sense!" +fi + +if [[ "$nargs" -eq 0 ]] || [[ $result != 0 ]] ; then + usage +fi + +if [[ -z "${OLD_POSIXLY_CORRECT}" ]]; then + unset POSIXLY_CORRECT +else + POSIXLY_CORRECT=${OLD_POSIXLY_CORRECT} + export POSIXLY_CORRECT +fi + +########################################################################### +# If you have a Parallel Environment configured for OpenMP tasks then +# the variable omp_pe should be set to the name you have defined for that +# PE. The script will work out which queues have that PE setup on them. +# Note, we support openmp tasks even when Grid Engine is not in use. +########################################################################### + +omp_pe='openmp' + + +########################################################################### +# If you wish to disable processor affinities under Grid Engine then +# comment the following line. +# This instructs Grid Engine to bind the task to the number of job slots +# allocated to the job (or PE) +########################################################################### +proc_affinities="-binding linear:slots" + + +########################################################################### +# The following sets up the default queue name, which you may want to +# change. It also sets up the basic emailing control. +########################################################################### + +queue=long.q +queueCmd=" -q long.q " +mailto=$(whoami)@$(hostname -f | cut -d . -f 2-) +MailOpts="a" + + +########################################################################### +# In the following, you might want to change the behaviour of some +# flags so that they prepare the right arguments for the actual +# cluster queue submission program, in our case "qsub". +# +# -a sets is the cluster submission flag for controlling the required +# hardware architecture (normally not set by the calling program) +# +# -p set the priority of the job - ignore this if your cluster +# environment doesn't have priority control in this way. +# +# -j tells the cluster not to start this job until cluster job ID $jid +# has completed. You will need this feature. +# +# -t will pass on to the cluster software the name of a text file +# containing a set of commands to run in parallel; one command per +# line. +# +# -N option determines what the command will be called when you list +# running processes. +# +# -l tells the cluster what to call the standard output and standard +# -error logfiles for the submitted program. +########################################################################### + +if [[ -z "$FSLSUBVERBOSE" ]] ; then + verbose=0 +else + verbose=$FSLSUBVERBOSE; + echo "METHOD=$METHOD : args=$*" >&2 +fi + +scriptmode=0 + +while [[ "$1" != -- ]] ; do + case "$1" in + -z) + if [[ -e "$2" || $("${FSLDIR}/bin/imtest" "$2") = 1 ]] ; then + exit 0 + fi + shift;; + -T) + map_qname "$2" + shift;; + -q) + queue="$2" + queueCmd=" -q $queue " + "$QCONF" -sq "$queue" >/dev/null 2>&1 + if [[ $? -eq 1 ]]; then + echo "Invalid queue specified!" + exit 127 + fi + shift;; + -a) + acceptable_arch=no + available_archs=$(qhost | tail -n +4 | awk '{print $2}' | sort | uniq) + for a in $available_archs; do + if [[ "$2" = "$a" ]] ; then + acceptable_arch="yes" + fi + done + if [[ "$acceptable_arch" = "yes" ]]; then + sge_arch="-l arch=$2" + else + echo "Sorry arch of $2 is not supported on this SGE configuration!" + echo "Should be one of: $available_archs" + exit 127 + fi + shift;; + -p) + # Not implmented + shift;; + -M) + mailto=$2 + shift;; + -j) + jid=$2 + sge_hold="-hold_jid $jid" + shift;; + -t) + taskfile=$2 + if [[ -f "$taskfile" ]] ; then + tasks=$(wc -l "$taskfile" | awk '{print $1}') + if [[ "$tasks" -ne 0 ]]; then + sge_tasks="-t 1-$tasks" + else + echo "Task file ${taskfile} is empty" + echo "Should be a text file listing all the commands to run!" + exit -1 + fi + else + echo "Task file (${taskfile}) does not exist" + exit -1 + fi + shift;; + -N) + JobName=$2; + shift;; + -R) + RAM="-l mem_free=${2}M" + shift;; + -m) + MailOpts=$2; + shift;; + -l) + LogOpts="-o $2 -e $2"; + LogDir="${2}/"; + if [[ ! -e "${2}" ]]; then + mkdir -p "$2" + else + echo "${2}" | grep '/dev/null' >/dev/null 2>&1 + if [[ $? -eq 1 ]] && [[ -f "${2}" ]]; then + echo "Log destination is a file (should be a folder)" + exit -1 + fi + fi + shift;; + -F) + scriptmode=1; + ;; + -v) + verbose=1 + ;; + -s) + pe_string=$2; + peName=$(echo "$pe_string" | cut -d',' -f 1) + peThreads=$(echo "$pe_string" | cut -d',' -f 2) + shift;; + esac + shift # next flag +done +shift + +########################################################################### +# Don't change the following (but keep scrolling down!) +########################################################################### +commandline=("$@") +command="${commandline[0]}" + +if [[ -z "$taskfile" ]] && [[ -z "$command" ]]; then + echo "Either supply a command to run or a parallel task file" + exit -1 +fi + +if [[ -z "$taskfile" ]] && [[ ! -x "$command" ]]; then + which "$command" >/dev/null 2>&1 + if [[ $? -ne 0 ]]; then + echo "The command you have requested cannot be found or is not executable" + exit -1 + fi +fi + +if [[ "x$JobName" = x ]] ; then + if [[ "x$taskfile" != x ]] ; then + JobName=$(basename "$taskfile") + else + JobName=$(basename "$command") + fi +fi + +if [[ -n "$tasks" ]] && [[ -n "${commandline[*]}" ]] ; then + echo "Spurious input after parsing command line: \"${commandline[*]}\"!" + echo "You appear to have specified both a task file and a command to run" + exit -1 +fi + +if [[ -n "$peName" ]]; then + # If the PE name is 'openmp' then limit the number of threads to those specified + if [[ "X$peName" = "X$omp_pe" ]]; then + OMP_NUM_THREADS=$peThreads + export OMP_NUM_THREADS + fi +fi + +case "$METHOD" in + +########################################################################### +# The following is the main call to the cluster, using the "qsub" SGE +# program. If $tasks has not been set then qsub is running a single +# command, otherwise qsub is processing a text file of parallel +# commands. +########################################################################### + + SGE) + ########################################################################### + # Test Parallel environment options + ########################################################################### + if [[ -n "$peName" ]]; then + # Is this a configured PE? + + "$QCONF" -sp "$peName" >/dev/null 2>&1 + + if [[ $? -eq 1 ]]; then + echo "${commandline[*]}" + echo "$peName is not a valid PE" + exit -1 + fi + + # Get a list of queues configured for this PE and confirm that the queue + # we have submitted to has that PE set up. + qstat -g c -pe "$peName" >/dev/null 2>&1 + if [[ $? -eq 1 ]]; then + echo "No parallel environments configured!" + exit -1 + fi + + qstat -g c -pe "$peName" | sed '1,2d' | awk '{ print $1 }' | grep "^$queue" >/dev/null 2>&1 + + if [[ $? -eq 1 ]]; then + echo "${commandline[*]}" + echo "PE $peName is not configured on $queue" + exit -1 + fi + + # The -w e option will result in the job failing if there are insufficient slots + # on any of the cluster nodes + pe_options="-pe $peName $peThreads -w e" + fi + + if [[ -z "$tasks" ]] ; then + if [[ "$scriptmode" -ne 1 ]] ; then + sge_command=(qsub -V -cwd -shell n -b y -r y $queueCmd $proc_affinities $pe_options -M $mailto -N "$JobName" -m $MailOpts $LogOpts $sge_arch $RAM $sge_hold) + else + sge_command=(qsub $proc_affinities $LogOpts $sge_arch $sge_hold) + fi + if [[ "$verbose" -eq 1 ]] ; then + echo "sge_command: ${sge_command[*]}" >&2 + echo "executing: ${commandline[*]}" >&2 + fi + exec "${sge_command[@]}" "${commandline[@]}" | awk '{print $3}' + else + sge_command=(qsub -V -cwd $queueCmd $proc_affinities $pe_options -M $mailto -N "$JobName" -m $MailOpts $LogOpts $sge_arch $RAM $sge_hold $sge_tasks) + if [[ "$verbose" -eq 1 ]] ; then + echo "sge_command: ${sge_command[*]}" >&2 + echo "control file: $taskfile" >&2 + fi + exec "${sge_command[@]}" <<EOF | awk '{print $3}' | awk -F. '{print $1}' +#!/bin/sh + +#$ -S /bin/sh + +command=\`sed -n -e "\${SGE_TASK_ID}p" $taskfile\` + +exec /bin/sh -c "\$command" +EOF + fi + ;; + +########################################################################### +# Don't change the following - this runs the commands directly if a +# cluster is not being used. +########################################################################### + + NONE) + if [[ "x$tasks" = "x" ]] ; then + if [[ "$verbose" -eq 1 ]] ; then + echo executing: "${commandline[*]}" >&2 + fi + + "${commandline[@]}" > "${LogDir}${JobName}.o$$" 2> "${LogDir}${JobName}.e$$" + ERR=$? + if [[ "$ERR" -ne 0 ]] ; then + cat "${LogDir}${JobName}.e$$" >&2 + exit $ERR + fi + else + if [[ "$verbose" -eq 1 ]] ; then + echo "Running commands in: $taskfile" >&2 + fi + + n=1 + while [[ "$n" -le "$tasks" ]] ; do + line=$(sed -n -e ''${n}'p' "$taskfile") + if [[ "$verbose" -eq 1 ]] ; then + echo "executing: $line" >&2 + fi + /bin/sh <<EOF2 > "${LogDir}${JobName}.o$$.$n" 2> "${LogDir}${JobName}.e$$.$n" +$line +EOF2 + n=$((n+1)) + done + fi + echo $$ + ;; + +esac + +########################################################################### +# Done. +########################################################################### |