using Plots

timings = #Data from julia.mit.edu
Dict(
     1 => ( 15.585,  15.721),
     2 => ( 16.325,  15.893),
     3 => ( 32.079,  31.678),
     4 => ( 46.037,  33.257),
     5 => ( 61.947,  51.412),
     6 => ( 77.247,  50.769),
     7 => ( 92.588,  67.796),
     8 => (108.057,  65.185),
     9 => (123.556,  68.197),
    10 => (138.408,  66.658),
    11 => (153.392,  82.580),
    12 => (168.874,  83.373),
    13 => (184.227,  82.875),
    14 => (199.741,  83.098),
    15 => (215.881, 101.271),
    16 => (230.531, 104.860),
    17 => (246.576, 103.229),
    18 => (261.412, 102.497),
    19 => (276.926, 103.367),
    20 => (294.404, 104.162),
    21 => (308.995, 104.944),
    22 => (323.287, 104.838),
    23 => (340.173, 121.495),
    24 => (353.717, 119.729),
    25 => (369.113, 120.281),
    26 => (384.638, 118.710),
    27 => (402.484, 119.237),
    28 => (417.036, 119.980),
    29 => (431.273, 120.463),
    30 => (446.288, 120.560),
    31 => (461.756, 137.209),
    32 => (476.653, 135.873),
    33 => (493.989, 138.150),
    34 => (508.089, 137.998),
    35 => (523.703, 139.059),
    36 => (539.305, 135.201),
    37 => (554.201, 138.242),
    38 => (569.276, 137.470),
    39 => (585.268, 137.261),
    40 => (599.921, 137.871),
    41 => (615.718, 137.887),
    42 => (632.463, 137.579),
    43 => (647.355, 138.181),
    44 => (664.344, 139.917),
    45 => (678.899, 138.382),
    46 => (695.815, 138.354),
    47 => (717.068, 154.826),
    48 => (730.902, 155.603),
    49 => (745.608, 154.549),
    50 => (756.012, 154.244),
    51 => (769.611, 154.000),
    52 => (793.350, 152.893),
    53 => (801.568, 155.276),
    54 => (818.174, 153.436),
    55 => (832.994, 155.923),
    56 => (849.526, 155.721),
    57 => (863.337, 155.289),
    58 => (881.577, 156.188),
    59 => (893.735, 157.889),
    60 => (911.597, 155.557),
    61 => (925.117, 157.048),
    62 => (940.897, 153.338),
    63 => (954.825, 173.942),
    64 => (990.757, 173.236),
    65 => (987.457, 172.005),
    66 => (1009.688, 173.869),
    67 => (1022.357, 173.303),
    68 => (1043.536, 175.044),
    69 => (1052.156, 173.361),
    70 => (1067.174, 172.230),
    71 => (1079.543, 173.491),
    72 => (1101.516, 174.311),
    73 => (1119.993, 174.057),
    74 => (1136.092, 175.804),
    75 => (1154.758, 175.075),
    76 => (1170.732, 173.453),
    77 => (1184.598, 171.936),
    78 => (1190.922, 172.809),
    79 => (1204.645, 172.878),
)

gflops = zeros(79)
gflopsser = zeros(79)
N = 4096
for (k, (t1, t2)) in timings
    gflops[k] = k*(2*N^3)/t2*1e-9
    gflopsser[k] = k*(2*N^3)/t1*1e-9
end

plot(1:79, gflops, xlabel="#cores", ylabel="GFlops", label="parallel prefix")
plot!(1:79, gflopsser, label="serial")
png("../plots/flops-prefix")

