Commit b65870ca authored by Jakub Klemsa's avatar Jakub Klemsa
Browse files

Merge remote-tracking branch 'origin/master'

parents 9dc5ac3b 66cb2d9b
......@@ -8,8 +8,8 @@ That's indeed a bit tricky:
- run $ make run-numerical
- before adding results to git, run
$ cd results-noises_numerical
$ for i in `ls *-5.dat` ; do mv $i batch-$i ; done
$ for i in `ls *-5.yaml` ; do mv $i batch-$i ; done
$ for i in `ls *-<qw>.dat` ; do mv $i batch-$i ; done
$ for i in `ls *-<qw>.yaml` ; do mv $i batch-$i ; done
- process with (modified accordingly, no parameters implemented)
$ ./batch-results.rb
- in case it complains about missing results, inspect manually
......@@ -17,12 +17,9 @@ PLOT_WIDTH_PER_PARAMS = 130
#~ QW = ARGV[2].to_i
#~ MODE = ARGV[3].to_sym
#~ LAMBDAs = [80, 128]
#~ PIs = [2, 3, 4, 5, 6, 7]
#~ QWs = [5]
LAMBDAs = [80, 128]
PIs = [2, 3, 4, 5, 6]
QWs = [5]
PIs = [2, 3, 4, 5, 6, 7]
QWs = [5, 10, 20]
# output dirs & files
OUT_DIR = "out_batch"
......@@ -43,7 +40,8 @@ worst_time = 0
FileUtils.mkdir_p OUT_DIR
File.open(path_dat, 'w') do |file|
file.write "# t_med t_min N γ l n κ t logABK logAKS est. λ |BK| t_br_med |KSK| t_ks_med η_m η_C η_f V_0-cr λ π 2^2Δ\n"
file.write "# t_med t_min N γ l n κ t logABK logAKS est. λ η_m η_C η_f V_0-cr λ π 2^2Δ\n"
# omitted: ' |BK| t_br_med |KSK| t_ks_med'
file.write "# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n"
QWs.each do |qw|
......@@ -98,7 +96,8 @@ File.open(path_dat, 'w') do |file|
eta_formula = 300 * Math::sqrt(params[:_2Delta] * noises[:calc_V_0_formula] + calc_V_round) * (1 << (params[:pi] + 1))
file.write " %7.2f %7.2f %7d %3d %3d %7d %3d %3d %7d %7d %7.2f" % [times[:time_median_ms], times[:time_min_ms], params[:N], params[:gamma], params[:l], params[:n], params[:kappa], params[:t], params[:logABKnn], params[:logAKSn], [lambda_LWE, lambda_RLWE].min]
file.write " %11d %11.2f %11d %11.2f %7.1f %7.1f %7.1f %7.3f" % [key_sz[:bsk_size], times[:br_time_median_ms], key_sz[:ksk_size], times[:ks_time_median_ms], eta_meas, eta_concrete, eta_formula, params[:v0_corr]]
file.write " %7.1f %7.1f %7.1f %7.3f" % [eta_meas, eta_concrete, eta_formula, params[:v0_corr]]
# omitted: ' %11d %11.2f %11d %11.2f' % 'key_sz[:bsk_size], times[:br_time_median_ms], key_sz[:ksk_size], times[:ks_time_median_ms], '
file.write " %3d %3d %7d\n" % [lambda, pi, qw]
worst_time = times[:time_median_ms] > worst_time ? times[:time_median_ms] : worst_time
......@@ -112,9 +111,9 @@ puts "(i) Results written to '#{path_dat}'."
# run gnuplot script
plot_width = PLOT_WIDTH_PER_PARAMS * (PIs.size + 2)
y_tics = worst_time > 100 ? 5 : 2
y_tics = worst_time > 100 ? 20 : 10
#TODO read n_runs
#TODO multi-lambda support
system "gnuplot -c plot.sh #{path_dat} #{path_png} #{plot_width} #{-1} #{y_tics} #{QWs.size}"
# system "gnuplot -c plot-tex.sh #{path_dat} #{path_tex} #{plot_width} #{results.first[:bench][:n_runs]} #{y_tics}"
system "gnuplot -c multiplot.sh #{path_dat} #{path_png} #{plot_width} #{-1} #{y_tics} #{QWs.size}"
# system "gnuplot -c multiplot-tex.sh #{path_dat} #{path_tex} #{plot_width} #{results.first[:bench][:n_runs]} #{y_tics}"
puts "(i) Find plot in '#{path_png}'."
#!/usr/bin/env gnuplot
reset
# this can be used via: $ gnuplot -c plot.sh data.dat
RES = ARG1
OUT = ARG2
WID = ARG3
NRUNS = ARG4
YTICS = ARG5
QWS = ARG6
MAX_L = 16
set term pngcairo dashed size WID,700
set out OUT
set multiplot layout QWS, 1 margins 0.045,1.0,0.07,1.0 spacing 0,0.03
#~ set x2tics font ",10"
set ytics YTICS font ",10"
set grid ytics
#~ unset key
set key left top
set style fill solid 0.6 noborder
set boxwidth 0.8
set xrange [1.5:7.5]
set yrange [0:150]
#TODO resolve for multiplot
#~ set tmargin at screen 0.23
#~ set bmargin at screen 0.92
#~ set bars small
# x(pi):y(t_med):width(l):lc:xtic:x2tic
do for [qwi=0:QWS-1] {
if (qwi==QWS-1) {
set xtics font ",10" # rotate by 10 right right offset 8,-.5
set title "2^{2Delta} = 20" offset 0,-3
} else {
unset xtics
set title "2^{2Delta} = ".((qwi+1)*5) offset 0,-3
}
plot RES index qwi u ($17+($16==80?-.2:.2)):1:($5/MAX_L):($3==512?2:($3==1024?4:($3==2048?7:8))):xtic("\nλ ≈ ".stringcolumn(16)) w boxes lc variable notitle, \
RES index qwi u ($17):(NaN):xtic("π = ".stringcolumn(17)) w l notitle, \
NaN w boxes lc 2 title "N = 512", \
NaN w boxes lc 4 title "N = 1 024", \
NaN w boxes lc 7 title "N = 2 048"
# :x2tic(stringcolumn(1)." ms")
}
# color by N and lambda: ($16==80?($3==512?3:($3==1024?2:($3==2048?5:4))):($3==512?6:($3==1024?7:($3==2048?9:8))))
# $3==512?6:($3==1024?7:($3==2048?9:8)) # blue, red, violet (dark gray)
# $3==512?3:($3==1024?2:($3==2048?5:4)) # blue, green, yellow
unset multiplot
# t_med t_min N γ l n κ t logABK logAKS est. λ |BK| t_br_med |KSK| t_ks_med η_m η_C η_f V_0-cr λ π 2^2Δ
# t_med t_min N γ l n κ t logABK logAKS est. λ η_m η_C η_f V_0-cr λ π 2^2Δ
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
57.29 57.10 1024 9 2 554 2 5 -24 -13 127.10 72613944 48.15 22732856 9.13 92.6 98.0 103.9 1.100 128 2 5
29.57 29.43 1024 19 1 395 4 3 -38 -15 80.60 25886776 25.65 9732152 3.92 87.2 87.2 88.9 0.826 80 3 5
64.02 63.72 1024 8 2 639 3 4 -24 -15 129.10 83755064 55.63 20971576 8.39 95.9 97.9 103.0 1.100 128 3 5
31.60 31.47 1024 18 1 422 4 3 -38 -16 81.00 27656248 27.41 10395704 4.19 88.6 95.8 102.4 1.100 80 4 5
82.25 82.03 1024 6 3 639 2 6 -24 -15 129.10 125632568 69.69 31457336 12.56 90.5 93.1 100.2 1.000 128 4 5
36.52 36.37 1024 18 1 448 3 5 -38 -17 81.10 29360184 29.14 18391096 7.38 81.0 83.8 87.2 0.826 80 5 5
118.12 117.60 2048 24 1 724 3 5 -48 -17 130.50 94896184 94.31 59392056 23.81 86.0 86.7 87.6 0.826 128 5 5
78.22 77.90 2048 38 1 500 4 4 -77 -19 72.00 65536056 65.06 32833592 13.16 25480.9 92.4 93.2 0.826 80 6 5
132.06 131.59 2048 23 1 809 3 5 -48 -19 131.80 106037304 105.38 66355256 26.68 88.3 89.6 92.9 0.826 128 6 5
25.33 25.25 512 4 4 343 2 5 -19 -13 80.10 74.9 74.9 79.0 0.621 80 2 5
57.29 57.10 1024 9 2 554 2 5 -24 -13 127.10 92.6 98.0 103.9 1.100 128 2 5
29.57 29.43 1024 19 1 395 4 3 -38 -15 80.60 87.2 87.2 88.9 0.826 80 3 5
64.02 63.72 1024 8 2 639 3 4 -24 -15 129.10 95.9 97.9 103.0 1.100 128 3 5
31.60 31.47 1024 18 1 422 4 3 -38 -16 81.00 88.6 95.8 102.4 1.100 80 4 5
82.25 82.03 1024 6 3 639 2 6 -24 -15 129.10 90.5 93.1 100.2 1.000 128 4 5
36.52 36.37 1024 18 1 448 3 5 -38 -17 81.10 81.0 83.8 87.2 0.826 80 5 5
118.12 117.60 2048 24 1 724 3 5 -48 -17 130.50 86.0 86.7 87.6 0.826 128 5 5
78.22 77.90 2048 38 1 500 4 4 -77 -19 72.00 25480.9 92.4 93.2 0.826 80 6 5
132.06 131.59 2048 23 1 809 3 5 -48 -19 131.80 88.3 89.6 92.9 0.826 128 6 5
26.72 26.63 512 4 4 369 3 4 -19 -14 80.20 95.1 97.9 98.8 0.683 80 2 10
59.64 59.40 1024 8 2 596 3 4 -24 -14 128.10 86.8 90.1 92.8 0.909 128 2 10
30.92 30.76 1024 19 1 395 3 4 -38 -15 80.60 68.9 75.3 79.2 0.826 80 3 10
76.90 76.70 1024 6 3 596 2 6 -24 -14 128.10 94.2 99.4 102.7 1.100 128 3 10
33.08 32.93 1024 18 1 422 3 4 -38 -16 81.00 89.5 90.9 104.1 1.100 80 4 10
89.93 89.65 1024 6 3 681 2 7 -24 -16 129.80 91.8 93.7 96.5 0.909 128 4 10
37.16 36.98 1024 18 1 474 4 4 -38 -18 81.20 97.7 98.0 103.5 1.100 80 5 10
121.99 121.59 2048 23 1 809 5 3 -48 -19 131.80 99.7 93.9 95.5 0.909 128 5 10
81.83 81.52 2048 39 1 500 3 5 -77 -19 72.00 34765.9 88.7 95.0 0.909 80 6 10
134.18 133.58 2048 24 1 852 4 4 -48 -20 132.50 92.8 94.4 96.0 0.826 128 6 10
29.58 29.32 1024 19 1 395 4 3 -38 -15 80.60 88.4 86.4 88.1 0.826 80 2 20
64.19 63.89 1024 8 2 639 3 4 -24 -15 129.10 91.8 96.8 101.9 1.000 128 2 20
31.75 31.52 1024 19 1 422 4 3 -38 -16 81.00 87.4 92.8 99.0 1.000 80 3 20
82.58 82.20 1024 6 3 639 2 6 -24 -15 129.10 83.5 88.3 95.7 0.909 128 3 20
35.76 35.52 1024 18 1 474 5 3 -38 -18 81.20 94.3 93.1 96.3 0.909 80 4 20
105.19 104.78 1024 5 4 681 2 7 -24 -16 129.80 91.8 96.6 98.3 1.000 128 4 20
38.81 38.62 1024 18 1 474 3 5 -38 -18 81.20 91.1 97.5 109.4 1.331 80 5 20
125.02 124.48 2048 24 1 766 3 5 -48 -18 131.20 85.4 89.6 92.9 0.909 128 5 20
82.49 82.12 2048 38 1 527 4 4 -77 -20 72.00 49916.6 95.8 98.8 1.000 80 6 20
140.13 139.44 2048 24 1 894 4 4 -48 -21 132.90 90.3 91.3 94.6 0.826 128 6 20
......@@ -8,7 +8,6 @@ OUT = ARG2
WID = ARG3
NRUNS = ARG4
YTICS = ARG5
QWS = ARG6
#~ RES = 'sample.dat'
#~ OUT = 'sample.png'
#~ WID = 1800
......@@ -68,8 +67,6 @@ set term epslatex size 25.9cm,10cm color colortext standalone font 10 header \
set out OUT
set multiplot layout QWS, 1
set xtics font ",8" right offset 6,-6
set x2tics font ",8"
set mytics 2
......@@ -93,12 +90,8 @@ set rmargin at screen 0.999
#~ set bars small
# x(row):y(t_med):err(t_med-t_min):width(l):lc:xtic
do for [qwi=0:QWS-1] {
plot RES index qwi u 0:1:($1-$2):($5/MAX_L):($3==512?3:($3==1024?2:($3==2048?5:4))):xtic('\Longstack[r]{$N = '.stringcolumn(3).', \gamma = '.stringcolumn(4).'$\\$n = '.stringcolumn(6).', l = '.stringcolumn(5).'$\\$\kappa = '.stringcolumn(7).', t = '.stringcolumn(8).'$\\$\log(BK) = '.stringcolumn(9).'$\\$\log(KS) = '.stringcolumn(10).'$\\$\lambda \approx '.stringcolumn(11).'$\\$\eta_m = '.stringcolumn(16).'\%$\\$\eta_C = '.stringcolumn(17).'\%$\\$\eta_f = '.stringcolumn(18).'\%$\\$V_{0\text{-corr}} = '.stringcolumn(19).'$}'):x2tic('$'.stringcolumn(1).'$\,ms') w boxerrorbars lc variable, \
'' u ($0):($15):($5/MAX_L/2):(0) w xerr pointtype 0 lc variable, \
'' u ($0+$5/MAX_L/2+RATIO_WID/2):($12*bs_ratio($5)+$14*KS_RATIO):(RATIO_WID):(6) w boxes lc variable, \
'' u ($0+$5/MAX_L/2+RATIO_WID/2):($14*KS_RATIO):(RATIO_WID):(4) w boxes lc variable
}
unset multiplot
# x(row):y(t_med):err(t_med-t_min):width(l):lc:xtic
plot RES index qwi u 0:1:($1-$2):($5/MAX_L):($3==512?3:($3==1024?2:($3==2048?5:4))):xtic('\Longstack[r]{$N = '.stringcolumn(3).', \gamma = '.stringcolumn(4).'$\\$n = '.stringcolumn(6).', l = '.stringcolumn(5).'$\\$\kappa = '.stringcolumn(7).', t = '.stringcolumn(8).'$\\$\log(BK) = '.stringcolumn(9).'$\\$\log(KS) = '.stringcolumn(10).'$\\$\lambda \approx '.stringcolumn(11).'$\\$\eta_m = '.stringcolumn(16).'\%$\\$\eta_C = '.stringcolumn(17).'\%$\\$\eta_f = '.stringcolumn(18).'\%$\\$V_{0\text{-corr}} = '.stringcolumn(19).'$}'):x2tic('$'.stringcolumn(1).'$\,ms') w boxerrorbars lc variable, \
'' u ($0):($15):($5/MAX_L/2):(0) w xerr pointtype 0 lc variable, \
'' u ($0+$5/MAX_L/2+RATIO_WID/2):($12*bs_ratio($5)+$14*KS_RATIO):(RATIO_WID):(6) w boxes lc variable, \
'' u ($0+$5/MAX_L/2+RATIO_WID/2):($14*KS_RATIO):(RATIO_WID):(4) w boxes lc variable
......@@ -8,7 +8,6 @@ OUT = ARG2
WID = ARG3
NRUNS = ARG4
YTICS = ARG5
QWS = ARG6
#~ RES = 'sample.dat'
#~ OUT = 'sample.png'
#~ WID = 1800
......@@ -65,8 +64,6 @@ MAX_L = 16
set term pngcairo dashed size WID,900
set out OUT
set multiplot layout QWS, 1
set xtics font ",10" rotate by 10 right right offset 8,-.5
set x2tics font ",10"
set ytics YTICS font ",10"
......@@ -89,12 +86,8 @@ set bmargin at screen 0.92
set title "# of runs = ".NRUNS
# x(row):y(t_med):err(t_med-t_min):width(l):lc:xtic
do for [qwi=0:QWS-1] {
plot RES index qwi u 0:1:($1-$2):($5/MAX_L):($3==512?3:($3==1024?2:($3==2048?5:4))):xtic("N = ".stringcolumn(3).", γ = ".stringcolumn(4)."\nn = ".stringcolumn(6).", l = ".stringcolumn(5)."\nκ = ".stringcolumn(7).", t = ".stringcolumn(8)."\nlog(BK) = ".stringcolumn(9)."\nlog(KS) = ".stringcolumn(10)."\nλ ≈ ".stringcolumn(11)."\nη m = ".stringcolumn(16)."%\nη C = ".stringcolumn(17)."%\nη f = ".stringcolumn(18)."%\nV0-c = ".stringcolumn(19)):x2tic(stringcolumn(1)." ms") w boxerrorbars lc variable, \
'' u ($0):($15):($5/MAX_L/2):(0) w xerr pointtype 0 lc variable, \
'' u ($0+$5/MAX_L/2+RATIO_WID/2):($12*bs_ratio($5)+$14*KS_RATIO):(RATIO_WID):(6) w boxes lc variable, \
'' u ($0+$5/MAX_L/2+RATIO_WID/2):($14*KS_RATIO):(RATIO_WID):(4) w boxes lc variable
}
unset multiplot
# x(row):y(t_med):err(t_med-t_min):width(l):lc:xtic
plot RES index qwi u 0:1:($1-$2):($5/MAX_L):($3==512?3:($3==1024?2:($3==2048?5:4))):xtic("N = ".stringcolumn(3).", γ = ".stringcolumn(4)."\nn = ".stringcolumn(6).", l = ".stringcolumn(5)."\nκ = ".stringcolumn(7).", t = ".stringcolumn(8)."\nlog(BK) = ".stringcolumn(9)."\nlog(KS) = ".stringcolumn(10)."\nλ ≈ ".stringcolumn(11)."\nη m = ".stringcolumn(16)."%\nη C = ".stringcolumn(17)."%\nη f = ".stringcolumn(18)."%\nV0-c = ".stringcolumn(19)):x2tic(stringcolumn(1)." ms") w boxerrorbars lc variable, \
'' u ($0):($15):($5/MAX_L/2):(0) w xerr pointtype 0 lc variable, \
'' u ($0+$5/MAX_L/2+RATIO_WID/2):($12*bs_ratio($5)+$14*KS_RATIO):(RATIO_WID):(6) w boxes lc variable, \
'' u ($0+$5/MAX_L/2+RATIO_WID/2):($14*KS_RATIO):(RATIO_WID):(4) w boxes lc variable
......@@ -95,7 +95,6 @@ puts "(i) Results written to '#{path_dat}'."
# run gnuplot script
plot_width = PLOT_WIDTH_PER_PARAMS * (results.size + 2)
y_tics = worst_time > 100 ? 5 : 2
N_DATA_SETS = 1 # only used for batch mode
system "gnuplot -c plot.sh #{path_dat} #{path_png} #{plot_width} #{results.first[:bench][:n_runs]} #{y_tics} #{N_DATA_SETS}"
system "gnuplot -c plot.sh #{path_dat} #{path_png} #{plot_width} #{results.first[:bench][:n_runs]} #{y_tics}"
#~ system "gnuplot -c plot-tex.sh #{path_dat} #{path_tex} #{plot_width} #{results.first[:bench][:n_runs]} #{y_tics}"
puts "(i) Find plot in '#{path_png}'."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment