-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph_plot.py
More file actions
102 lines (81 loc) · 2.99 KB
/
graph_plot.py
File metadata and controls
102 lines (81 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# -*- coding: utf-8 -*-
"""PPR_graph_2(1).ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/140N7nnQ99nnNjW8OLAtwZwSdhhECgZ9_
"""
import numpy as np
import matplotlib.pyplot as plt
from google.colab import drive
drive.mount('/content/gdrive')
seq_size = []
with open('/content/gdrive/MyDrive/ppr prj/sequential/size.txt','r') as f:
seq_size = list(map(int, f.readlines()))
print(seq_size)
seq_time = []
with open('/content/gdrive/MyDrive/ppr prj/sequential/time.txt','r') as f:
seq_time = list(map(float, f.readlines()))
print(seq_time)
import matplotlib.pyplot as plt
plt.plot(seq_size,seq_time, color = 'blue')
plt.legend(["Serial"])
plt.xlabel("Size Of Matrix")
plt.ylabel("Execution Time")
plt.show()
omp_size = []
with open('/content/gdrive/MyDrive/ppr prj/omp/size.txt','r') as f:
omp_size = list(map(int, f.readlines()))
print(omp_size)
omp_time = []
with open('/content/gdrive/MyDrive/ppr prj/omp/time.txt','r') as g:
omp_time = list(map(float, g.readlines()))
print(omp_time)
plt.plot(omp_size,omp_time, color='black')
plt.legend(["OMP(Threads=4)"])
plt.xlabel("Size Of Matrix")
plt.ylabel("Execution Time")
plt.show()
pthread_size = []
with open('/content/gdrive/MyDrive/ppr prj/pthread/size.txt','r') as f:
pthread_size = list(map(int, f.readlines()))
print(pthread_size)
pthread_time = []
with open('/content/gdrive/MyDrive/ppr prj/pthread/time.txt','r') as g:
pthread_time = list(map(float, g.readlines()))
print(pthread_time)
plt.plot(pthread_size,pthread_time, color='red')
plt.legend(["PThread(Threads=4)"])
plt.xlabel("Size Of Matrix")
plt.ylabel("Execution Time")
plt.show()
plt.plot(omp_size,omp_time, color='black')
plt.plot(pthread_size,pthread_time, color = 'red')
plt.plot(seq_size,seq_time, color = 'blue')
plt.legend(["OMP_Parallel(Threads=4)", "Pthread_Parallel(Threads=4)", "Serial"])
plt.xlabel("Size Of Matrix")
plt.ylabel("Execution Time")
plt.show()
omp_thread_No = []
with open('/content/gdrive/MyDrive/ppr prj/omp/thread_No.txt','r') as f:
omp_thread_No = list(map(int, f.readlines()))
print(omp_thread_No)
omp_thread_Time = []
with open('/content/gdrive/MyDrive/ppr prj/omp/thread_Time.txt','r') as f:
omp_thread_Time = list(map(float, f.readlines()))
print(omp_thread_Time)
pthread_thread_No = []
with open('/content/gdrive/MyDrive/ppr prj/pthread/thread_No.txt','r') as f:
pthread_thread_No = list(map(int, f.readlines()))
print(pthread_thread_No)
pthread_thread_Time = []
with open('/content/gdrive/MyDrive/ppr prj/pthread/thread_Time.txt','r') as f:
pthread_thread_Time = list(map(float, f.readlines()))
print(pthread_thread_Time)
plt.plot(omp_thread_No,omp_thread_Time, color='red')
# plt.plot(omp_thread_Time, omp_thread_No, color='red')
plt.plot(pthread_thread_No,pthread_thread_Time, color='black')
# plt.plot(pthread_thread_Time,pthread_thread_No, color='black')
plt.legend(["OMP(N=2000)","PThread(N=2000)"])
plt.xlabel("Number of Threads")
plt.ylabel("Execution Time")
plt.show()