[Debian-med-packaging] Bug#756392: enable SIMD and threading support
Andreas Tille
andreas at an3as.eu
Fri Oct 10 09:49:01 UTC 2014
On Fri, Oct 10, 2014 at 10:50:18AM +0200, Elmar Pruesse wrote:
> >>> http://anonscm.debian.org/viewvc/debian-med/trunk/packages/raxml/trunk/debian/bin/raxmlHPC?view=markup
>
> #!/bin/sh
> 2
> 3 RAXMLDIR=`dirname $0`
>
> This won't work in the presence of symlinks. E.g. if the script is in
> /usr/lib/raxml/raxmlHPC and linked to /usr/bin/raxml, RAXMLDIR will be
> /usr/bin, not /usr/lib/raxml.
>
> Better would be:
> RAXMLDIR="$(dirname -- "$(readlink -f -- "$0")")"
>
> (Your solution will work with the current layout, but it's safer to
> always assume symlinks and spaces in directories/filenames)
Fixed in SVN - feel free to inject this yourself. There is no need that
you restrict yourself only to arb.
>
> 4 NPROCESSOR=`grep -c 'processor[[:space:]:]\+[0-9]\+' /proc/cpuinfo`
> 5 NCPUS=`grep '^cpu cores' /proc/cpuinfo | head -n 1 | sed 's/cpu
> cores[[:space:]:]\+//'`
> 6 # That's wrong and lasts way longer than when using NCPUS
> 7 # AVX_T=$((NPROCESSOR * NCPUS))
> 8 AVX_T=$NCPUS
>
> Linux shows each "virtual CPU", so cores or hyperthreading units as
> "processor". If you run anything with more threads than available CPUs,
> it will become slower. Often, best performance is achieved with less
> than number-of-processing-units threads. For RAxML, a good heuristic is
> 1 thread per 500bp, which could be extracted from the input data. Have a
> look at the arb_raxml8.sh script in ARB -- it does just that.
>
>
> 10 if grep -q avx /proc/cpuinfo; then
> 11 if echo "$@" | grep -q -- '-T[[:space:]]*[0-9]' ; then
> 12 echo "Use raxml with AVX support with overriden number of threads"
> 13 ${RAXMLDIR}/raxmlHPC-PTHREADS-AVX "$@"
> 14 else
> 15 echo "Use raxml with AVX support ($AVX_T cpus)"
> 16 ${RAXMLDIR}/raxmlHPC-PTHREADS-AVX -T $AVX_T "$@"
> 17 fi
> 18 elif grep -q sse3 /proc/cpuinfo; then
> 19 if echo "$@" | grep -q -- '-T[[:space:]]*[0-9]' ; then
> 20 echo "Use raxml with SSE3 support with overriden number of threads"
> 21 ${RAXMLDIR}/raxmlHPC-PTHREADS-SSE3 "$@"
> 22 else
> 23 echo "Use raxml with SSE3 support ($AVX_T cpus)"
> 24 ${RAXMLDIR}/raxmlHPC-PTHREADS-SSE3 -T $AVX_T "$@"
> 25 fi
> 26 else
> 27 echo "Use raxml with PTHREADS support"
> 28 ${RAXMLDIR}/raxmlHPC-PTHREADS "$@"
> 29 fi
>
> Adding "-T x" should be done for all three variants if not configured by
> the user. So it can be done beforehand:
>
> THREADOPT=""
> if echo "$@" | grep -q -- '-T[[:space:]]*[0-9]'; then
> THREADOPT="-T `grep -c 'processor[[:space:]:]\+[0-9]\+' /proc/cpuinfo`"
> fi
>
> if grep -q avx /proc/cpuinfo; then
> "${RAXMLDIR}/raxmlHPC-PTHREADS-AVX" ${THREADOPT} "$@"
> elif ...
> ...
> else
> ...
> fi
Would you mind injecting this directly to
svn+ssh://svn.debian.org/svn/debian-med/trunk/packages/raxml/trunk/debian/bin/raxmlHPC
Thanks a lot
Andreas.
--
http://fam-tille.de
More information about the Debian-med-packaging
mailing list