1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
# Why do I want to use ur_optimize? #
The version of ATLAS bundled with Ureka (http://ssb.stsci.edu/ureka) is designed to work on a large number of CPUs, therefore certain operations requiring linear algebra may perform inadequately to your needs.
`ur_optimize` rebuilds the underlying ATLAS/LaPACK/BLAS stack to be tailored for your CPU's architecture. After that, the NumPy/SciPy stack is recompiled and linked against the new ATLAS implementation in order to take advantage of these optimizations.
# License #
BSD
# Requirements #
### RHEL 6.0+ / Fedora 10+ ###
```
sudo yum install gcc gfortran
```
### Ubuntu 12.04+ ###
```
sudo apt-get install build-essential
```
# Testing ur_optimize #
For this test I used the latest Ureka build (as of 09/04/2014):
Ureka_linux-rhe5_64_1.4.1.tar.gz
# Optimizing Ureka
```
$ git clone https://bitbucket.org/jhunkeler/ur_optimize.git
$ cd ur_optimize
$ ./ur_optimize -p /path/to/Ureka
```
Consider running `ur_optimize` in a `screen` session. ATLAS has been known to take a **very long time** to build.
### SYSTEM ###
```
Manufacturer: Dell Inc.
Product Name: OptiPlex 790
```
### BIOS ###
```
Vendor: Dell Inc.
Version: A07
Release Date: 09/10/2011
```
### CPU ###
```
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
stepping : 7
microcode : 0x29
cpu MHz : 3399.867
cache size : 8192 KB
physical id : 0
siblings : 8
core id : 3
cpu cores : 4
```
### MEMORY INFORMATION ###
```
size : 16GB
type : DDR3
Mhz : 1333
```
## test_linalg.py module ##
```
#!/usr/bin/env python
import numpy
import scipy.interpolate
def interpolate(user_methods=None, points=1000):
x = numpy.linspace(1.0, 1000.0, num=points)
y = numpy.linspace(1.0, 1000.0, num=points)
methods = ['linear', 'nearest', 'zero', 'slinear', 'quadratic', 'cubic']
if user_methods is not None:
methods = user_methods
for method in methods:
print("{}...".format(method)),
try:
scipy.interpolate.interp1d(x, y, kind=method, bounds_error=False, fill_value=0.0)
except MemoryError:
# Common ocurrance with quadratic
print("failed")
print("ok")
if __name__ == "__main__":
interpolate()
```
## Performance Comparison ##
### Before ur_optimize ###
```
$ ipython
Python 2.7.5 (default, Jun 19 2014, 11:22:38)
Type "copyright", "credits" or "license" for more information.
IPython 2.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import test_linalg
In [2]: %timeit test_linalg.interpolate(['quadratic'])
quadratic... ok
quadratic... ok
quadratic... ok
quadratic... ok
1 loops, best of 3: 39 s per loop
```
**39** seconds per operation.
### After ur_optimize ###
```
$ ipython
Python 2.7.5 (default, Jun 19 2014, 11:22:38)
Type "copyright", "credits" or "license" for more information.
IPython 2.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import test_linalg
In [2]: %timeit test_linalg.interpolate(['quadratic'])
quadratic... ok
quadratic... ok
quadratic... ok
quadratic... ok
1 loops, best of 3: 1.17 s per loop
```
**1.17** seconds per operation.
# Found a bug? #
If ATLAS fails to compile for your architecture, please contact the developers of ATLAS, not me: http://math-atlas.sourceforge.net/faq.html#help
Otherwise, feel free to submit a bug report on this project's issue tracker: http://bitbucket.org/jhunkeler/ur_optimize/issues
|