diff --git a/libraries/atlas/README b/libraries/atlas/README index e85cddff90..f8b90a9b83 100644 --- a/libraries/atlas/README +++ b/libraries/atlas/README @@ -2,10 +2,14 @@ ATLAS (Automatically Tuned Linear Algebra Software) is an ongoing research effort focusing on applying empirical techniques in order to provide portable performance. At present, it provides C and Fortran77 interfaces to a portably efficient BLAS implementation, as well as a few -routines from LAPACK. +routines from LAPACK. Nevertheless, by default, this SlackBuild also +builds a full LAPACK linked with ATLAS. If you are really sure that you +don't want this, set LAPACK_SOURCE to the empty string when running this +script. -This conflicts with cblas (only one of atlas and cblas may be installed -at any given time). Take care with LAPACK (see notes 3 & 4 in -README.SLACKWARE). +This conflicts with cblas and lapack (not to be confused with lapack-atlas). +Nevertheless, it should be possible to avoid these conflicts by proper use +of the SYS_DESTDIR variable. -You need to read over README.SLACKWARE *before* building this. +The impatient may just switch CPU throttling off and run the script, but +you are advised to read over README.SLACKWARE *in advance*. diff --git a/libraries/atlas/README.SLACKWARE b/libraries/atlas/README.SLACKWARE index 3d7d9be243..826d5ddcf5 100644 --- a/libraries/atlas/README.SLACKWARE +++ b/libraries/atlas/README.SLACKWARE @@ -1,100 +1,135 @@ -ATLAS (Automatically Tuned Linear Algebra Software) is an ongoing -research effort focusing on applying empirical techniques in order to -provide portable performance. At present, it provides C and Fortran77 -interfaces to a portably efficient BLAS implementation, as well as a few -routines from LAPACK. +IMPORTANT NOTES -IMPORTANT NOTES: +1) The present SlackBuild for ATLAS does by no means try to take into account + all configuration/build issues of ATLAS. Nevertheless, any relevant patches + mentioned in the ATLAS Errata are applied. -1) Please note that the present SlackBuild for ATLAS does by no means - try to take into account all configuration/build issues of ATLAS. - Nevertheless, the relevant patches mentioned in the ATLAS Errata - are applied. +2) The script mostly assumes that you are installing on an x86 or x86_64 + platform and use gcc for compilation. If you decide to use other compilers or + install on another platform, you are unfortunately on your own and welcome to + suggest improvements or patches to this SlackBuild. There is one small + exception to this: the USE_DWALL variable, see below. -2) The script takes advantage of the fact that the compilers shipped with - Slackware should be OK. It also assumes that you are installing on an x86 - or x86_64 platform. If you decide to use other compilers or install on - another platform, you are unfortunately on your own and welcome to suggest - improvements or patches to this SlackBuild. Moreover, there is no "post - install" tuning performed. +3) There is no "post install" tuning performed by this script. -3) ATLAS does not conflict with the reference netlib BLAS (see also note 6). - Nevertheless, if ATLAS got installed successfully you should consider removing - netlib BLAS and (re)compiling every BLAS dependent package (starting with - LAPACK) against ATLAS. Otherwise you may not have much gain from installing - ATLAS and may even get into problems (see next note). +4) ATLAS does not conflict with the reference netlib BLAS. Nevertheless, if + ATLAS got installed successfully you should consider removing netlib BLAS and + (re)compiling every BLAS/LAPACK dependent package. Otherwise you may not have + much gain from installing ATLAS. -4) There is a strong interaction between ATLAS and LAPACK. If you want to install - ATLAS just for testing and avoid problems with LAPACK you are urged to make - use of the SYS_DESTDIR variable as explained later. Otherwise consider the - following: - a) It is not recommended to install LAPACK just along ATLAS, i.e. without building - it against ATLAS. Moreover, if LAPACK is already installed you have to first - remove it and later on build it against ATLAS. - b) If ATLAS+LAPACK doesn't work for you, just stick with (netlib) BLAS+LAPACK. - Netlib BLAS is also available as a SlackBuild. - c) If ATLAS+LAPACK is installed you have to recompile and reinstall LAPACK after - each ATLAS upgrade. +5) There is a strong interaction between ATLAS and LAPACK. By default ATLAS + implements an optimized subset of LAPACK and creates the corresponding static + library. Nevertheles, provided that the full LAPACK source is available, + ATLAS builds a complete LAPACK library linked against its optimized BLAS + implementation. This is what the atlas SlackBuild does by default. You may + decide that you don't what this, then make use of the LAPACK_SOURCE variable + (see below). -5) ATLAS conflicts with cblas. -6) You have to have netlib BLAS installed before you install ATLAS. As stated - above, you should consider removing it from your system afterwards. - -INSTALLATION DETAILS: +INSTALLATION DETAILS 1) Make sure CPU throttling is off before starting the install. This is - important, since ATLAS has to tune itself. + important, since ATLAS has to tune itself. As with Slackware 14.2 you + can run /etc/rc.d/rc.cpufreq as root with "performance" as command line + argument. To reset, run it again with what gets set at boot time (by + default "ondemand") as command line argument. -2) For the same reason, keep the load on the system as low as possible +2) For the same reason, keep the extra load on the system as low as possible while building ATLAS. -3) There are a few extra variables which you may want or need - to give appropriate values when calling the atlas.SlackBuild: - MAX_MALLOC, REF_BLAS, USE_ARCH_DEFAULTS, SYS_DESTDIR and - DEFAULT_DOCS. - MAX_MALLOC is for adjusting the maximal size IN BYTES(!) that ATLAS - is allowed to allocate. According to the ATLAS errata, a too small - value may strongly reduce threaded performance. The default value - within this SlackBuild corresponds to 256MB. (The default value in - the ATLAS source corresponds to 64MB.) +GENERIC SETUP VARIABLES - REF_BLAS defaults to the full path to the netlib BLAS library as - installed from the appropriate SlackBuilds.org script. If you have - the netlib BLAS elsewhere, you have to set the appropriate - value to this variable. - - USE_ARCH_DEFAULTS defaults to "yes", which means that the library - will be optimized by trying to take into account former builds done - on a similar machine. Thus ATLAS will use predefined optimizations - if available. This may reduce (much) the compilation time but may - not give you the best result if you don't use the same compiler - version (gcc 4.2) as the ATLAS author. - Please note that with this variable set to "no", or if there are no - known optimizations for your machine ATLAS compilation lasts for - about three hours! Take a nap :-) - - SYS_DESTDIR is set by default to "/usr" and is the system destination +1) SYS_DESTDIR is set by default to "/usr" and is the system destination directory. When installing the package produced by this SlackBuild, - ATLAS's files will be written to $SYS_DESTDIR/include, + ATLAS's and LAPACK's files will be written to $SYS_DESTDIR/include, $SYS_DESTDIR/include/atlas and $SYS_DESTDIR/lib (or lib64). Documentation files are written to /usr/doc/atlas-$VERSION if not otherwise stated (see below). - You may want to change the value of SYS_DESTDIR to avoid conflicts (see - IMPORTANT NOTES above). IMPORTANT: SYS_DESTDIR has to have an absolute - path as value. + You may want to change the value of SYS_DESTDIR to avoid conflicts. If + you do so, you have to make sure that these libraries and corresponding + headers are found by the compiler or the configuration software used + to build code depending on them. + IMPORTANT: SYS_DESTDIR has to have an absolute path as value. - DEFAULT_DOCS has the default value "yes", which means that docs go - to /usr/doc/atlas-$VERSION, but you may want to let the docs to - go to $SYS_DESTDIR/doc/atlas-$VERSION. For this, just set this - variable to something like "no". +2) DEFAULT_DOCS has the default value "yes", which means that docs go + to /usr/doc/atlas-$VERSION, but you may want to let the docs go + to $SYS_DESTDIR/doc/atlas-$VERSION. For this, just set this + variable to "no". - All these settings may be done the usual way on the command line when - calling this SlackBuild, you do not have to edit the script. -If you also installed the LAPACK linked against ATLAS, consider the following: -"IMPORTANT: If you are actually updating this library, i.e. ATLAS, you MUST also -rebuild and reinstall LAPACK, even if there is no update available for LAPACK! -Otherwise you end up with an broken/incomplete LAPACK library! +SETUP VARIABLES FOR ATLAS + +1) USE_ARCH_DEFAULTS defaults to "yes", which means that the library + will be optimized by trying to take into account former builds done + on a similar machine. Thus ATLAS will use predefined optimizations + if available. This may reduce (much) the compilation time but may + not give you the best result if you don't use the same gcc compiler + version as the ATLAS author. + Please note that with this variable set to "no", or if there are no + known optimizations for your machine ATLAS compilation may last for + many hours! Take a nap :-) + NOTE: On the machine of this SlackBuild's author setting + USE_ARCH_DEFAULTS to "no" provided libraries with definitely + better performance. Compilation took about six hours. + +2) ARCH_DEF_DIR has different meanings, depending on the value of + USE_ARCH_DEFAULTS: + a) If USE_ARCH_DEFAULTS is "yes" and you have some custom architectural + defaults, then you may set this to the absolute path of the directory + containing the file with your custom defaults. + b) If USE_ARCH_DEFAULTS is "no" and you would like to create custom + architectural defaults then set this to the absolute path of the + directory which should contain the file with the custom defaults. + NOTE: Since this file is supposed to survive an upgrade, it doesn't + get included in the Slackware package. You have to remove it + by hand, if needed. A file named "ARCH_DEF_DIR" gets written + to the documentation directory, to remind you where the created + architectural defaults are. Make a backup of it, since it may + get deleted with an upgrade. + ARCH_DEF_DIR defaults to the empty string, which means that neither your + custom defaults are used nor custom defaults are created. + +3) USE_DWALL defaults to "no" which should be OK for x86 or x86_64 and the gcc + compiler. If you are on another architecture than x86 and/or don't use gcc + you need to set it to "yes". + +4) L2_CACHE_SIZE provides the size of the level 2 cache in bytes. By default it + is deduced from /proc/cpuinfo but you can just set the value manually, if you + wish or need so. + +5) NUM_THREADS allows you to set the maximum number of threads. By default it + is "-1", which means autodection. In this case it gets set equal to the + number of available processors. + +6) USE_PROCESSORS is by default the empty string, which means that any of the + available processors may be used. Nevertheless, under some circumstances, + one may want to specify the processor IDs, e.g. "0 2 4". Please consult + atlas_install.pdf, p. 13 for more informations. + NOTES: a) This is incompatible with the autodetection of the number of + threads. Therefore NUM_THREADS must be greater than 1. + b) Write just the processor IDs to this string, the script takes + care of the rest. Take care to have NUM_THREADS equal to the + amount of processor IDs. + +7) SHARED_SWITCH is set by default to ask for building shared libs along with + the static ones. Set this to the empty string, if you don't want to have + shared libs. + + +SETUP VARIABLES FOR LAPACK + +1) LAPACK_SOURCE set this variable to the empty string, if you don't want for a + full LAPACK library to get build. + +2) TEST_LAPACK set this variable to "yes" if you would like to run the LAPACK + tests. You will find the results of the tests in the documentation directory. + This has no relevance, if you didn't allow for a full LAPACK build. + +3) LAPACK_TIMER sets the timer to be used for LAPACK. If you stay with + gfortran, presently the default compiler on Slackware, you can leave the + value as is. Otherwise, set it to "NONE" or read LAPACK's make.inc.example + for more informations. + This has no relevance, if you didn't allow for a full LAPACK build. + diff --git a/libraries/atlas/TimingResults.txt b/libraries/atlas/TimingResults.txt new file mode 100644 index 0000000000..4cc33c0093 --- /dev/null +++ b/libraries/atlas/TimingResults.txt @@ -0,0 +1,62 @@ +MACHINE: Intel Core2 Duo T9600 @ 2.80GHz +COMPILER: gcc 5.3.0 (as shipped with Slackware Linux 14.2) + +The times labeled Reference are for ATLAS as installed by the authors. +NAMING ABBREVIATIONS: + kSelMM : selected matmul kernel (may be hand-tuned) + kGenMM : generated matmul kernel + kMM_NT : worst no-copy kernel + kMM_TN : best no-copy kernel + BIG_MM : large GEMM timing (usually N=1600); estimate of asymptotic peak + kMV_N : NoTranspose matvec kernel + kMV_T : Transpose matvec kernel + kGER : GER (rank-1 update) kernel +Kernel routines are not called by the user directly, and their +performance is often somewhat different than the total +algorithm (eg, dGER perf may differ from dkGER) + + +AFTER A PARTIAL SEARCH, ARCH IDENTIFIED AS Core232SSE3 +====================================================== + +Reference clock rate=2493Mhz, new rate=2801Mhz + Refrenc : % of clock rate achieved by reference install + Present : % of clock rate achieved by present ATLAS install + + single precision double precision + ******************************** ******************************* + real complex real complex + --------------- --------------- --------------- --------------- +Benchmark Refrenc Present Refrenc Present Refrenc Present Refrenc Present +========= ======= ======= ======= ======= ======= ======= ======= ======= + kSelMM 578.5 363.2 564.7 577.7 334.6 352.5 325.1 336.5 + kGenMM 156.3 101.2 156.5 102.0 159.9 159.2 161.7 97.3 + kMM_NT 134.3 125.8 133.0 127.1 151.6 140.7 151.2 152.9 + kMM_TN 154.8 101.3 152.6 101.1 142.4 90.8 149.7 94.2 + BIG_MM 554.0 350.7 554.6 352.2 318.9 330.7 312.3 324.5 + kMV_N 63.6 71.7 106.8 62.5 29.7 40.3 56.5 71.8 + kMV_T 64.7 74.7 108.0 79.3 32.5 44.9 60.5 65.8 + kGER 45.9 37.9 88.6 61.2 22.1 19.7 45.5 44.5 + + +AFTER A FULL SEARCH +=================== + +Reference clock rate=2493Mhz, new rate=2801Mhz + Refrenc : % of clock rate achieved by reference install + Present : % of clock rate achieved by present ATLAS install + + single precision double precision + ******************************** ******************************* + real complex real complex + --------------- --------------- --------------- --------------- +Benchmark Refrenc Present Refrenc Present Refrenc Present Refrenc Present +========= ======= ======= ======= ======= ======= ======= ======= ======= + kSelMM 578.5 624.7 564.7 572.9 334.6 347.2 325.1 334.3 + kGenMM 156.3 156.0 156.5 155.4 159.9 163.2 161.7 163.2 + kMM_NT 134.3 104.8 133.0 96.9 151.6 140.5 151.2 144.5 + kMM_TN 154.8 170.8 152.6 163.5 142.4 122.0 149.7 127.9 + BIG_MM 554.0 527.8 554.6 558.3 318.9 331.3 312.3 331.0 + kMV_N 63.6 72.1 106.8 118.8 29.7 44.8 56.5 79.1 + kMV_T 64.7 78.8 108.0 134.4 32.5 45.5 60.5 88.3 + kGER 45.9 40.2 88.6 74.6 22.1 21.7 45.5 44.8 diff --git a/libraries/atlas/atlas.SlackBuild b/libraries/atlas/atlas.SlackBuild index de0eff3b2f..2be0b386e8 100644 --- a/libraries/atlas/atlas.SlackBuild +++ b/libraries/atlas/atlas.SlackBuild @@ -2,7 +2,7 @@ # Slackware build script for ATLAS -# Copyright 2010 Serban Udrea +# Copyright 2010-2016 Serban Udrea # All rights reserved. # # Redistribution and use of this script, with or without modification, @@ -24,15 +24,15 @@ # POSSIBILITY OF SUCH DAMAGE. PRGNAM=atlas -VERSION=${VERSION:-3.8.3} -BUILD=${BUILD:-2} +VERSION=${VERSION:-3.10.3} +BUILD=${BUILD:-1} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then case "$( uname -m )" in - i?86) ARCH=i486 ;; + i?86) ARCH=i586 ;; arm*) ARCH=arm ;; - *) ARCH=$( uname -m ) ;; + *) ARCH="$( uname -m )" ;; esac fi @@ -41,8 +41,8 @@ TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} -if [ "$ARCH" = "i486" ]; then - SLKCFLAGS="-O2 -march=i486 -mtune=i686" +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" BITSize="32" # Specifically for ATLAS elif [ "$ARCH" = "i686" ]; then @@ -55,26 +55,126 @@ elif [ "$ARCH" = "x86_64" ]; then BITSize="64" # Specifically for ATLAS fi -# You may change this to adjust the maximal size IN BYTES(!) that ATLAS -# is allowed to allocate. According to the ATLAS errata, a too small -# value may strongly reduce threaded performance. The default value -# here is 256MB. (The default value in the ATLAS source is 64MB.) -# -MAX_MALLOC=${MAX_MALLOC:-268435456} - # If you don't want to use architectural defaults set the following to # something like "no". +# USE_ARCH_DEFAULTS=${USE_ARCH_DEFAULTS:-yes} -# The path to a reference BLAS library. By default it is assumed that you -# have installed the netlib BLAS reference using the appropriate slackbuild -# from slackbuilds.org. If this is not the case, you have to run this script -# with another value for REF_BLAS. -REF_BLAS=${REF_BLAS:-/usr/lib${LIBDIRSUFFIX}/libblas.a} +# If you decide to use arch defaults and have some custom ones you may +# set the following variable to point to the directory containing these. +# +# If you decide to not use arch defauts and wish to create some after a build +# with full search, set the following variable to point to the directory where +# the file containing them should be placed. +# IMPORTANT: In this case, the file copied to ARCH_DEF_DIR will not be part of +# the ATLAS package, to avoid problems in case of an upgrade on the +# same machine. The value of ARCH_DEF_DIR will be written for your +# reference to the file named ARCH_DEF_DIR within the doc directory +# of ATLAS. +# +ARCH_DEF_DIR=${ARCH_DEF_DIR:-""} -# Let's do a little check (that we deal with a regular file we can read). -[ -f "$REF_BLAS" -a -r "$REF_BLAS" ] || \ -{ echo "ERROR: Wrong path to reference BLAS library, exiting! " && exit 1; } +# If you are on another architecture than x86 and/or don't use gcc you need to +# set the following variable to "yes". +# +USE_DWALL=${USE_DWALL:-no} + +# You may wish to set the level 2 cache size to the proper value. The default +# is to deduce it from /proc/cpuinfo +# +L2_CACHE_SIZE=${L2_CACHE_SIZE:-"auto"} + +if [ "$L2_CACHE_SIZE" = "auto" ]; then + L2_CACHE_SIZE="$(cat /proc/cpuinfo |grep "cache size"| head -n 1| cut -d ":" -s -f2| cut -d " " -s -f2)" + L2_SIZE_UNIT="$(cat /proc/cpuinfo |grep "cache size"| head -n 1| cut -d " " -s -f4)" + case "$L2_SIZE_UNIT" in + "KB") L2_CACHE_SIZE=$(($L2_CACHE_SIZE * 1024)) + ;; + "MB") L2_CACHE_SIZE=$(($L2_CACHE_SIZE * 1024 * 1024)) + ;; + "GB") L2_CACHE_SIZE=$(($L2_CACHE_SIZE * 1024 * 1024 * 1024)) + ;; + esac +fi + +# Check the value of L2_CACHE_SIZE +# +case "$L2_CACHE_SIZE" in + ''|'0'|*[!0-9]*) echo "ERROR: The value of L2_CACHE_SIZE is not a strictly positive integer!" + exit 1 + ;; +esac + +# Set the (maximum) number of threads. If this is 0 just the serial libs get +# built, even on an SMP machine. By default it's set to -1 for autodetection. +# +NUM_THREADS=${NUM_THREADS:-"-1"} +case "$NUM_THREADS" in + '-1'|'0') echo -n # Do nothing + ;; + '1') NUM_THREADS="0" # One processor => no threading + ;; + ''|*[!0-9]*) echo "ERROR: NUM_THREADS has an improper value!" + exit 1 + ;; +esac + +if [ $NUM_THREADS -gt 1 ]; then + # On SMP machines one may want to set the processors to be used (see + # atlas_install.pdf, p. 13). By default the list of processor ID's is empty + # which means that ATLAS may use whatever is available. + # NOTE: This is incompatible with the autodetection of the number of threads. + # Therefore NUM_THREADS must be greater than 1. + # + USE_PROCESSORS=${USE_PROCESSORS:-""} + if [ -z "$USE_PROCESSORS" ]; then + MT_SWITCH="-t $NUM_THREADS" + else + MT_SWITCH="--force-tids=\"$NUM_THREADS $USE_PROCESSORS\"" + fi +else + MT_SWITCH="-t $NUM_THREADS" +fi + +# Decide upon building full LAPACK or not. Set LAPACK_SOURCE to the empty +# string, if you don't want a full LAPACK build. +# +LAPACK_SOURCE=${LAPACK_SOURCE:-"/usr/share/lapack-atlas/lapack.tgz"} +if [ -z "$LAPACK_SOURCE" ]; then + echo + echo "WARNING" + echo "WARNING: No LAPACK source specified. Just the highly restricted LAPACK" + echo " offered by ATLAS will get compiled!" + echo "WARNING" + echo + sleep 3 +else + tar -tf "$LAPACK_SOURCE" > /dev/null 2>&1 || \ + { echo "ERROR: Improper LAPACK source archive!" \ + && echo " Please check $LAPACK_SOURCE" \ + && echo " and set it properly! " \ + && exit 1; } # NOTE: Here we just test that we deal with a tar archive. + LAPACK_SOURCE="--with-netlib-lapack-tarfile=$LAPACK_SOURCE" + + # Change the following to yes if you would like to run the tests for LAPACK. + # + TEST_LAPACK="${TEST_LAPACK:-no}" + # Make Y or N out of yes, Yes, No, no, etc. + # + TEST_LAPACK=$(echo "$TEST_LAPACK"|cut -b 1|tr a-z A-Z) +fi + +# Decide upon building shared libraries or not. By default we ask for shared +# libs too. If one doesn't want this, she has to just set SHARED_SWITCH to the +# empty string. +# +SHARED_SWITCH=${SHARED_SWITCH:-"--shared"} + +# This is the timer to be used for LAPACK. If you stay with gfortran, +# presently the default compiler on Slackware, you can leave the value as is. +# Otherwise, please read LAPACK's make.inc.example for more informations. +# +LAPACK_TIMER="${LAPACK_TIMER:-INT_ETIME}" # This is the system destination directory. When installing the # package produced by this script, ATLAS's files will be written to @@ -88,6 +188,7 @@ SYS_DESTDIR=${SYS_DESTDIR:-/usr} # Check if SYS_DESTDIR is an absolute path. If not, exit with error. # NOTE: The $ is used because echo adds a \n at the end of the string. +# echo $SYS_DESTDIR | grep -vE '/\.\./|/\.\.$' | grep -qE '^/' || \ { echo "ERROR: The system destination directory has no absolute path!" \ && echo " The value of SYS_DESTDIR is $SYS_DESTDIR" \ @@ -103,12 +204,10 @@ DEFAULT_DOCS=${DEFAULT_DOCS:-yes} # The build directory to be created within the source directory of # ATLAS. -BLDdir=BuildDir +# +BLDdir="BuildDir" -# Get the CPU frequency for good timing. -CPU_FREQ="$(cat /proc/cpuinfo |grep "cpu MHz"| head -n 1| cut -d ":" -s -f2| tr -d [:blank:])" - -set -e +set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT @@ -118,22 +217,22 @@ rm -rf $PRGNAM-$VERSION tar xvf $CWD/${PRGNAM}${VERSION}.tar.bz2 mv ATLAS $PRGNAM-$VERSION cd $PRGNAM-$VERSION - chown -R root:root . - find -L . \ - \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \ - -exec chmod 755 {} \; -o \ - \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ - -exec chmod 644 {} \; + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -# Make changes as suggested in the atlas errata. -cat $CWD/atlas.patch | sed -e s%XXX_MaxMalloc_XXX%$MAX_MALLOC% | patch -p1 - -# If architectural defaults are to be used, copy the file mentioned in the errata -# to the architectural defaults directory. +# Set the proper value to USE_ARCH_DEFAULTS, and the proper value to the +# configure switch needed in case you want to use custom arch defaults. +# +ARCH_DIR_SWITCH="" case "$USE_ARCH_DEFAULTS" in - [yY]|[yY][eE]|[yY][eE][sS]) cp "$CWD/AMD64K10h64SSE3.tgz" CONFIG/ARCHS; USE_ARCH_DEFAULTS="1" ;; + [yY]|[yY][eE]|[yY][eE][sS]) USE_ARCH_DEFAULTS="1" + [ -z "$ARCH_DEF_DIR" ] || \ + ARCH_DIR_SWITCH="-Ss ADdir $ARCH_DEF_DIR" + ;; *) USE_ARCH_DEFAULTS="0" ;; esac @@ -141,97 +240,185 @@ mkdir -p $BLDdir cd $BLDdir # Configure atlas. -# IMPORTANT: Here we assume that we are on a x86 machine (be it 32 or 64 bits) -# and gcc or icc is the compiler to be used. This should be presently -# a reasonable assumption with Slackware. Under other circumstances -# "-DPentiumCPS=$CPU_FREQ" has to be exchanged with "-DWALL". # -../configure -Si cputhrchk 0 -Si archdef "$USE_ARCH_DEFAULTS" -b "$BITSize" -D c \ --DPentiumCPS="$CPU_FREQ" -Fa alg -fPIC +case "$USE_DWALL" in + [yY]|[yY][eE]|[yY][eE][sS]) + # Here we assume that we aren't on a x86 machine + # and/or gcc isn't the compiler to be used. + # + ../configure $SHARED_SWITCH \ + --prefix="$SYS_DESTDIR" \ + $LAPACK_SOURCE \ + $MT_SWITCH \ + -Si archdef "$USE_ARCH_DEFAULTS" \ + $ARCH_DIR_SWITCH \ + -b "$BITSize" -D c -DWALL + ;; + *) + # Here we assume that we are on a x86 machine + # (be it 32 or 64 bits) and gcc is the compiler + # to be used. + # + # Get the CPU frequency for good timing. + # + CPU_FREQ="$(cat /proc/cpuinfo |grep "cpu MHz"| head -n 1| cut -d ":" -s -f2| tr -d [:blank:])" + # + ../configure $SHARED_SWITCH \ + --prefix="$SYS_DESTDIR" \ + $LAPACK_SOURCE \ + $MT_SWITCH \ + -Si archdef "$USE_ARCH_DEFAULTS" \ + $ARCH_DIR_SWITCH \ + -b "$BITSize" \ + -D c -DPentiumCPS="$CPU_FREQ" + ;; +esac -# NOTES ON THE FLAGS FOR CONFIGURE +# NOTES ON SOME FLAGS FOR CONFIGURE # -# -Si cputhrchk 0 means that configure actually does not care about CPU -# throttling. This is to avoid false positives. Thus the full responsibility -# stays now with the user of the script. +# SHARED_SWITCH = "--shared" asks for building the shared libraries too # -Si archdef "$USE_ARCH_DEFAULTS" means that we ignore or not architectural defaults depending # upon the value of "$USE_ARCH_DEFAULTS". # -b "$BITSize" tells ATLAS about the platform's bitsize, 32 or 64. -# -D c -DPentiumCPS="$CPU_FREQ" is for achieving good timing on x86 platforms with gcc or icc. -# -Fa alg -fPIC is for beeing able to create dynamic libs too. +# -D c -DPentiumCPS="$CPU_FREQ" is for achieving good timing on x86 platforms with gcc. +# -D c -DWALL is for achieving good timing on non x86 platforms and/or non gcc compilers -# The next two variables are set and their values are finally saved -# for using them to compile lapack. -# Remember the compiler name. -ATLAS_COMPILER="$(grep "F77 =" Make.inc | cut -d "=" -f1 --complement)" +# Write the value of L2_CACHE_SIZE to Make.inc +# +sed -i -r Make.inc -e \ + "s%L2SIZE = -DL2SIZE=[0-9]+%L2SIZE = -DL2SIZE=$L2_CACHE_SIZE%" -# Remember the fortran compilation flags. -ATLAS_F77FLAGS="$(grep "F77FLAGS =" Make.inc | cut -d "=" -f1 --complement)" +# Allow for deprecated LAPACK routines to get build in case of a full LAPACK +# installation. Also set the LAPACK timer to the desired value and add +# -frecursive to the compile flags, since this should help avoid problems +# with some functions which seem otherwise to not be thread safe. +# +if [ "$LAPACK_SOURCE" ]; then + sed -i ./src/lapack/reference/make.inc.example -e \ + "s%^#MAKEDEPRECATED *=.*Yes%MAKEDEPRECATED = Yes%" + sed -i ./interfaces/lapack/F77/src/Makefile -e \ + "s%NONE%$LAPACK_TIMER%" -e \ + "s%F77FLAGS)@%F77FLAGS) -frecursive@%" -e \ + "s%F77NOOPT)@%F77NOOPT) -frecursive@%" +fi -# Set the path to the reference BLAS. -sed -i -e '/^ \+BLASlib/s%BLASlib = .*%BLASlib = '"$REF_BLAS"% \ - Make.inc - -make -j1 +make build make check # If parallel libraries have been compiled check them too. +# if [ -f lib/libptcblas.a ]; then make ptcheck - PARALLEL_LIBS="yes" # We will use this when creating dynamic libs. fi -# Install the static libs created during the build process. -make install DESTDIR=$PKG$SYS_DESTDIR +# If the full LAPACK got build one may wish to test it too. +# +if [ "$LAPACK_SOURCE" ]; then + if [ "$TEST_LAPACK" = "Y" ]; then + ( cd src/lapack/reference + [ -e ./libtmglib.a ] || make tmglib + # Some testers segfault when build with -frecursive if one doesn't + # increase the stack size limit, thus it's better to remove this flag + # from make.inc + # + sed -i make.inc -e "s%-frecursive%%" -# Go to the ATLAS $BLDdir/lib directory and try to create and install -# the dynamic libraries. -# NOTE: The test for the presence of static parallel libs and the command to actually build the -# shared parallel libs are connected by a logical OR to make sure that the subshell -# does not exit with non-zero error code just because static parallel libs didn't -# get built. Therefore the test is successful if the variable PARALLEL_LIBS is unset or -# empty, i.e. when no static parallel libs got built. -( cd lib && make shared && \ - { [ "${PARALLEL_LIBS}1" = "1" ] || make ptshared; } && \ - cp -p *.so "$PKG$SYS_DESTDIR/lib" -) + # Now we have to set the proper library paths. Here for the serial libs. + # + ATLAS_LIBS="../../../../../lib/libf77blas.a ../../../../../lib/libcblas.a" + ATLAS_LIBS="$ATLAS_LIBS ../../../../../lib/libatlas.a" + LAPACK_LIB="../../../lib/liblapack.a" + + sed -i make.inc -e \ + "s%^BLASLIB *=.*%BLASLIB = $ATLAS_LIBS%" -e \ + "s%^CBLASLIB *=.*%CBLASLIB =%" -e \ + "s%^LAPACKLIB *=.*%LAPACKLIB = $LAPACK_LIB%" + + # Perform the tests. + # + make lapack_testing + + # Put the test results together + # + tar czf TEST_SERIAL_RESULTS.tgz TESTING/*.out + + # If threaded libs got build, we repeat the tests with them. + # + if [ -e ../../../lib/libptlapack.a ]; then + make cleantesting + ATLAS_LIBS="../../../../../lib/libptf77blas.a" + ATLAS_LIBS="$ATLAS_LIBS ../../../../../lib/libptcblas.a" + ATLAS_LIBS="$ATLAS_LIBS ../../../../../lib/libatlas.a -lpthread" + LAPACK_LIB="../../../lib/libptlapack.a" + sed -i make.inc -e \ + "s%^BLASLIB *=.*%BLASLIB = $ATLAS_LIBS%" -e \ + "s%^LAPACKLIB *=.*%LAPACKLIB = $LAPACK_LIB%" + make lapack_testing + tar czf TEST_PT_RESULTS.tgz TESTING/*.out + fi + ) + fi +fi + +make install DESTDIR=${PKG}${SYS_DESTDIR} + +# The install script (sometimes) "forgets" about libptlapack.a +# +cp -ua lib/libptlapack.a ${PKG}${SYS_DESTDIR}/lib/ || true find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true # This is probably the easiest way to make sure that we install in the # proper place. -if [ ! -z $LIBDIRSUFFIX ]; then - mv $PKG$SYS_DESTDIR/lib $PKG$SYS_DESTDIR/lib${LIBDIRSUFFIX} +# +if [ "$LIBDIRSUFFIX" ]; then + mv ${PKG}${SYS_DESTDIR}/lib ${PKG}${SYS_DESTDIR}/lib${LIBDIRSUFFIX} fi # Create the doc directory for atlas and populate it. +# case "$DEFAULT_DOCS" in [nN]|[nN][oO]) DOC_DIR="$PKG$SYS_DESTDIR/doc/$PRGNAM-$VERSION" ;; *) DOC_DIR="$PKG/usr/doc/$PRGNAM-$VERSION" ;; esac - -mkdir -p $DOC_DIR -cp -a ../INSTALL.txt ../README ../doc $DOC_DIR - -# The following makefiles may be needed to merge atlas and lapack. -mkdir $DOC_DIR/MAKEFILES -cp -p Make.inc $DOC_DIR/MAKEFILES -cp -p lib/Makefile $DOC_DIR/MAKEFILES/Makefile.lib - -# Create a file with the build flags for atlas. Needed to merge -# ATLAS and LAPACK. The LAPACK SlackBuild will just have to source -# this file to find out the compiler used for ATLAS and the build -# flags. -echo "ATLAS_COMPILER=\"$ATLAS_COMPILER\"" > "$DOC_DIR/SETTINGS" -echo "ATLAS_F77FLAGS=\"$ATLAS_F77FLAGS\"" >> "$DOC_DIR/SETTINGS" -sed -i -e s'%=" %="%' "$DOC_DIR/SETTINGS" # Remove the extra space after the "=" sign -echo "ATLAS_NOOPT=\"-O0\" #Eventually add more options within the quotes." >> "$DOC_DIR/SETTINGS" +mkdir -p ${DOC_DIR} +cp -a ../INSTALL.txt ../README ../doc ${DOC_DIR} # Add the Slackbuild script and README.SLACKWARE to the docs. +# cat $CWD/$PRGNAM.SlackBuild > $DOC_DIR/$PRGNAM.SlackBuild cat $CWD/README.SLACKWARE > $DOC_DIR/README.SLACKWARE +# Create custom arch defaults if appropriate. +# +if [ "$USE_ARCH_DEFAULTS" = "0" ]; then + if [ "$ARCH_DEF_DIR" ]; then + ( cd ARCHS + make ArchNew + make tarfile + cp -ua *.tar.* "$ARCH_DEF_DIR" + ) + echo "$ARCH_DEF_DIR" > $DOC_DIR/ARCH_DEF_DIR + fi +fi + +# If the full LAPACK got installed add also some relevant files from its source +# tree. +# +if [ "$LAPACK_SOURCE" ]; then + ( cd src/lapack/reference + LAPACK_VER=$(./INSTALL/testversion | sed -e "s% *LAPACK *%%" -e "s% *%%g") + LAPACK_DOC_DIR="${DOC_DIR}/lapack-$LAPACK_VER" + mkdir "$LAPACK_DOC_DIR" + cp -a LICENSE README "$LAPACK_DOC_DIR" + + # Copy the test results if present (getting around "set -e" with "echo -n"). + # + cp -a TEST_* "$LAPACK_DOC_DIR" 2>/dev/null || echo -n + ) +fi + mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc diff --git a/libraries/atlas/atlas.info b/libraries/atlas/atlas.info index fda3ce6193..72483a6644 100644 --- a/libraries/atlas/atlas.info +++ b/libraries/atlas/atlas.info @@ -1,10 +1,10 @@ PRGNAM="atlas" -VERSION="3.8.3" +VERSION="3.10.3" HOMEPAGE="http://math-atlas.sourceforge.net/" -DOWNLOAD="http://downloads.sourceforge.net/math-atlas/atlas3.8.3.tar.bz2" -MD5SUM="6c13be94a87178e7582111c08e9503bc" +DOWNLOAD="http://downloads.sourceforge.net/math-atlas/atlas3.10.3.tar.bz2" +MD5SUM="d6ce4f16c2ad301837cfb3dade2f7cef" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="blas" +REQUIRES="lapack-atlas" MAINTAINER="Serban Udrea" EMAIL="S.Udrea@gsi.de" diff --git a/libraries/atlas/slack-desc b/libraries/atlas/slack-desc index c89025ef9f..daf3b9068f 100644 --- a/libraries/atlas/slack-desc +++ b/libraries/atlas/slack-desc @@ -12,8 +12,8 @@ atlas: This is ATLAS (Automatically Tuned Linear Algebra Software), an atlas: ongoing research effort focusing on applying empirical techniques in atlas: order to provide portable performance. At present, it provides C and atlas: Fortran77 interfaces to a portably efficient BLAS implementation as -atlas: well as a few routines from LAPACK. +atlas: well as a few routines from LAPACK. Nevertheless, the default setting +atlas: for Slackware is to allow for a full LAPACK to get build and installed +atlas: along with ATLAS. atlas: atlas: Homepage: http://math-atlas.sourceforge.net/ -atlas: -atlas: