aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-06-09 00:21:47 +0200
committerAdrian Kummerlaender2019-06-09 00:21:47 +0200
commitf4c85ce9663d2a0bb809651d25deec4ed7a5fe4b (patch)
tree4e5fd6be0c7c6d7c9f02a2949d42e66e9918fd77
parent5ac924371a7e53641a2f726a9f431ab8cb99f9fb (diff)
downloadsymlbm_playground-f4c85ce9663d2a0bb809651d25deec4ed7a5fe4b.tar
symlbm_playground-f4c85ce9663d2a0bb809651d25deec4ed7a5fe4b.tar.gz
symlbm_playground-f4c85ce9663d2a0bb809651d25deec4ed7a5fe4b.tar.bz2
symlbm_playground-f4c85ce9663d2a0bb809651d25deec4ed7a5fe4b.tar.lz
symlbm_playground-f4c85ce9663d2a0bb809651d25deec4ed7a5fe4b.tar.xz
symlbm_playground-f4c85ce9663d2a0bb809651d25deec4ed7a5fe4b.tar.zst
symlbm_playground-f4c85ce9663d2a0bb809651d25deec4ed7a5fe4b.zip
Add periodic performance reporting
-rw-r--r--implosion.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/implosion.py b/implosion.py
index 491e2ff..e33f1a8 100644
--- a/implosion.py
+++ b/implosion.py
@@ -183,6 +183,9 @@ class D2Q9_BGK_Lattice:
self.tick = True
self.program.collide_and_stream(self.queue, (self.nX,self.nY), (64,1), self.cl_pop_b, self.cl_pop_a, self.cl_moments, self.cl_material)
+ def sync(self):
+ self.queue.finish()
+
def show(self, i):
cl.enqueue_copy(LBM.queue, LBM.np_moments, LBM.cl_moments).wait();
@@ -198,24 +201,23 @@ class D2Q9_BGK_Lattice:
def MLUPS(cells, steps, time):
return cells * steps / time * 1e-6
-LBM = D2Q9_BGK_Lattice(1024, 1024)
-
nUpdates = 1000
+nStat = 100
-start = time.time()
+print("Initializing simulation...\n")
-for i in range(0,nUpdates):
- LBM.evolve()
+LBM = D2Q9_BGK_Lattice(1024, 1024)
-LBM.queue.finish()
+print("Starting simulation using %d cells...\n" % LBM.nCells)
-end = time.time()
+lastStat = time.time()
-LBM.show(nUpdates)
+for i in range(1,nUpdates+1):
+ if i % nStat == 0:
+ LBM.sync()
+ print("i = %4d; %3.0f MLUPS" % (i, MLUPS(LBM.nCells, nStat, time.time() - lastStat)))
+ lastStat = time.time()
-runtime = end - start
+ LBM.evolve()
-print("Cells: " + str(LBM.nCells))
-print("Updates: " + str(nUpdates))
-print("Time: " + str(runtime))
-print("MLUPS: " + str(MLUPS(LBM.nCells, nUpdates, end - start)))
+LBM.show(nUpdates)