171 lines
No EOL
4.2 KiB
Python
171 lines
No EOL
4.2 KiB
Python
import numpy as np
|
|
import re
|
|
from matplotlib import pyplot as plt
|
|
|
|
### Réduction
|
|
|
|
with open ('time_reduction.txt', 'r') as timing:
|
|
text = timing.read()
|
|
|
|
# extract the values using regular expression
|
|
values = re.findall(r'\d+\.\d+|\d+', text)
|
|
|
|
# convert values to int or float
|
|
values = [float(value) if '.' in value else int(value) for value in values]
|
|
|
|
result = np.reshape(values,(30,5))
|
|
|
|
SEQ = result[0:6,3]
|
|
|
|
result = np.delete(result, (0,2,3), 1)
|
|
|
|
|
|
T1 = result[0:6,:]
|
|
T2 = result[6:12,:]
|
|
T4 = result[12:18,:]
|
|
T6 = result[18:24,:]
|
|
T12 = result[24:30,:]
|
|
|
|
plt.figure()
|
|
plt.plot(T1[:,0],SEQ,'+-')
|
|
plt.plot(T1[:,0],T1[:,1],'+-')
|
|
plt.plot(T2[:,0],T2[:,1],'+-')
|
|
plt.plot(T4[:,0],T4[:,1],'+-')
|
|
plt.plot(T6[:,0],T6[:,1],'+-')
|
|
plt.plot(T12[:,0],T12[:,1],'+-')
|
|
|
|
plt.legend(["Sequentiel","1 Thread","2 Threads","4 Threads","6 Threads","12 Threads"])
|
|
plt.xlabel("N")
|
|
plt.ylabel("t (s)")
|
|
plt.title("Réduction")
|
|
plt.show()
|
|
|
|
### Clause schedule
|
|
|
|
schedule = ['time_schedule_dynamic_1.txt',
|
|
'time_schedule_dynamic_4.txt',
|
|
'time_schedule_dynamic_12.txt',
|
|
'time_schedule_dynamic_100.txt',
|
|
'time_schedule_guided_1.txt',
|
|
'time_schedule_guided_4.txt',
|
|
'time_schedule_guided_12.txt',
|
|
'time_schedule_guided_100.txt',
|
|
'time_schedule_static_1.txt',
|
|
'time_schedule_static_4.txt',
|
|
'time_schedule_static_12.txt',
|
|
'time_schedule_static_100.txt']
|
|
|
|
fig = plt.figure()
|
|
cm = plt.get_cmap('gist_rainbow')
|
|
ax = fig.add_subplot(111)
|
|
ax.set_prop_cycle(color=[cm(1.*i/13) for i in range(13)])
|
|
|
|
for txt in schedule:
|
|
with open (txt, 'r') as timing:
|
|
text = timing.read()
|
|
|
|
# extract the values using regular expression
|
|
values = re.findall(r'\d+\.\d+|\d+', text)
|
|
|
|
# convert values to int or float
|
|
values = [float(value) if '.' in value else int(value) for value in values]
|
|
|
|
result = np.reshape(values,(5,5))
|
|
|
|
SEQ = result[:,3]
|
|
T = result[:,0]
|
|
|
|
Time = result[:,4]
|
|
plt.semilogy(T,Time,'+-')
|
|
|
|
schedule.append("SEQ")
|
|
|
|
plt.semilogy(T,SEQ,'+-')
|
|
plt.legend(schedule)
|
|
plt.xlabel("Threads max")
|
|
plt.ylabel("t (s)")
|
|
plt.title("Temps de traitement pour N = 1e5")
|
|
plt.show()
|
|
|
|
|
|
### Schedule + réduction
|
|
|
|
schedule = ["time_reduction_schedule_dynamic_100.txt",
|
|
"time_reduction_schedule_guided_100.txt",
|
|
"time_reduction_schedule_static_100.txt",
|
|
"time_reduction_schedule_static_1000.txt"]
|
|
|
|
lgd = ["SD100","SG100","SS100","SS1000","SEQ"]
|
|
|
|
fig = plt.figure()
|
|
cm = plt.get_cmap('gist_rainbow')
|
|
ax = fig.add_subplot(111)
|
|
ax.set_prop_cycle(color=[cm(1.*i/5) for i in range(5)])
|
|
|
|
for txt in schedule:
|
|
with open (txt, 'r') as timing:
|
|
text = timing.read()
|
|
|
|
# extract the values using regular expression
|
|
values = re.findall(r'\d+\.\d+|\d+', text)
|
|
|
|
# convert values to int or float
|
|
values = [float(value) if '.' in value else int(value) for value in values]
|
|
|
|
result = np.reshape(values,(5,5))
|
|
|
|
SEQ = result[:,3]
|
|
T = result[:,0]
|
|
|
|
Time = result[:,4]
|
|
plt.plot(T,Time,'+-')
|
|
|
|
|
|
plt.plot(T,SEQ,'+-')
|
|
plt.legend(lgd)
|
|
plt.xlabel("Threads max")
|
|
plt.ylabel("t (s)")
|
|
plt.title("Réduction + Schedule, N = 1e5")
|
|
plt.show()
|
|
|
|
### Atomic
|
|
|
|
atomic = [ "time_atomic_schedule_dynamic_100.txt",
|
|
"time_atomic_schedule_guided_100.txt",
|
|
"time_atomic_schedule_static_100.txt",
|
|
"time_critical_schedule_dynamic_100.txt",
|
|
"time_critical_schedule_guided_100.txt",
|
|
"time_critical_schedule_static_100.txt"]
|
|
|
|
lgd = ["AD100","AG100","AS100","CD100","CG100","CS100","SEQ"]
|
|
|
|
fig = plt.figure()
|
|
cm = plt.get_cmap('gist_rainbow')
|
|
ax = fig.add_subplot(111)
|
|
ax.set_prop_cycle(color=[cm(1.*i/7) for i in range(7)])
|
|
|
|
for txt in atomic:
|
|
with open (txt, 'r') as timing:
|
|
text = timing.read()
|
|
|
|
# extract the values using regular expression
|
|
values = re.findall(r'\d+\.\d+|\d+', text)
|
|
|
|
# convert values to int or float
|
|
values = [float(value) if '.' in value else int(value) for value in values]
|
|
|
|
result = np.reshape(values,(5,5))
|
|
|
|
SEQ = result[:,3]
|
|
T = result[:,0]
|
|
|
|
Time = result[:,4]
|
|
plt.plot(T,Time,'+-')
|
|
|
|
|
|
plt.plot(T,SEQ,'+-')
|
|
plt.legend(lgd)
|
|
plt.xlabel("Threads max")
|
|
plt.ylabel("t (s)")
|
|
plt.title("Atomic/Critical + Schedule, N = 1e5")
|
|
plt.show() |