In [1]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [21]:
import glob
import re
import pandas as pd

In [3]:
logs = glob.glob('Nearest.*')

In [25]:
labels = ['Cores', 'Points', 'Data Generation', 'Scatter and y-sort',
          'NN Search (y)', 'x-sort', 'NN Search (x)', 'Iij & Cij',
          'Cij Sort and Comm.', 'Local Reduction', 'Ci Computation',
          'Final Sort', 'Total']
data = []
for l in logs:
    with open(l) as f:
        cdata = []
        for line in f:
            x = map(float, re.findall(r'[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?', line))
            if len(x) == 2:
                cdata.append(x[0])
                cdata.append(x[1])
            else:
                cdata.append(x[0])
        data.append(cdata)

In [26]:
print data[0]


[8.0, 640.0, 8.79764556885e-05, 0.00126600265503, 0.0972990989685, 0.000576972961426, 0.0844309329987, 0.0848500728607, 9.29832458496e-05, 0.00892806053162, 0.0208230018616, 0.00159883499146, 0.299953937531]

In [49]:
df = pd.DataFrame(data, columns=labels)

In [37]:
df


Out[37]:
Cores Points Data Generation Scatter and y-sort NN Search (y) x-sort NN Search (x) Iij & Cij Cij Sort and Comm. Local Reduction Ci Computation Final Sort Total
0 8 640 0.000088 0.001266 0.097299 0.000577 0.084431 0.084850 0.000093 0.008928 0.020823 0.001599 0.299954
1 8 1280 0.000152 0.001276 0.402203 0.000648 0.345892 0.149003 0.000118 0.025818 0.027559 0.002981 0.955650
2 8 2560 0.000254 0.001659 1.451533 0.001072 1.257667 0.418566 0.000096 0.028808 0.074378 0.005795 3.239828
3 8 5120 0.000450 0.001808 5.763524 0.001156 4.766943 1.865308 0.000109 0.091755 0.152313 0.011499 12.654865
4 8 10240 0.000838 0.002440 22.352912 0.001798 19.882474 3.795184 0.000123 0.190784 0.303899 0.022778 46.553230
5 8 20480 0.001636 0.003617 90.698965 0.003060 84.775730 8.934513 0.000154 0.315389 0.419580 0.045214 185.197858
6 8 40960 0.003204 0.005567 353.654044 0.004656 339.653043 12.040285 0.000156 0.630231 0.861121 0.091634 706.943941
7 8 81920 0.006631 0.009015 1408.930882 0.008162 1401.177386 31.553839 0.000148 1.832686 1.660217 0.180649 2845.359615
8 8 163840 0.013581 0.016629 NaN NaN NaN NaN NaN NaN NaN NaN NaN
9 16 640 0.000093 0.007757 0.034533 0.003018 0.020190 0.092398 0.000991 0.012688 0.018876 0.001041 0.191585
10 16 1280 0.000150 0.007743 0.118087 0.003348 0.099639 0.154003 0.000942 0.023356 0.039875 0.001800 0.448943
11 16 2560 0.000241 0.011674 0.457890 0.004591 0.359726 0.295025 0.000946 0.045254 0.068489 0.003183 1.247019
12 16 5120 0.000441 0.008299 1.794680 0.005476 1.224854 1.056102 0.001007 0.107982 0.152302 0.006134 4.357277
13 16 10240 0.000844 0.012608 5.914660 0.008466 4.956823 2.122647 0.001127 0.136226 0.276167 0.012109 13.441677
14 16 20480 0.001611 0.009793 22.826159 0.005396 20.945061 5.685638 0.001087 0.084585 0.865791 0.023352 50.448473
15 16 40960 0.003205 0.017311 94.416488 0.011745 86.453476 9.079374 0.001024 0.592195 1.248789 0.046768 191.870375
16 16 81920 0.006599 0.019424 354.417758 0.014606 351.552780 20.353731 0.000991 1.185510 2.256791 0.092625 729.900815
17 16 163840 0.014051 0.061435 1403.410317 0.025553 1371.523169 86.974306 0.000966 3.515641 3.596686 0.185004 2869.307128
18 32 640 0.000094 1.058840 0.011070 0.009887 0.002901 0.106384 0.004438 0.011986 0.027679 0.001056 1.234335
19 32 1280 0.000146 0.058547 0.036201 0.010987 0.021631 0.199828 0.002830 0.023613 0.045268 0.001242 0.400293
20 32 2560 0.000257 0.061372 0.139595 0.011797 0.075466 0.371549 0.002711 0.040034 0.103841 0.002108 0.808730
21 32 5120 0.000445 0.058863 0.507618 0.012906 0.255366 0.842954 0.003782 0.093536 0.149590 0.003587 1.928647
22 32 10240 0.000837 0.060199 1.637714 0.013717 1.151669 1.639866 0.002729 0.154386 0.353430 0.006440 5.020987
23 32 20480 0.001635 0.059415 6.071794 0.014024 5.321226 3.489349 0.002666 0.330598 0.571491 0.014544 15.876742
24 32 40960 0.003186 0.058285 25.053861 0.017974 21.188628 8.131666 0.002851 0.732636 1.095317 0.025698 56.310102
25 32 81920 0.006578 0.057931 90.937435 0.019883 88.693296 13.303897 0.002619 1.068421 2.473927 0.047816 196.611803
26 32 163840 0.013450 0.066913 353.326283 0.277779 335.634578 40.514447 0.002510 2.205042 4.799176 0.094226 736.934404
27 64 640 0.000098 3.137050 0.005970 0.021180 0.000774 0.135892 0.021547 0.007026 0.057665 0.001299 3.388501
28 64 1280 0.000146 0.117692 0.011103 0.024396 0.004226 0.231617 0.014033 0.017569 1.063689 0.001352 1.485823
29 64 2560 0.000257 0.124294 0.044025 0.027633 0.016823 0.412599 0.012139 0.032466 0.366104 0.001566 1.037906
30 64 5120 0.000439 0.133266 0.162763 0.035967 0.062143 0.729474 0.007556 0.072923 0.444092 0.002378 1.651001
31 64 10240 0.000835 0.143408 0.484296 0.043193 0.289232 1.491684 0.006537 0.151762 0.557753 0.003945 3.172645
32 64 20480 0.001628 0.143842 1.637399 0.052083 1.343242 2.639828 0.008233 0.382438 0.763777 0.006970 6.979440
33 64 40960 0.003191 0.151864 6.773475 0.055905 5.427323 5.473404 0.008237 0.756517 1.126136 0.015386 19.791438
34 64 81920 0.006585 0.138980 24.022858 0.057274 23.964848 9.275323 0.008133 1.329275 2.303643 0.024827 61.131746
35 64 163840 0.013401 0.133437 91.969004 0.270681 86.636657 22.219153 0.008862 2.479931 4.676953 0.048509 208.456588

In [38]:
npts = [640, 1280, 2560, 5120, 10240, 20480, 81920, 163840]
ncores = [8, 16, 32, 64]

In [58]:
figsize(10,6)
for i in ncores:
    s = df.query('Cores == {}'.format(i))
    plot(s['Points'], s['Total'], 'o-', label='{}'.format(i))
legend(loc='best')
grid()
xlabel('Points')
ylabel('Time (s)')
title('Parallel Nearest Neighbor Search')


Out[58]:
<matplotlib.text.Text at 0x108df17d0>

In [91]:
df.iloc[:,2:-1].plot(kind='barh', stacked=True)


Out[91]:
<matplotlib.axes._subplots.AxesSubplot at 0x117b7c690>

In [88]:
df.iloc[7:8,2:-1]


Out[88]:
Data Generation Scatter and y-sort NN Search (y) x-sort NN Search (x) Iij & Cij Cij Sort and Comm. Local Reduction Ci Computation Final Sort
7 -5.016015 -4.708856 7.250586 -4.808263 7.245068 3.451695 -8.819518 0.605783 0.506948 -1.711199

In [ ]: