parent
4056c436c9
commit
95373d3634
@ -1,126 +0,0 @@ |
||||
{ stdenv, fetchurl, gfortran, tolerateCpuTimingInaccuracy ? true, shared ? false |
||||
, cpuConfig ? if stdenv.isi686 then "-b 32 -A 12 -V 1" else "-b 64 -A 14 -V 384" |
||||
, cacheEdge ? "262144" |
||||
, threads ? "0" |
||||
, liblapack, withLapack |
||||
}: |
||||
|
||||
# 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. Upstream recommends these defaults for distributions: |
||||
# |
||||
# | x86 CPU | x86_64 CPU | |
||||
# |---------------------------------------------+------------------------| |
||||
# | -b 32 | -b 64 | |
||||
# | -A 12 (x86x87) | -A 14 (x86SSE2) | |
||||
# | -V 1 (No SIMD) | -V 384 (SSE1 and SSE2) | |
||||
# |
||||
# These defaults should give consistent performance across machines. |
||||
# Performance will be substantially lower than an optimized build, but a build |
||||
# optimized for one machine will give even worse performance on others. If you |
||||
# are a serious user of Atlas (e.g., you write code that uses it) you should |
||||
# compile an optimized version for each of your machines. |
||||
# |
||||
# The parameter 'cacheEdge' sets the L2 cache per core (in bytes). Setting this |
||||
# parameter reduces build time because some tests to detect the L2 cache size |
||||
# will not be run. It will also reduce impurity; different build nodes on Hydra |
||||
# may have different L2 cache sizes, but fixing the L2 cache size should |
||||
# account for that. This also makes the performance of binary substitutes more |
||||
# consistent. |
||||
# |
||||
# The -V flags can change with each release as new instruction sets are added |
||||
# because upstream thinks it's a good idea to add entries at the start of an |
||||
# enum, rather than the end. If the build suddenly fails with messages about |
||||
# missing instruction sets, you may need to poke around in the source a bit. |
||||
# |
||||
# Upstream recommends the x86x87/x86SSE2 architectures for generic x86/x86_64 |
||||
# for distribution builds. Additionally, we set 'cacheEdge' to reduce impurity. |
||||
# Otherwise, the cache parameters will be detected by timing which will be |
||||
# highly variable on Hydra. |
||||
|
||||
let |
||||
inherit (stdenv.lib) optional optionalString; |
||||
# Don't upgrade until https://github.com/math-atlas/math-atlas/issues/44 |
||||
# is resolved. |
||||
version = "3.10.3"; |
||||
in |
||||
|
||||
stdenv.mkDerivation { |
||||
name = "atlas${optionalString withLapack "-with-lapack"}-${version}"; |
||||
|
||||
src = fetchurl { |
||||
url = "mirror://sourceforge/math-atlas/atlas${version}.tar.bz2"; |
||||
sha256 = "1dyjlq3fiparvm8ypwk6rsmjzmnwk81l88gkishphpvc79ryp216"; |
||||
}; |
||||
|
||||
buildInputs = [ gfortran ]; |
||||
|
||||
# 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 |
||||
++ optional stdenv.isDarwin ./tmpdir.patch; |
||||
|
||||
hardeningDisable = [ "format" ]; |
||||
|
||||
# Configure outside of the source directory. |
||||
preConfigure = '' |
||||
mkdir build |
||||
cd build |
||||
configureScript=../configure |
||||
''; |
||||
|
||||
# * -t 0 disables use of multi-threading. It's not quite clear what the |
||||
# consequences of that setting are and whether it's necessary or not. |
||||
configureFlags = [ |
||||
"-t ${threads}" |
||||
cpuConfig |
||||
] ++ optional shared "--shared" |
||||
++ optional withLapack "--with-netlib-lapack-tarfile=${liblapack.src}"; |
||||
|
||||
postConfigure = '' |
||||
if [[ -n "${cacheEdge}" ]]; then |
||||
echo '#define CacheEdge ${cacheEdge}' >> include/atlas_cacheedge.h |
||||
echo '#define CacheEdge ${cacheEdge}' >> include/atlas_tcacheedge.h |
||||
fi |
||||
''; |
||||
|
||||
doCheck = true; |
||||
|
||||
postInstall = '' |
||||
# Avoid name collision with the real lapack (ATLAS only builds a partial |
||||
# lapack unless withLapack = true). |
||||
if ${if withLapack then "false" else "true"}; then |
||||
mv $out/lib/liblapack.a $out/lib/liblapack_atlas.a |
||||
fi |
||||
''; |
||||
|
||||
# 1. /buildATLAS/build/bin/ATLrun.sh: multiple segfaults. |
||||
# 2. "atlas does its own parallel builds" |
||||
enableParallelBuilding = false; |
||||
|
||||
meta = { |
||||
homepage = http://math-atlas.sourceforge.net/; |
||||
description = "Automatically Tuned Linear Algebra Software (ATLAS)"; |
||||
license = stdenv.lib.licenses.bsd3; |
||||
broken = stdenv.isDarwin; # test when updating to >=3.10.3 |
||||
platforms = stdenv.lib.platforms.unix; |
||||
|
||||
longDescription = '' |
||||
The ATLAS (Automatically Tuned Linear Algebra Software) project 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. |
||||
''; |
||||
|
||||
maintainers = with stdenv.lib.maintainers; [ ttuegel ]; |
||||
}; |
||||
} |
@ -1,22 +0,0 @@ |
||||
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)
|
@ -1,276 +0,0 @@ |
||||
diff --git a/CONFIG/ARCHS/negflt.c b/CONFIG/ARCHS/negflt.c
|
||||
index e5b7871..d45e387 100644
|
||||
--- a/CONFIG/ARCHS/negflt.c
|
||||
+++ b/CONFIG/ARCHS/negflt.c
|
||||
@@ -239,7 +239,7 @@ void NegFile(char *fnam, int N, int *cols)
|
||||
FILE *fpin, *fpout;
|
||||
WORDS *wp0, *wp;
|
||||
|
||||
- tnam = tmpnam(NULL);
|
||||
+ tnam = tempnam(NULL, NULL);
|
||||
fpin = fopen(fnam, "r");
|
||||
assert(fpin);
|
||||
fpout = fopen(tnam, "w");
|
||||
diff --git a/CONFIG/include/atlas_sys.h b/CONFIG/include/atlas_sys.h
|
||||
index b83a749..8902d38 100644
|
||||
--- a/CONFIG/include/atlas_sys.h
|
||||
+++ b/CONFIG/include/atlas_sys.h
|
||||
@@ -216,12 +216,13 @@ static char *ATL_fgets_CWS(char *sout, int *plen, FILE *fpin)
|
||||
|
||||
static char *ATL_tmpnam(void)
|
||||
{
|
||||
- static char tnam[L_tmpnam];
|
||||
+ static char *tnam;
|
||||
static char FirstTime=1;
|
||||
if (FirstTime)
|
||||
{
|
||||
FirstTime = 0;
|
||||
- assert(tmpnam(tnam));
|
||||
+ tnam = tempnam(NULL, NULL);
|
||||
+ assert(tnam);
|
||||
}
|
||||
return(tnam);
|
||||
}
|
||||
diff --git a/bin/atlas_install.c b/bin/atlas_install.c
|
||||
index 2753cbf..e49cc3e 100644
|
||||
--- a/bin/atlas_install.c
|
||||
+++ b/bin/atlas_install.c
|
||||
@@ -662,7 +662,8 @@ void GoToTown(int ARCHDEF, int L1DEF, int TuneLA)
|
||||
{
|
||||
const char TR[2] = {'N','T'};
|
||||
char prec[4] = {'d', 's', 'z', 'c'}, pre, upre, *typ;
|
||||
- char ln[1024], tnam[256], ln2[512], ln3[512], fnam[128];
|
||||
+ char ln[1024], ln2[512], ln3[512], fnam[128];
|
||||
+ char *tnam;
|
||||
char *mulinst, *peakstr, *peakstr2;
|
||||
int nprec=4;
|
||||
int iL1, lat, muladd, maused, latuse, lbnreg;
|
||||
@@ -681,7 +682,7 @@ void GoToTown(int ARCHDEF, int L1DEF, int TuneLA)
|
||||
fpsum = fopen("INSTALL_LOG/SUMMARY.LOG", "a");
|
||||
ATL_Cassert(fpsum, "OPENING INSTALL_LOG/SUMMARY.LOG", NULL);
|
||||
|
||||
- ATL_Cassert(tmpnam(tnam), "GETTING TEMPFILE", NULL);
|
||||
+ ATL_Cassert((tnam = tempnam(NULL, NULL)), "GETTING TEMPFILE", NULL);
|
||||
|
||||
if (L1DEF)
|
||||
{
|
||||
diff --git a/bin/extract.c b/bin/extract.c
|
||||
index 7a5a926..53fb8bf 100644
|
||||
--- a/bin/extract.c
|
||||
+++ b/bin/extract.c
|
||||
@@ -3378,7 +3378,7 @@ void PushProc0(EXTENV *EE, EXTPROC **basep, EXTPROC **myfuncs, char *ln)
|
||||
pp->argnams = KillWord(wp, wp);
|
||||
pp->nargs = CountWords(pp->argnams);
|
||||
|
||||
- cp = tmpnam(NULL);
|
||||
+ cp = tempnam(NULL, NULL);
|
||||
if (cp == NULL) ExtErr(EE, "Out of tmpnams!!!");
|
||||
i = Wstrlen(cp) + 1;
|
||||
pp->FileNam = malloc(i*sizeof(char));
|
||||
diff --git a/include/atlas_mvtesttime.h b/include/atlas_mvtesttime.h
|
||||
index 9147fcb..ab6a99f 100644
|
||||
--- a/include/atlas_mvtesttime.h
|
||||
+++ b/include/atlas_mvtesttime.h
|
||||
@@ -105,14 +105,15 @@ static int MVKernelFailsTest
|
||||
char ln[4096];
|
||||
char *sp;
|
||||
int i, lda0;
|
||||
- static char outnam[L_tmpnam];
|
||||
+ static char* outnam;
|
||||
static int FirstTime=1;
|
||||
|
||||
if (FirstTime)
|
||||
{
|
||||
|
||||
FirstTime = 0;
|
||||
- assert(tmpnam(outnam));
|
||||
+ outnam = tempnam(NULL, NULL);
|
||||
+ assert(outnam);
|
||||
}
|
||||
/*
|
||||
* If the file is generated, call generator to create it
|
||||
@@ -221,14 +222,15 @@ static double TimeMVKernel
|
||||
char ln[2048], resf[256], *sp;
|
||||
double *dp, mf;
|
||||
int i, align = pre2size(pre);
|
||||
- static char outnam[L_tmpnam];
|
||||
+ static char* outnam;
|
||||
static int FirstTime=1;
|
||||
|
||||
if (FirstTime)
|
||||
{
|
||||
|
||||
FirstTime = 0;
|
||||
- assert(tmpnam(outnam));
|
||||
+ outnam = tempnam(NULL, NULL);
|
||||
+ assert(outnam);
|
||||
}
|
||||
/*
|
||||
* If the file is generated, call generator to create it
|
||||
diff --git a/include/atlas_r1testtime.h b/include/atlas_r1testtime.h
|
||||
index b33213a..f27ee25 100644
|
||||
--- a/include/atlas_r1testtime.h
|
||||
+++ b/include/atlas_r1testtime.h
|
||||
@@ -76,14 +76,15 @@ static int R1KernelFailsTest
|
||||
char ln[4096];
|
||||
char *sp;
|
||||
int i, lda0;
|
||||
- static char outnam[L_tmpnam];
|
||||
+ static char* outnam;
|
||||
static int FirstTime=1;
|
||||
|
||||
if (FirstTime)
|
||||
{
|
||||
|
||||
FirstTime = 0;
|
||||
- assert(tmpnam(outnam));
|
||||
+ outnam = tempnam(NULL, NULL);
|
||||
+ assert(outnam);
|
||||
}
|
||||
/*
|
||||
* If the file is generated, call generator to create it
|
||||
@@ -187,14 +188,15 @@ static double TimeR1Kernel
|
||||
char ln[2048], resf[256], *sp;
|
||||
double *dp, mf;
|
||||
int i, align = pre2size(pre);
|
||||
- static char outnam[L_tmpnam];
|
||||
+ static char* outnam;
|
||||
static int FirstTime=1;
|
||||
|
||||
if (FirstTime)
|
||||
{
|
||||
|
||||
FirstTime = 0;
|
||||
- assert(tmpnam(outnam));
|
||||
+ outnam = tempnam(NULL, NULL);
|
||||
+ assert(outnam);
|
||||
}
|
||||
/*
|
||||
* If the file is generated, call generator to create it
|
||||
diff --git a/include/atlas_r2testtime.h b/include/atlas_r2testtime.h
|
||||
index facc66d..c638dce 100644
|
||||
--- a/include/atlas_r2testtime.h
|
||||
+++ b/include/atlas_r2testtime.h
|
||||
@@ -76,14 +76,15 @@ static int R2KernelFailsTest
|
||||
char ln[4096];
|
||||
char *sp;
|
||||
int i, lda0;
|
||||
- static char outnam[L_tmpnam];
|
||||
+ static char* outnam;
|
||||
static int FirstTime=1;
|
||||
|
||||
if (FirstTime)
|
||||
{
|
||||
|
||||
FirstTime = 0;
|
||||
- assert(tmpnam(outnam));
|
||||
+ outnam = tempnam(NULL, NULL);
|
||||
+ assert(outnam);
|
||||
}
|
||||
/*
|
||||
* If the file is generated, call generator to create it
|
||||
@@ -187,14 +188,15 @@ static double TimeR2Kernel
|
||||
char ln[2048], resf[256], *sp;
|
||||
double *dp, mf;
|
||||
int i, align = pre2size(pre);
|
||||
- static char outnam[L_tmpnam];
|
||||
+ static char* outnam;
|
||||
static int FirstTime=1;
|
||||
|
||||
if (FirstTime)
|
||||
{
|
||||
|
||||
FirstTime = 0;
|
||||
- assert(tmpnam(outnam));
|
||||
+ outnam = tempnam(NULL, NULL);
|
||||
+ assert(outnam);
|
||||
}
|
||||
/*
|
||||
* If the file is generated, call generator to create it
|
||||
diff --git a/include/atlas_sys.h b/include/atlas_sys.h
|
||||
index b83a749..b3f88d2 100644
|
||||
--- a/include/atlas_sys.h
|
||||
+++ b/include/atlas_sys.h
|
||||
@@ -216,12 +216,13 @@ static char *ATL_fgets_CWS(char *sout, int *plen, FILE *fpin)
|
||||
|
||||
static char *ATL_tmpnam(void)
|
||||
{
|
||||
- static char tnam[L_tmpnam];
|
||||
+ static char* tnam;
|
||||
static char FirstTime=1;
|
||||
if (FirstTime)
|
||||
{
|
||||
FirstTime = 0;
|
||||
- assert(tmpnam(tnam));
|
||||
+ tnam = tempnam(NULL, NULL);
|
||||
+ assert(tnam);
|
||||
}
|
||||
return(tnam);
|
||||
}
|
||||
diff --git a/tune/blas/gemm/usercomb.c b/tune/blas/gemm/usercomb.c
|
||||
index 59a7cd4..eb3eb05 100644
|
||||
--- a/tune/blas/gemm/usercomb.c
|
||||
+++ b/tune/blas/gemm/usercomb.c
|
||||
@@ -138,11 +138,13 @@ int GetUserCase(char pre, int icase, int *iflag, int *mb, int *nb, int *kb,
|
||||
|
||||
void CombineFiles(char *fout, int nfiles, char **fnams)
|
||||
{
|
||||
- char tnam[256], ln[512];
|
||||
+ char ln[512];
|
||||
+ char *tnam;
|
||||
int i, j, n, nn;
|
||||
FILE *fpout, *fpin;
|
||||
|
||||
- assert(tmpnam(tnam));
|
||||
+ tnam = tempnam(NULL, NULL);
|
||||
+ assert(tnam);
|
||||
for (n=i=0; i < nfiles; i++) n += NumUserCases0(fnams[i]);
|
||||
|
||||
fpout = fopen(tnam, "w");
|
||||
diff --git a/tune/blas/gemm/userflag.c b/tune/blas/gemm/userflag.c
|
||||
index c3983e4..b7dd70b 100644
|
||||
--- a/tune/blas/gemm/userflag.c
|
||||
+++ b/tune/blas/gemm/userflag.c
|
||||
@@ -139,8 +139,8 @@ int GetUserCase(char pre, int icase, int *iflag, int *mb, int *nb, int *kb,
|
||||
|
||||
void GoGetThem(char *infile, char *outfile)
|
||||
{
|
||||
- char ln[512], ln2[512], tnam[256], MCC[256], MMFLAGS[256];
|
||||
- char *chkfile = "FlagCheck.c", *sp, *sp2;
|
||||
+ char ln[512], ln2[512], MCC[256], MMFLAGS[256];
|
||||
+ char *chkfile = "FlagCheck.c", *sp, *sp2, *tnam;
|
||||
FILE *fpin, *fpout;
|
||||
int i, j, n, nmin=0, good;
|
||||
int wass;
|
||||
@@ -152,7 +152,8 @@ void GoGetThem(char *infile, char *outfile)
|
||||
n = NumUserCases0(infile);
|
||||
fpin = fopen(infile, "r");
|
||||
assert(fpin);
|
||||
- assert(tmpnam(tnam));
|
||||
+ tnam = tempnam(NULL, NULL);
|
||||
+ assert(tnam);
|
||||
fpout = fopen(tnam, "w");
|
||||
assert(fpout);
|
||||
assert(fgets(ln, 512, fpin));
|
||||
diff --git a/tune/sysinfo/emit_buildinfo.c b/tune/sysinfo/emit_buildinfo.c
|
||||
index 309c06a..3feaea7 100644
|
||||
--- a/tune/sysinfo/emit_buildinfo.c
|
||||
+++ b/tune/sysinfo/emit_buildinfo.c
|
||||
@@ -41,14 +41,15 @@ static char SMCVERS[LNLEN], DMCVERS[LNLEN], SKCVERS[LNLEN], DKCVERS[LNLEN];
|
||||
static char UNAM[64], DATE[128];
|
||||
char *CmndResults(char *cmnd)
|
||||
{
|
||||
- static char tnam[128];
|
||||
+ static char* tnam;
|
||||
static int FirstTime=1;
|
||||
char ln[512];
|
||||
|
||||
if (FirstTime)
|
||||
{
|
||||
FirstTime = 0;
|
||||
- assert(tmpnam(tnam));
|
||||
+ tnam = tempnam(NULL, NULL);
|
||||
+ assert(tnam);
|
||||
}
|
||||
sprintf(ln, "%s > %s\n", cmnd, tnam);
|
||||
fprintf(stderr, "system: %s", ln);
|
Loading…
Reference in new issue