1 |
commit: de9a9bd23d4a652428d32b2db0e8c3cb721ef39e |
2 |
Author: spiros <andyspiros <AT> gmail <DOT> com> |
3 |
AuthorDate: Tue Jul 5 12:58:47 2011 +0000 |
4 |
Commit: Andrea Arteaga <andyspiros <AT> gmail <DOT> com> |
5 |
CommitDate: Tue Jul 5 12:58:47 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=de9a9bd2 |
7 |
|
8 |
Solved issue with pkg-config. |
9 |
|
10 |
--- |
11 |
.../autobench/files/python/accuracy/main_blas.cpp | 23 +++++++- |
12 |
.../autobench/files/python/basemodule.py | 60 ++++++++++++++++---- |
13 |
2 files changed, 70 insertions(+), 13 deletions(-) |
14 |
|
15 |
diff --git a/app-benchmarks/autobench/files/python/accuracy/main_blas.cpp b/app-benchmarks/autobench/files/python/accuracy/main_blas.cpp |
16 |
index 4a7a735..13f8206 100644 |
17 |
--- a/app-benchmarks/autobench/files/python/accuracy/main_blas.cpp |
18 |
+++ b/app-benchmarks/autobench/files/python/accuracy/main_blas.cpp |
19 |
@@ -48,6 +48,24 @@ vector<T> logspace(const T& min, const T& max, const unsigned& N) |
20 |
return result; |
21 |
} |
22 |
|
23 |
+template<typename T> |
24 |
+vector<T> logsizes(const T& min, const T& max, const unsigned& N) |
25 |
+{ |
26 |
+ if (N <= 10) |
27 |
+ return logspace(min, max, N); |
28 |
+ |
29 |
+ vector<T> result; |
30 |
+ result.reserve(N); |
31 |
+ |
32 |
+ for (unsigned i = 0; i < 9; ++i) |
33 |
+ result.push_back(i+1); |
34 |
+ vector<T> lres = logspace(10, max, N-9); |
35 |
+ for (unsigned i = 9; i < N; ++i) |
36 |
+ result.push_back(lres[i-9]); |
37 |
+ |
38 |
+ return result; |
39 |
+} |
40 |
+ |
41 |
double axpy_test(const int& size) |
42 |
{ |
43 |
// Set up |
44 |
@@ -162,7 +180,7 @@ void test(T t, const int& min, const int& max, const unsigned& N, const string& |
45 |
fname << "accuracy_" << name << "_blas.dat"; |
46 |
fout.open(fname.str().c_str()); |
47 |
cout << name << " test -- " << fname.str() << endl; |
48 |
- vector<int> axpy_sizes = logspace(min, max, N); |
49 |
+ vector<int> axpy_sizes = logsizes(min, max, N); |
50 |
N_ = 0; |
51 |
for (vector<int>::const_reverse_iterator i = axpy_sizes.rbegin(), e = axpy_sizes.rend(); i!=e; ++i) { |
52 |
result = t(*i); |
53 |
@@ -173,7 +191,7 @@ void test(T t, const int& min, const int& max, const unsigned& N, const string& |
54 |
cout << "\n"; |
55 |
} |
56 |
|
57 |
-int main() |
58 |
+int main(int argv, char **argc) |
59 |
{ |
60 |
bool |
61 |
axpy=false, axpby=false, rot=false, |
62 |
@@ -197,6 +215,7 @@ int main() |
63 |
else if (arg == "aat") aat = true; |
64 |
else if (arg == "trisolve_matrix") trisolve_matrix = true; |
65 |
else if (arg == "trmm") trmm = true; |
66 |
+ } |
67 |
|
68 |
|
69 |
/* AXPY test */ |
70 |
|
71 |
diff --git a/app-benchmarks/autobench/files/python/basemodule.py b/app-benchmarks/autobench/files/python/basemodule.py |
72 |
index d84d27b..e405032 100644 |
73 |
--- a/app-benchmarks/autobench/files/python/basemodule.py |
74 |
+++ b/app-benchmarks/autobench/files/python/basemodule.py |
75 |
@@ -60,6 +60,13 @@ class BaseModule: |
76 |
Print("Report generation skipped - missing libraries") |
77 |
return |
78 |
|
79 |
+ try: |
80 |
+ plt.figure() |
81 |
+ except: |
82 |
+ Print("Unable to generate plots") |
83 |
+ Print("Please make sure that X is running and $DISPLAY is set") |
84 |
+ return |
85 |
+ |
86 |
if plottype == 'plot': plotf = plt.plot |
87 |
elif plottype == 'semilogx': plotf = plt.semilogx |
88 |
elif plottype == 'semilogy': plotf = plt.semilogy |
89 |
@@ -151,31 +158,62 @@ class BaseTest: |
90 |
libdir = cfg.libdir |
91 |
while libdir[0] == '/': |
92 |
libdir = libdir[1:] |
93 |
+ result = 0 |
94 |
|
95 |
- # Retrieve pkgconfig settings and map the directories to the new root |
96 |
- path = pjoin(self.root, "etc/env.d/alternatives", \ |
97 |
+ # First run: retrieve requirements |
98 |
+ pkgpath = pjoin(self.root, "etc/env.d/alternatives", \ |
99 |
self.libname, self.impl, libdir, "pkgconfig") |
100 |
- cmd = ['pkg-config', '--libs', '--cflags', self.libname] |
101 |
env = { |
102 |
- 'PKG_CONFIG_PATH' : path, |
103 |
- 'PKG_CONFIG_LIBDIR' : '', |
104 |
- 'PKG_CONFIG_SYSROOT_DIR' : self.root |
105 |
+ 'PKG_CONFIG_PATH' : pkgpath, |
106 |
+ 'PKG_CONFIG_LIBDIR' : '' |
107 |
} |
108 |
- proc = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.STDOUT, env=env) |
109 |
- pkgconf = proc.communicate()[0] |
110 |
+ args = ['pkg-config', '--print-requires', self.libname] |
111 |
+ proc1 = sp.Popen(args, env=env, stdout=sp.PIPE, stderr=sp.STDOUT) |
112 |
+ req = proc1.communicate()[0].split() |
113 |
+ result += proc1.returncode |
114 |
+ |
115 |
+ # Modify pcfile |
116 |
+ pcfname = pjoin(pkgpath, self.libname+'.pc') |
117 |
+ if os.path.exists(pcfname): |
118 |
+ pcfname = os.path.realpath(pcfname) |
119 |
+ else: |
120 |
+ raise CompilationError('no log file: implementation void') |
121 |
+ pclines = file(pcfname, 'r').readlines() |
122 |
+ newlines = [l for l in pclines if l[:10] != 'Requires: '] |
123 |
+ pcfile = file(pcfname, 'w') |
124 |
+ pcfile.writelines(newlines) |
125 |
+ pcfile.close() |
126 |
+ |
127 |
+ # Second run: flags without requirements |
128 |
+ args = ['pkg-config', '--libs', '--cflags', self.libname] |
129 |
+ env['PKG_CONFIG_SYSROOT_DIR'] = self.root |
130 |
+ proc2 = sp.Popen(args, stdout=sp.PIPE, stderr=sp.STDOUT, env=env) |
131 |
+ pkgconf = proc2.communicate()[0] + ' ' |
132 |
+ result += proc1.returncode |
133 |
+ |
134 |
+ # Restore old file |
135 |
+ pcfile = file(pcfname, 'w') |
136 |
+ pcfile.writelines(pclines) |
137 |
+ pcfile.close() |
138 |
+ |
139 |
+ # Third run: requirements flags |
140 |
+ if len(req) > 0: |
141 |
+ args = ['pkg-config', '--libs', '--cflags'] + req |
142 |
+ proc3 = sp.Popen(args, stdout=sp.PIPE, stderr=sp.STDOUT) |
143 |
+ pkgconf += proc3.communicate()[0] |
144 |
+ result += proc1.returncode |
145 |
|
146 |
# Write logfile |
147 |
logfname = pjoin(self.logdir, 'pkgconfig.log') |
148 |
logfile = file(logfname, 'w') |
149 |
- logfile.write('PKG_CONFIG_PATH='+path + '\n') |
150 |
+ logfile.write('PKG_CONFIG_PATH='+pkgpath + '\n') |
151 |
logfile.write('PKG_CONFIG_LIBDIR=""' + '\n') |
152 |
logfile.write('PKG_CONFIG_SYSROOT_DIR='+self.root + '\n') |
153 |
- logfile.write(' '.join(cmd) + '\n') |
154 |
logfile.write(80*'-' + '\n') |
155 |
logfile.write(pkgconf) |
156 |
logfile.close() |
157 |
|
158 |
- if proc.returncode != 0: |
159 |
+ if result != 0: |
160 |
raise CompilationError(logfname) |
161 |
|
162 |
return shlex.split(pkgconf) |