aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-05-28 15:40:56 +0200
committerAdrian Kummerlaender2019-05-28 15:40:56 +0200
commitde97cf07c1f0e54f4760b6153054cfaaa754663d (patch)
tree5d49f2f2925ff17ae31b4012f8ed316936bc722b
parente4bbd52fc61e1672bb0abf8d4d636a1699770106 (diff)
downloadsymlbm_playground-de97cf07c1f0e54f4760b6153054cfaaa754663d.tar
symlbm_playground-de97cf07c1f0e54f4760b6153054cfaaa754663d.tar.gz
symlbm_playground-de97cf07c1f0e54f4760b6153054cfaaa754663d.tar.bz2
symlbm_playground-de97cf07c1f0e54f4760b6153054cfaaa754663d.tar.lz
symlbm_playground-de97cf07c1f0e54f4760b6153054cfaaa754663d.tar.xz
symlbm_playground-de97cf07c1f0e54f4760b6153054cfaaa754663d.tar.zst
symlbm_playground-de97cf07c1f0e54f4760b6153054cfaaa754663d.zip
Remove branch to enable vectorization on Intel
Twice the MLUPS!
-rw-r--r--implosion.py22
1 files changed, 7 insertions, 15 deletions
diff --git a/implosion.py b/implosion.py
index 8a3e530..b786461 100644
--- a/implosion.py
+++ b/implosion.py
@@ -77,20 +77,12 @@ __kernel void collide_and_stream(__global float* pop_a,
float d = density(&pop_b[gid*9]);
float2 v = velocity(&pop_b[gid*9],d);
- if ( material[gid] == 1 ) {
- for ( int i = -1; i <= 1; ++i ) {
- for ( int j = -1; j <= 1; ++j ) {
- pop_a[gidOfCell(cell.x+i, cell.y+j)*9 + indexOfDirection(i,j)] =
- pop_b[gid*9 + indexOfDirection(i,j)] + $tau * (equilibrium(d,v,i,j) - pop_b[gid*9 + indexOfDirection(i,j)]);
- }
- }
- }
- else if ( material[gid] == 2 ) {
- for ( int i = -1; i <= 1; ++i ) {
- for ( int j = -1; j <= 1; ++j ) {
- pop_a[gidOfCell(cell.x-i, cell.y-j)*9 + indexOfDirection(-i,-j)] =
- pop_b[gid*9 + indexOfDirection(i,j)] + $tau * (equilibrium(d,v,i,j) - pop_b[gid*9 + indexOfDirection(i,j)]);
- }
+ const int m = material[gid];
+
+ for ( int i = -1; i <= 1; ++i ) {
+ for ( int j = -1; j <= 1; ++j ) {
+ pop_a[gidOfCell(cell.x+m*i, cell.y+m*j)*9 + indexOfDirection(m*i,m*j)] =
+ pop_b[gid*9 + indexOfDirection(i,j)] + $tau * (equilibrium(d,v,i,j) - pop_b[gid*9 + indexOfDirection(i,j)]);
}
}
}"""
@@ -129,7 +121,7 @@ class D2Q9_BGK_Lattice:
for x in range(1,self.nX-1):
for y in range(1,self.nY-1):
if x == 1 or y == 1 or x == self.nX-2 or y == self.nY-2:
- self.np_material[self.idx(x,y)] = 2
+ self.np_material[self.idx(x,y)] = -1
else:
self.np_material[self.idx(x,y)] = 1