Commit e36bdd57 by Philipp Meyer

parent 527ea2e8
 ... ... @@ -19,6 +19,7 @@ benchmarks/**/*.pnet benchmarks/**/*.out benchmarks/**/*.list benchmarks/**/*.list.sorted benchmarks/**/*.pdf # Binaries slapnet ... ...
 #!/usr/bin/python3 import sys import random def make_net(n,order): def previous(i): return (((i-2) % n) + 1) print('petri net "leader election %i" {' % n) print(' places {') for i in range(1,n+1): print(' ', end='') for j in range(1,n+1): print('s%in%i ' % (i,j), end='') print() print(' ', end='') for j in range(1,n+1): print('s%im%i ' % (i,j), end='') print() print() print(' lead') print(' }') print(' transitions {') for i in range(1,n+1): print(' ', end='') for j in range(1,n+1): print('s%isend%i ' % (i,j), end='') print() print(' ', end='') for j in range(1,n+1): if j < i: print('s%idisc%i ' % (i,j), end='') elif i == j: print('s%iacpt%i ' % (i,j), end='') else: print('s%ipass%i ' % (i,j), end='') print() print() print(' newleader') print(' }') print(' arcs {') for i in range(1,n+1): for j in range(1,n+1): print(' s%in%i -> s%isend%i -> s%im%i' % (i,j,i,j,i,j)) print() for j in range(1,n+1): print(' s%im%i -> ' % (previous(i),j), end='') if j < i: print('s%idisc%i ' % (i,j)) elif i == j: print('s%iacpt%i -> lead' % (i,j)) else: print('s%ipass%i -> s%im%i' % (i,j,i,j)) print() print() print(' lead -> newleader -> { ', end='') for i in range(1,n+1): print('s%in%i ' % (i,order[i-1]), end='') print('}') print(' }') print(' initial { ', end='') for i in range(1,n+1): print('s%in%i ' % (i,order[i-1]), end='') print('}') print('}') #print('safety property {') #print(' lead >= 2') #print('}') print('liveness property {') print(' newleader = 0') print('}') n = int(sys.argv[1]) o = sys.argv[2] order = list(range(1,n+1)) if o == 'rand': random.shuffle(order) elif o == 'rev': order.reverse() make_net(n,order)
 #!/usr/bin/bash n=\$1 #orders=(ord rand rev) orders=(ord) for o in \${orders[@]}; do for i in \$(seq 1 \$n); do echo "Creating net for n = \$i with order \$o" ./make_net.py \$i \$o > "n\$i-\$o.pnet" done done
 #!/usr/bin/python3 import sys import random def make_net(n,order): def previous(i): return (((i-2) % n) + 1) print('petri net "improved leader election %i" {' % n) print(' places {') for i in range(1,n+1): print(' s%ia0 s%ia1 s%ia2 s%iaH s%iaP s%iaD' % (i,i,i,i,i,i)) print(' ', end='') for j in range(1,n+1): print('s%imax%i ' % (i,j), end='') print() print(' ', end='') for j in range(0,n+1): print('s%ileft%i ' % (i,j), end='') print() print(' s%im1_n ' % i, end='') for j in range(1,n+1): print('s%im1_%i ' % (i,j), end='') print() print(' s%im2_n ' % i, end='') for j in range(1,n+1): print('s%im2_%i ' % (i,j), end='') print() print() print(' }') print(' transitions {') for i in range(1,n+1): print(' ', end='') for j in range(1,n+1): print('s%ia0send%i ' % (i,j), end='') print() print() for j in range(1,n+1): print(' ', end='') for vmax in range(1,n+1): if j == vmax: print('s%ia1rec%imax%i ' % (i,j,vmax), end='') else: for left in range(0,n+1): print('s%ia1rec%imax%ileft%i ' % (i,j,vmax,left), end='') print() print() for j in range(1,n+1): print(' ', end='') for left in range(0,n+1): if left <= 1: print('s%ia2rec%ileft%i ' % (i,j,left), end='') else: for vmax in range(1,n+1): print('s%ia2rec%imax%ileft%i ' % (i,j,vmax,left), end='') print() print() print(' ', end='') for j in range(1,n+1): print('s%iaPrec1_%i s%iaPrec2_%i ' % (i,j,i,j), end='') print() print() print(' ', end='') for vmax in range(1,n+1): for left in range(0,n+1): print('s%iaDmax%ileft%i ' % (i,vmax,left), end='') print() print() print() print(' ', end='') for i in range(1,n+1): print('s%idone ' % i, end='') print() print(' }') print(' arcs {') for i in range(1,n+1): for j in range(1,n+1): print(' { s%ia0 s%imax%i s%im1_n } -> s%ia0send%i -> { s%ia1 s%imax%i s%im1_%i }' % (i,i,j,i,i,j,i,i,j,i,j)) print() for j in range(1,n+1): for vmax in range(1,n+1): if j == vmax: print(' { s%ia1 s%imax%i s%im1_%i } -> s%ia1rec%imax%i -> { s%iaH s%imax%i s%im1_n }' % (i,i,vmax,previous(i),j,i,j,vmax,i,i,vmax,previous(i))) else: for left in range(0,n+1): print(' { s%ia1 s%imax%i s%ileft%i s%im1_%i s%im2_n } -> s%ia1rec%imax%ileft%i -> { s%ia2 s%imax%i s%ileft%i s%im1_n s%im2_%i }' % (i,i,vmax,i,left,previous(i),j,i,i,j,vmax,left,i,i,vmax,i,j,previous(i),i,j)) print() for j in range(1,n+1): for left in range(0,n+1): if left <= 1: print(' { s%ia2 s%ileft%i s%im2_%i } -> s%ia2rec%ileft%i -> { s%iaP s%ileft%i s%im2_n }' % (i,i,left,previous(i),j,i,j,left,i,i,left,previous(i))) else: for vmax in range(1,n+1): if left > j and left > vmax: print(' { s%ia2 s%imax%i s%ileft%i s%im2_%i s%im1_n } -> s%ia2rec%imax%ileft%i -> { s%ia1 s%imax%i s%ileft%i s%im2_n s%im1_%i }' % (i,i,vmax,i,left,previous(i),j,i,i,j,vmax,left,i,i,left,i,left,previous(i),i,left)) else: print(' { s%ia2 s%imax%i s%ileft%i s%im2_%i } -> s%ia2rec%imax%ileft%i -> { s%iaP s%imax%i s%ileft%i s%im2_n }' % (i,i,vmax,i,left,previous(i),j,i,j,vmax,left,i,i,vmax,i,left,previous(i))) print() for j in range(1,n+1): print(' { s%iaP s%im1_%i s%im1_n } -> s%iaPrec1_%i -> { s%iaP s%im1_n s%im1_%i }' % (i,previous(i),j,i,i,j,i,previous(i),i,j)) print(' { s%iaP s%im2_%i s%im2_n } -> s%iaPrec2_%i -> { s%iaP s%im2_n s%im2_%i }' % (i,previous(i),j,i,i,j,i,previous(i),i,j)) print() for vmax in range(1,n+1): for left in range(0,n+1): print(' { s%iaD s%imax%i s%ileft%i } -> s%iaDmax%ileft%i -> { s%ia0 s%imax%i s%ileft0 }' % (i,i,vmax,i,left,i,vmax,left,i,i,order[i-1],i)) print() print() for i in range(1,n+1): print(' { ', end='') for j in range(1,i): print('s%iaP ' % j, end='') print('s%iaH ' % i, end='') for j in range(i+1,n+1): print('s%iaP ' % j, end='') print('} -> s%idone -> { ' % i, end='') for j in range(1,n+1): print('s%iaD ' % j, end='') print('}') print(' }') print(' initial {') for i in range(1,n+1): print(' s%ia0 s%imax%i s%ileft0 s%im1_n s%im2_n' % (i,i,order[i-1],i,i,i)) print(' }') print('}') print('liveness property {') print(' ', end='') for i in range(1,n+1): print('s%idone = 0' % i, end='') if i < n: print(' && ', end='') print() print('}') n = int(sys.argv[1]) o = sys.argv[2] order = list(range(1,n+1)) if o == 'rand': random.shuffle(order) elif o == 'rev': order.reverse() make_net(n,order)
 #!/usr/bin/bash n=\$1 for i in \$(seq 1 \$n); do echo "Creating net for n = \$i" ./make_net.py \$i "ord" > "n\$i.pnet" done
 #!/usr/bin/python3 import sys import random def make_net(n,comm): def previous(i): return (((i-2) % n) + 1) def next(i): return ((i % n) + 1) print('petri net "snapshot %i" {' % n) print(' places {') for i in range(1,n+1): print(' white%i red%i sent%i notsent%i sample%i nosample%i' % (i,i,i,i,i,i)) print() print(' }') print(' transitions {') for i in range(1,n+1): print(' init%i send%iwhite%i send%ired%i' % (i,i,next(i),i,next(i)), end='') if comm: print(' comm%ired' % i) else: print() print() print(' snapshot ', end='') for i in range(1,n+1): print('nosnapshot%i ' % (i), end='') print() print(' }') print(' arcs {') for i in range(1,n+1): if comm: print(' { red%i sent%i } -> comm%ired -> { red%i sent%i }' % (i,i,i,i,i)) print(' { white%i nosample%i } -> init%i -> { red%i sample%i }' % (i,i,i,i,i)) print(' { red%i notsent%i white%i nosample%i } -> send%iwhite%i -> { red%i sent%i red%i sample%i }' % (i,i,next(i),next(i),i,next(i),i,i,next(i),next(i))) print(' { red%i notsent%i red%i } -> send%ired%i -> { red%i sent%i red%i }' % (i,i,next(i),i,next(i),i,i,next(i))) print() print(' { ', end='') for i in range(1,n+1): print('sample%i red%i sent%i ' % (i,i,i), end='') print('} -> snapshot -> { ', end='') for i in range(1,n+1): print('nosample%i white%i notsent%i ' % (i,i,i), end='') print('}') for i in range(1,n+1): print(' nosample%i -> nosnapshot%i -> nosample%i' % (i,i,i)) print(' }') print(' initial {') for i in range(1,n+1): print(' white%i notsent%i nosample%i ' % (i,i,i)) print(' }') print('}') print('liveness property {') for i in range(1,n+1): print(' init%i + send%iwhite%i + send%ired%i' % (i,i,next(i),i,next(i)), end='') if comm: print(' + comm%ired' % i, end='') print(' > 0 &&') print(' snapshot', end='') for i in range(1,n+1): print(' + nosnapshot%i' % i, end='') print(' > 0 &&') print(' snapshot = 0') print('}') n = int(sys.argv[1]) o = sys.argv[2] if o == 'nocomm': make_net(n,False) else: make_net(n,True)
 #!/usr/bin/bash n=\$1 comms=(comm nocomm) for c in \${comms[@]}; do for i in \$(seq 1 \$n); do echo "Creating net for n = \$i with \$c" ./make_net.py \$i \$c > "n\$i-\$c.pnet" done done
 #!/usr/bin/bash #folder="LeaderElectionDKR82" folder="Snapshot" suffix="-comm" n=100 m=2 bf="\${folder}/benchmark\${suffix}.out" echo "n user system memory" >\$bf for i in \$(seq 1 \$n); do net="\${folder}/n\${i}\${suffix}.pnet" echo "Testing net \$net" for j in \$(seq 1 \$m); do echo -n "\$i " >>\$bf /usr/bin/time -f "%U %S %M" -a -o \$bf ../slapnet \$net > "\${net}.out" done done
 #!/usr/bin/Rscript library("data.table") library("Hmisc") #folders <- c("LeaderElectionCR79", "LeaderElectionDKR82") folders <- c("LeaderElectionDKR82") for (folder in folders) { infile <- paste(folder, "benchmark.out", sep="/") outfile <- paste(folder, "benchmark-agg.out", sep="/") timePlotFile <- paste(folder, "benchmark-time.pdf", sep="/") memoryPlotFile <- paste(folder, "benchmark-memory.pdf", sep="/") dataframe <- read.table(infile, header=TRUE) datatable <- data.table(dataframe) data <- datatable[,list(time=mean(user+system),err_time=sd(user+system),memory=mean(memory),err_memory=sd(memory)),by=n] write.table(data, file=outfile, row.names=FALSE) pdf(timePlotFile) plot(data\$n,data\$time,type="p",xlab="n",ylab="time (s)",main="Benchmark time consumption") #with(data=data, expr=errbar(n, time, time+err_time, time-err_time, add=T, pch=1, cap=.1)) dev.off() pdf(memoryPlotFile) plot(data\$n,data\$memory,type="p",xlab="n",ylab="memory (KiB)",main="Benchmark memory consumption") #with(data=data, expr=errbar(n, memory, memory+err_memory, memory-err_memory, add=T, pch=1, cap=.1)) dev.off() }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!