Skip to content

Commit 9868393

Browse files
committed
updated bencher
1 parent 8fe3289 commit 9868393

11 files changed

+298
-138
lines changed

scripts/bench.py

+57-60
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def linesinfile(file_name):
9696
threads = list()
9797
exp = 0
9898
max_threads = int(args.threads)
99+
plot_data = list()
99100
start_threads = int(args.startthreads)
100101
base = int(args.base)
101102
if base == 1:
@@ -142,10 +143,10 @@ def linesinfile(file_name):
142143
if int(args.alg) == 4:
143144
if start_threads == 1:
144145
methods = ['Raw sequential','pThread 1D','Open MP parallel sections',
145-
'KAAPIC 1D','Intel TBB Invoke']
146+
'KAAPIC Spawn','Intel TBB Invoke']
146147
else :
147148
methods = ['pThread 1D','Open MP parallel sections',
148-
'KAAPIC 1D','Intel TBB Invoke']
149+
'KAAPIC Spawn','Intel TBB Invoke']
149150

150151
# lists for all methods we have, those are lists of lists:
151152
# e.g. time_series[i] is a list of len(threads) elements of the timings
@@ -170,23 +171,23 @@ def linesinfile(file_name):
170171
# generate random matrices without timestamp if no increasing is done
171172
if int(args.inc) == -1:
172173
if int(args.alg) == 1:
173-
os.system('../../src/f4rt -G -R '+args.rowsa+' -C '+args.colsa)
174-
os.system('../../src/f4rt -G -R '+args.colsa+' -C '+args.colsb)
174+
os.system('/home/eder/repos/devel-F4RT/src/f4rt -G -R '+args.rowsa+' -C '+args.colsa)
175+
os.system('/home/eder/repos/devel-F4RT/src/f4rt -G -R '+args.colsa+' -C '+args.colsb)
175176
else :
176-
os.system('../../src/f4rt -G -R '+args.rowsa+' -C '+args.colsa)
177+
os.system('/home/eder/repos/devel-F4RT/src/f4rt -G -R '+args.rowsa+' -C '+args.colsa)
177178

178179
bench_file = "bench-"+str(hash_value)
179180
f = open(bench_file,"w")
180181

181-
strstr = '../../src/f4rt -'+algorithm+' \
182+
strstr = '/home/eder/repos/devel-F4RT/src/f4rt -'+algorithm+' \
182183
-A random-mat-'+args.rowsa+'-'+args.colsa+'.mat '
183184
if int(args.alg) == 1:
184185
strstr += '-B random-mat-'+args.colsa+'-'+args.colsb+'.mat'
185186

186187
thrds_str = str(threads)
187188
thrds_str = thrds_str.replace('[','')
188189
thrds_str = thrds_str.replace(']','')
189-
thrds_str = thrds_str
190+
plot_data = thrds_str
190191
if int(args.alg) == 1:
191192
f.write(args.rowsa+','+args.colsa+','+args.colsb+'\r\n')
192193
else :
@@ -289,14 +290,16 @@ def linesinfile(file_name):
289290
rowSizes.append(rows)
290291
cols = int(args.colsa) + k * int(args.inc)
291292
colSizes.append(cols)
292-
os.system('../../src/f4rt -G -R '+str(rows)+' -C '+str(cols))
293+
plot_data.append(str(rowSizes[k])+'/'+str(colSizes[k]))
294+
os.system('/home/eder/repos/devel-F4RT/src/f4rt -G -R '+str(rows)+' -C '+str(cols))
293295
else:
294296
for k in range(0,int(args.count)+1):
295297
rows = (2**k) * int(args.rowsa)
296298
rowSizes.append(rows)
297299
cols = (2**k) * int(args.colsa)
298300
colSizes.append(cols)
299-
os.system('../../src/f4rt -G -R '+str(rows)+' -C '+str(cols))
301+
os.system('/home/eder/repos/devel-F4RT/src/f4rt -G -R '+str(rows)+' -C '+str(cols))
302+
plot_data.append(str(rowSizes[k])+'/'+str(colSizes[k]))
300303

301304
bench_file = "bench-"+str(hash_value)
302305
f = open(bench_file,"w")
@@ -314,7 +317,7 @@ def linesinfile(file_name):
314317
block = 256
315318
if int(max_threads) == 1:
316319
for k in range(0,int(args.count)+1):
317-
strstr = '../../src/f4rt -'+algorithm+' \
320+
strstr = '/home/eder/repos/devel-F4RT/src/f4rt -'+algorithm+' \
318321
-A random-mat-'+str(rowSizes[k])+'-'+str(colSizes[k])+'.mat '
319322

320323
print(strstr+' -m0 >> '+bench_file+'...')
@@ -324,7 +327,7 @@ def linesinfile(file_name):
324327
# pThread computations 1D outer
325328
block = 128
326329
for k in range(0,int(args.count)+1):
327-
strstr = '../../src/f4rt -'+algorithm+' \
330+
strstr = '/home/eder/repos/devel-F4RT/src/f4rt -'+algorithm+' \
328331
-A random-mat-'+str(rowSizes[k])+'-'+str(colSizes[k])+'.mat -b '+str(block)
329332

330333
print(strstr+' -m4 -t '+str(max_threads)+' >> bench-'+str(hash_value)+'...')
@@ -334,7 +337,7 @@ def linesinfile(file_name):
334337
# OpenMP computations 1D outer
335338
block = 256
336339
for k in range(0,int(args.count)+1):
337-
strstr = '../../src/f4rt -'+algorithm+' \
340+
strstr = '/home/eder/repos/devel-F4RT/src/f4rt -'+algorithm+' \
338341
-A random-mat-'+str(rowSizes[k])+'-'+str(colSizes[k])+'.mat -b '+str(block)
339342

340343
print(strstr+' -m1 -d 1 -t '+str(max_threads)+' >> bench-'+str(hash_value)+'...')
@@ -344,7 +347,7 @@ def linesinfile(file_name):
344347
# KAAPIC computations 1D
345348
block = 64
346349
for k in range(0,int(args.count)+1):
347-
strstr = '../../src/f4rt -'+algorithm+' \
350+
strstr = '/home/eder/repos/devel-F4RT/src/f4rt -'+algorithm+' \
348351
-A random-mat-'+str(rowSizes[k])+'-'+str(colSizes[k])+'.mat -b '+str(block)
349352

350353
print('KAAPI_CPUCOUNT='+str(max_threads)+' '+strstr+' -m3 -t '+str(max_threads)+' >> bench-'+str(hash_value)+'...')
@@ -354,7 +357,7 @@ def linesinfile(file_name):
354357
# TBB computations 1D auto
355358
block = 32
356359
for k in range(0,int(args.count)+1):
357-
strstr = '../../src/f4rt -'+algorithm+' \
360+
strstr = '/home/eder/repos/devel-F4RT/src/f4rt -'+algorithm+' \
358361
-A random-mat-'+str(rowSizes[k])+'-'+str(colSizes[k])+'.mat -b '+str(block)
359362

360363
print(strstr+' -m2 -t '+str(max_threads)+' >> bench-'+str(hash_value)+'...')
@@ -364,7 +367,7 @@ def linesinfile(file_name):
364367
if int(args.alg) != 4:
365368
# TBB computations 1D affinity
366369
for k in range(0,int(args.count)+1):
367-
strstr = '../../src/f4rt -'+algorithm+' \
370+
strstr = '/home/eder/repos/devel-F4RT/src/f4rt -'+algorithm+' \
368371
-A random-mat-'+str(rowSizes[k])+'-'+str(colSizes[k])+'.mat '
369372

370373
print(strstr+' -m2 -t '+str(max_threads)+' -a >> bench-'+str(hash_value)+'...')
@@ -373,7 +376,7 @@ def linesinfile(file_name):
373376

374377
# TBB computations 1D simple
375378
for k in range(0,int(args.count)+1):
376-
strstr = '../../src/f4rt -'+algorithm+' \
379+
strstr = '/home/eder/repos/devel-F4RT/src/f4rt -'+algorithm+' \
377380
-A random-mat-'+str(rowSizes[k])+'-'+str(colSizes[k])+'.mat '
378381

379382
print(strstr+' -m2 -t '+str(max_threads)+' -s >> bench-'+str(hash_value)+'...')
@@ -412,7 +415,8 @@ def linesinfile(file_name):
412415
# get threads for plot, stored in the first line of bench file
413416
#plot_threads = f.readline().strip().replace(' ','').split(',')
414417
# for compatibility to the other scripts just store this again
415-
threads = plot_threads
418+
plot_data = plot_threads
419+
print(plot_data)
416420
threads = list(map(lambda x: int(x) - 1, threads))
417421

418422

@@ -432,43 +436,31 @@ def linesinfile(file_name):
432436
#plot this data
433437

434438
#line style, sequential method only if start_threads == 1
435-
if int(args.alg) == 1:
436-
if start_threads == 1:
437-
stride = 1
438-
coloring = ['k','c','b','b','g','y','y','#7d053f','#7d053f','#7d053f','r','r','r']
439-
styles = ['None','-','-','--','-','-','-','-','--',':','-','--',':']
440-
markers = ['^','None','None','None','None','o','s','None','None',
441-
'None','None','None','None']
442-
else:
443-
stride = 1
444-
coloring = ['c','b','b','g','y','y','#7d053f','#7d053f','#7d053f','r','r','r']
445-
styles = ['-','-','--','-','-','-','-','--',':','-','--',':']
446-
markers = ['None','None','None','None','o','s','None','None',
447-
'None','None','None','None']
448-
if int(args.alg) == 2 or int(args.alg) == 3:
449-
if start_threads == 1:
450-
stride = 1
451-
coloring = ['k','c','b','y','#7d053f','#7d053f','#7d053f']
452-
styles = ['None','-','-','-','-','--',':']
453-
markers = ['^','None','None','o','None','None',
454-
'None']
455-
else:
456-
stride = 1
457-
coloring = ['c','b','y','#7d053f','#7d053f','#7d053f']
458-
styles = ['-','-','-','-','--',':']
459-
markers = ['None','None','o','None','None',
460-
'None']
461-
if int(args.alg) == 4:
462-
if start_threads == 1:
463-
stride = 1
464-
coloring = ['k','c','b','y','#7d053f']
465-
styles = ['None','-','-','-','-']
466-
markers = ['^','None','None','o','None']
467-
else:
468-
stride = 1
469-
coloring = ['c','b','y','#7d053f']
470-
styles = ['-','-','-','-']
471-
markers = ['None','None','o','None']
439+
stride = 1
440+
coloring =\
441+
[\
442+
'#0099cc','#33cc00','#ff1b54','#0033cc','#9900cc','#800020',\
443+
'#ff4011','#ffbf01','#00144f','#ff1450',\
444+
'#0099cc','#33cc00','#cc0033','#0033cc','#9900cc','#800020',\
445+
'#ff4011','#ffbf01','#00144f','#ff1450',\
446+
'#0099cc','#33cc00','#cc0033','#0033cc','#9900cc','#800020',\
447+
'#ff4011','#ffbf01','#00144f','#ff1450',\
448+
'#0099cc','#33cc00','#cc0033','#0033cc','#9900cc','#800020',\
449+
'#ff4011','#ffbf01','#00144f','#ff1450'\
450+
]
451+
styles = [\
452+
'-','-','-','-','-','-','-','-','-','-',\
453+
'--','--','--','--','--','--','--','--','--','--',\
454+
':',':',':',':',':',':',':',':',':',':',\
455+
'-','-','-','-','-','-','-','-','-','-'\
456+
]
457+
markers = [\
458+
'None','None','None','None','None','None','None','None','None','None',\
459+
'None','None','None','None','None','None','None','None','None','None',\
460+
'None','None','None','None','None','None','None','None','None','None',\
461+
'o','o','o','o','o','o','o','o','o','o'\
462+
]
463+
472464

473465
pl.rc('legend',**{'fontsize':5})
474466
fig = pl.figure()
@@ -517,11 +509,14 @@ def linesinfile(file_name):
517509
group_labels = plot_threads
518510

519511
#ax.set_xticklabels(group_labels)
520-
threads_tmp = range(0,len(plot_threads))
512+
threads_tmp = range(0,len(plot_data))
513+
#threads_tmp = range(0,len(plot_threads))
521514
# get right scale for a4 paper size
522-
scale_tmp = 38 / (len(plot_threads))
515+
scale_tmp = 38 / (len(plot_data))
516+
#scale_tmp = 38 / (len(plot_threads))
523517
threads = range(0,38,scale_tmp)
524-
tick_lbs = plot_threads
518+
print(threads)
519+
tick_lbs = plot_data
525520
ax.xaxis.set_ticks(threads)
526521
ax.xaxis.set_ticklabels(tick_lbs)
527522

@@ -591,11 +586,13 @@ def linesinfile(file_name):
591586
ax = pl.gca()
592587

593588
#ax.set_xticklabels(group_labels)
594-
threads_tmp = range(0,len(plot_threads))
589+
threads_tmp = range(0,len(plot_data))
590+
#threads_tmp = range(0,len(plot_threads))
595591
# get right scale for a4 paper size
596-
scale_tmp = 38 / (len(plot_threads))
592+
scale_tmp = 38 / (len(plot_data))
593+
#scale_tmp = 38 / (len(plot_threads))
597594
threads = range(0,38,scale_tmp)
598-
tick_lbs = plot_threads
595+
tick_lbs = plot_data
599596
ax.xaxis.set_ticks(threads)
600597
ax.xaxis.set_ticklabels(tick_lbs)
601598

0 commit comments

Comments
 (0)