atlas: allow users to override the CPU configuration used to build ATLAS
This commit is contained in:
parent
3334f33daf
commit
83df975ba8
@ -1,4 +1,24 @@
|
|||||||
{ stdenv, fetchurl, gfortran, tolerateCpuTimingInaccuracy ? true, shared ? false }:
|
{ stdenv, fetchurl, gfortran, tolerateCpuTimingInaccuracy ? true, shared ? false
|
||||||
|
, cpuConfig ? if stdenv.isi686 then "-b 32 -A 18 -V 1" else "-b 64 -A 31 -V 192"
|
||||||
|
}:
|
||||||
|
|
||||||
|
# Atlas detects the CPU and optimizes its build accordingly. This is great when
|
||||||
|
# the code is run on the same machine that built the binary, but in case of a
|
||||||
|
# central build farm like Hydra, this feature is dangerous because the code may
|
||||||
|
# be generated utilizing fancy features that users who download the binary
|
||||||
|
# cannot execute.
|
||||||
|
#
|
||||||
|
# To avoid these issues, the build is configured using the 'cpuConfig'
|
||||||
|
# parameter as follows:
|
||||||
|
#
|
||||||
|
# | x86 CPU | x86_64 CPU |
|
||||||
|
# |---------------------------------------------+------------------------|
|
||||||
|
# | -b 32 | -b 64 |
|
||||||
|
# | -A 18 (Pentium II) | -A 31 (Athlon K7) |
|
||||||
|
# | -V 1 (No SIMD: Pentium II doesn't have SSE) | -V 192 (SSE1 and SSE2) |
|
||||||
|
#
|
||||||
|
# Users who want to compile a highly optimized version of ATLAS that's suitable
|
||||||
|
# for their local machine can override these settings accordingly.
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "3.10.1";
|
version = "3.10.1";
|
||||||
@ -15,6 +35,8 @@ stdenv.mkDerivation {
|
|||||||
sha256 = "11ncgdc7kzb2y2gqb3sgarm5saj9fr07r3h2yh2h5bja429b85d2";
|
sha256 = "11ncgdc7kzb2y2gqb3sgarm5saj9fr07r3h2yh2h5bja429b85d2";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
buildInputs = [ gfortran ];
|
||||||
|
|
||||||
# Atlas aborts the build if it detects that some kind of CPU frequency
|
# Atlas aborts the build if it detects that some kind of CPU frequency
|
||||||
# scaling is active on the build machine because that feature offsets the
|
# scaling is active on the build machine because that feature offsets the
|
||||||
# performance timings. We ignore that check, however, because with binaries
|
# performance timings. We ignore that check, however, because with binaries
|
||||||
@ -25,30 +47,19 @@ stdenv.mkDerivation {
|
|||||||
# Configure outside of the source directory.
|
# Configure outside of the source directory.
|
||||||
preConfigure = '' mkdir build; cd build; configureScript=../configure; '';
|
preConfigure = '' mkdir build; cd build; configureScript=../configure; '';
|
||||||
|
|
||||||
# * -fPIC allows to build atlas inside shared objects, as octave does.
|
# * -fPIC is passed even in non-shared builds so that the ATLAS code can be
|
||||||
|
# used to inside of shared libraries, like Octave does.
|
||||||
#
|
#
|
||||||
# * Atlas detects the cpu and does some tricks. For example, notices the
|
# * -t 0 disables use of multi-threading. It's not quite clear what the
|
||||||
# hydra AMD Family 10h computer, and uses a SSE trick for it (bit 17 of MXCSR)
|
# consequences of that setting are and whether it's necessary or not.
|
||||||
# available, for what I know, only in that family. So we hardcode K7
|
configureFlags = "-Fa alg -fPIC -t 0 ${cpuConfig}" + optionalString shared " --shared";
|
||||||
# -A 31 = Athlon K7
|
|
||||||
# -A 18 = Pentium II
|
|
||||||
# -V 192 = SSE1|SSE2 (Or it takes SSE3 somehow in my machine without SSE3)
|
|
||||||
# -V 1 = No SIMD (Pentium II does not have any SSE)
|
|
||||||
# -t 0 = No threading
|
|
||||||
configureFlags = "-Fa alg -fPIC -t 0"
|
|
||||||
+ optionalString stdenv.isi686 " -b 32 -A 18 -V 1"
|
|
||||||
+ optionalString stdenv.isx86_64 " -A 31 -V 192"
|
|
||||||
+ optionalString shared " --shared "
|
|
||||||
;
|
|
||||||
|
|
||||||
buildInputs = [ gfortran ];
|
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = "http://math-atlas.sourceforge.net/";
|
homepage = "http://math-atlas.sourceforge.net/";
|
||||||
description = "Automatically Tuned Linear Algebra Software (ATLAS)";
|
description = "Automatically Tuned Linear Algebra Software (ATLAS)";
|
||||||
license = "GPL";
|
license = stdenv.lib.licenses.bsd3;
|
||||||
|
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
The ATLAS (Automatically Tuned Linear Algebra Software) project is an ongoing
|
The ATLAS (Automatically Tuned Linear Algebra Software) project is an ongoing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user