This repository has been archived by the owner on Feb 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathplot_cavity.py
executable file
·85 lines (72 loc) · 1.7 KB
/
plot_cavity.py
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
import numpy
import matplotlib.pyplot as plt
data = numpy.genfromtxt('numpycavitytimes')
datacud = numpy.genfromtxt('cudajit_cavity')
nx = data[:21:5]
cells = data[1:21:5]
runtime = data[2:21:5]
timestep = data[3:21:5]
iter = data[4:21:5]
nxc = datacud[:16:4]
runtimec = datacud[1:16:4]
dtc = datacud[2:16:4]
iterc = datacud[3:16:4]
cellsc = nxc**2
#
#plt.subplot(211)
#
#plt.plot(cells, runtime, '--')
#plt.plot(cellsc, runtimec, '-o')
#plt.xlabel('Number of cells')
#plt.ylabel('Runtime')
#plt.legend(['Numpy', 'Numba with CUDA'], loc=2)
#
#plt.subplot(212)
#
#plt.plot(iter, runtime, '--')
#plt.plot(iterc, runtimec, '-o')
#plt.xlabel('Time iterations')
#plt.ylabel('Runtime')
#plt.legend(['Numpy', 'Numba with CUDA'], loc=2)
#
#plt.savefig('numpyvsnumba_flow1.png')
#plt.show()
plt.plot(cells/iter, runtime, '--')
plt.plot(cellsc/iterc, runtimec, '-o')
plt.legend(['Numpy', 'Numba'])
plt.show()
data = numpy.genfromtxt('numpycavity0.1')
datacud = numpy.genfromtxt('cuda0.1')
nx = data[::5]
cells = data[1::5]
runtime = data[2::5]
timestep = data[3::5]
iter = data[4::5]
nxc = datacud[::4]
runtimec = datacud[1::4]
dtc = datacud[2::4]
iterc = datacud[3::4]
cellsc = nxc**2
plt.plot(cells/iter, runtime, '--')
plt.plot(cellsc/iterc, runtimec, '-o')
plt.legend(['Numpy', 'Numba'])
plt.show()
#
#plt.subplot(211)
#
#plt.plot(cells, runtime, '--')
#plt.plot(cellsc, runtimec, '-o')
#plt.xlabel('Number of cells')
#plt.ylabel('Runtime')
#plt.legend(['Numpy', 'Numba with CUDA'], loc=2)
#
#plt.subplot(212)
#
#plt.plot(iter, runtime, '--')
#plt.plot(iterc, runtimec, '-o')
#plt.xlabel('Time iterations')
#plt.ylabel('Runtime')
#plt.legend(['Numpy', 'Numba with CUDA'], loc=2)
#
#plt.savefig('numpyvsnumba_flow.1.png')
#plt.show()