diff --git a/pkgs/development/libraries/science/math/atlas/default.nix b/pkgs/development/libraries/science/math/atlas/default.nix index 75f9de5e96a..b61204d8bf4 100644 --- a/pkgs/development/libraries/science/math/atlas/default.nix +++ b/pkgs/development/libraries/science/math/atlas/default.nix @@ -1,27 +1,32 @@ { stdenv, fetchurl, gfortran, tolerateCpuTimingInaccuracy ? true, shared ? false }: let + version = "3.10.1"; + optionalString = stdenv.lib.optionalString; + optional = stdenv.lib.optional; in stdenv.mkDerivation { - name = "atlas-3.9.67"; + name = "atlas-${version}"; src = fetchurl { - url = mirror://sourceforge/math-atlas/atlas3.9.67.tar.bz2; - sha256 = "06xxlv440z8a3qmfrh17p28girv71c6awvpw5vhpspr0pcsgk1pa"; + url = "mirror://sourceforge/math-atlas/atlas${version}.tar.bz2"; + sha256 = "11ncgdc7kzb2y2gqb3sgarm5saj9fr07r3h2yh2h5bja429b85d2"; }; + # 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 + # performance timings. We ignore that check, however, because with binaries + # being pre-built on Hydra those timings aren't accurate for the local + # machine in the first place. + patches = optional tolerateCpuTimingInaccuracy ./disable-timing-accuracy-check.patch; + # Configure outside of the source directory. preConfigure = '' mkdir build; cd build; configureScript=../configure; ''; # * -fPIC allows to build atlas inside shared objects, as octave does. # - # * 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 - # performance timings. We ignore that check, however, because with binaries - # being pre-built on Hydra those timings aren't accurate for the local - # machine in the first place. # * Atlas detects the cpu and does some tricks. For example, notices the # hydra AMD Family 10h computer, and uses a SSE trick for it (bit 17 of MXCSR) # available, for what I know, only in that family. So we hardcode K7 @@ -33,7 +38,6 @@ stdenv.mkDerivation { configureFlags = "-Fa alg -fPIC -t 0" + optionalString stdenv.isi686 " -b 32 -A 18 -V 1" + optionalString stdenv.isx86_64 " -A 31 -V 192" - + optionalString tolerateCpuTimingInaccuracy " -Si cputhrchk 0" + optionalString shared " --shared " ; diff --git a/pkgs/development/libraries/science/math/atlas/disable-timing-accuracy-check.patch b/pkgs/development/libraries/science/math/atlas/disable-timing-accuracy-check.patch new file mode 100644 index 00000000000..ddacc742d14 --- /dev/null +++ b/pkgs/development/libraries/science/math/atlas/disable-timing-accuracy-check.patch @@ -0,0 +1,22 @@ +diff -ubr ATLAS-orig/CONFIG/src/config.c ATLAS/CONFIG/src/config.c +--- ATLAS-orig/CONFIG/src/config.c 2013-02-06 11:23:47.078036878 +0100 ++++ ATLAS/CONFIG/src/config.c 2013-02-06 11:24:16.481120888 +0100 +@@ -711,17 +711,7 @@ + + int ProbeCPUThrottle(int verb, char *targarg, enum OSTYPE OS, enum ASMDIA asmb) + { +- int i, iret; +- char *ln; +- i = strlen(targarg) + 22 + 12; +- ln = malloc(i*sizeof(char)); +- assert(ln); +- sprintf(ln, "%s -O %d -s %d -t", targarg, OS, asmb); +- iret = GetIntProbe(verb, ln, "arch", "CPU THROTTLE", 0); +- free(ln); +- if (iret) printf("CPU Throttling apparently enabled!\n"); +- else printf("Cannot detect CPU throttling.\n"); +- return(iret); ++ return 0; + } + + char *NewAppendedString_SFLAG(char *old, char *flag, char *str)