@@ -1,5 +1,7 @@
1{ stdenv, fetchurl, gfortran, tolerateCpuTimingInaccuracy ? true, shared ? false
1{ stdenv, fetchurl, gfortran, tolerateCpuTimingInaccuracy ? true, shared ? false
2−, cpuConfig ? if stdenv.isi686 then "-b 32 -A 18 -V 1" else "-b 64 -A 31 -V 384"
2+, cpuConfig ? if stdenv.isi686 then "-b 32 -A 12 -V 1" else "-b 64 -A 14 -V 384"
5# Atlas detects the CPU and optimizes its build accordingly. This is great when
7# Atlas detects the CPU and optimizes its build accordingly. This is great when
@@ -9,27 +11,40 @@
9# cannot execute.
11# cannot execute.
11# To avoid these issues, the build is configured using the 'cpuConfig'
13# To avoid these issues, the build is configured using the 'cpuConfig'
12−# parameter as follows:
14+# parameter. Upstream recommends these defaults for distributions:
14# | x86 CPU | x86_64 CPU |
16# | x86 CPU | x86_64 CPU |
15# |---------------------------------------------+------------------------|
17# |---------------------------------------------+------------------------|
16# | -b 32 | -b 64 |
18# | -b 32 | -b 64 |
17−# | -A 18 (Pentium II) | -A 31 (Athlon K7) |
19+# | -A 12 (x86x87) | -A 14 (x86SSE2) |
18−# | -V 1 (No SIMD: Pentium II doesn't have SSE) | -V 384 (SSE1 and SSE2) |
20+# | -V 1 (No SIMD) | -V 384 (SSE1 and SSE2) |
22+# These defaults should give consistent performance across machines.
23+# Performance will be substantially lower than an optimized build, but a build
24+# optimized for one machine will give even worse performance on others. If you
25+# are a serious user of Atlas (e.g., you write code that uses it) you should
20−# Users who want to compile a highly optimized version of ATLAS that's suitable
26+# compile an optimized version for each of your machines.
21−# for their local machine can override these settings accordingly.
27+#
28+# The parameter 'cacheEdge' sets the L2 cache per core (in bytes). Setting this
29+# parameter reduces build time because some tests to detect the L2 cache size
30+# will not be run. It will also reduce impurity; different build nodes on Hydra
31+# may have different L2 cache sizes, but fixing the L2 cache size should
32+# account for that. This also makes the performance of binary substitutes more
23# The -V flags can change with each release as new instruction sets are added
35# The -V flags can change with each release as new instruction sets are added
24# because upstream thinks it's a good idea to add entries at the start of an
36# because upstream thinks it's a good idea to add entries at the start of an
25# enum, rather than the end. If the build suddenly fails with messages about
37# enum, rather than the end. If the build suddenly fails with messages about
26# missing instruction sets, you may need to poke around in the source a bit.
38# missing instruction sets, you may need to poke around in the source a bit.
40+# Upstream recommends the x86x87/x86SSE2 architectures for generic x86/x86_64
41+# for distribution builds. Additionally, we set 'cacheEdge' to reduce impurity.
42+# Otherwise, the cache parameters will be detected by timing which will be
43+# highly variable on Hydra.
46+ inherit (stdenv.lib) optional optionalString;
29 version = "3.10.2";
47 version = "3.10.2";
31− optionalString = stdenv.lib.optionalString;
32− optional = stdenv.lib.optional;
35stdenv.mkDerivation {
50stdenv.mkDerivation {
@@ -50,27 +65,50 @@ stdenv.mkDerivation {
50 patches = optional tolerateCpuTimingInaccuracy ./disable-timing-accuracy-check.patch;
65 patches = optional tolerateCpuTimingInaccuracy ./disable-timing-accuracy-check.patch;
52 # Configure outside of the source directory.
67 # Configure outside of the source directory.
53− preConfigure = '' mkdir build; cd build; configureScript=../configure; '';
71+ configureScript=../configure
55 # * -fPIC is passed even in non-shared builds so that the ATLAS code can be
74 # * -fPIC is passed even in non-shared builds so that the ATLAS code can be
56 # used to inside of shared libraries, like Octave does.
75 # used to inside of shared libraries, like Octave does.
58 # * -t 0 disables use of multi-threading. It's not quite clear what the
77 # * -t 0 disables use of multi-threading. It's not quite clear what the
59 # consequences of that setting are and whether it's necessary or not.
78 # consequences of that setting are and whether it's necessary or not.
60− configureFlags = "-Fa alg -fPIC -t 0 ${cpuConfig}" + optionalString shared " --shared";
79+ configureFlags = [
84+ ] ++ optional shared "--shared";
87+ if [[ -n "${cacheEdge}" ]]; then
88+ echo '#define CacheEdge ${cacheEdge}' >> include/atlas_cacheedge.h
89+ echo '#define CacheEdge ${cacheEdge}' >> include/atlas_tcacheedge.h
62 doCheck = true;
93 doCheck = true;
96+ # Avoid name collision with the real lapack (ATLAS only builds a partial
98+ mv $out/lib/liblapack.a $out/lib/liblapack_atlas.a
65 homepage = "http://math-atlas.sourceforge.net/";
102 homepage = "http://math-atlas.sourceforge.net/";
66 description = "Automatically Tuned Linear Algebra Software (ATLAS)";
103 description = "Automatically Tuned Linear Algebra Software (ATLAS)";
67 license = stdenv.lib.licenses.bsd3;
104 license = stdenv.lib.licenses.bsd3;
69 longDescription = ''
106 longDescription = ''
70− The ATLAS (Automatically Tuned Linear Algebra Software) project is an ongoing
107+ The ATLAS (Automatically Tuned Linear Algebra Software) project is an
71− research effort focusing on applying empirical techniques in order to provide
108+ ongoing research effort focusing on applying empirical techniques in
72− portable performance. At present, it provides C and Fortran77 interfaces to a
109+ order to provide portable performance. At present, it provides C and
73− portably efficient BLAS implementation, as well as a few routines from LAPACK.
110+ Fortran77 interfaces to a portably efficient BLAS implementation, as well
111+ as a few routines from LAPACK.
76 maintainers = with stdenv.lib.maintainers; [ ttuegel ];
114 maintainers = with stdenv.lib.maintainers; [ ttuegel ];