From dbe19deb0d42ee7c2359d951686c6100d4ec27b3 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Thu, 16 Jan 2020 22:20:27 +0100 Subject: Integrate SSS in Open(C,G)L interop example --- lid_driven_cavity/opencl_gl_interop/SSS.py | 18 ++++++++++++++++++ lid_driven_cavity/opencl_gl_interop/lattice/SSS.py | 1 + lid_driven_cavity/opencl_gl_interop/ldc_2d.py | 13 ++++++++++--- 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 lid_driven_cavity/opencl_gl_interop/SSS.py create mode 120000 lid_driven_cavity/opencl_gl_interop/lattice/SSS.py diff --git a/lid_driven_cavity/opencl_gl_interop/SSS.py b/lid_driven_cavity/opencl_gl_interop/SSS.py new file mode 100644 index 0000000..a8f5a37 --- /dev/null +++ b/lid_driven_cavity/opencl_gl_interop/SSS.py @@ -0,0 +1,18 @@ +import pyopencl as cl + +from common import MomentsTextureBase + +from lattice.SSS import Lattice + +class MomentsTexture(MomentsTextureBase): + pass + + def collect(self): + cl.enqueue_acquire_gl_objects(self.lattice.queue, [self.cl_gl_moments]) + + self.lattice.program.collect_moments_to_texture( + self.lattice.queue, + self.lattice.geometry.size(), + self.lattice.layout, + self.lattice.memory.cl_control, + self.cl_gl_moments) diff --git a/lid_driven_cavity/opencl_gl_interop/lattice/SSS.py b/lid_driven_cavity/opencl_gl_interop/lattice/SSS.py new file mode 120000 index 0000000..b01ba59 --- /dev/null +++ b/lid_driven_cavity/opencl_gl_interop/lattice/SSS.py @@ -0,0 +1 @@ +../../opencl/SSS.py \ No newline at end of file diff --git a/lid_driven_cavity/opencl_gl_interop/ldc_2d.py b/lid_driven_cavity/opencl_gl_interop/ldc_2d.py index ac8119b..6373a51 100644 --- a/lid_driven_cavity/opencl_gl_interop/ldc_2d.py +++ b/lid_driven_cavity/opencl_gl_interop/ldc_2d.py @@ -18,14 +18,18 @@ from pyrr import matrix44 geometry = Geometry(512, 512) +precision = 'single' +streaming = 'AA' + functions = ['collide_and_stream', 'equilibrilize', 'collect_moments', 'momenta_boundary'] extras = ['cell_list_dispatch', 'opencl_gl_interop'] -precision = 'single' -streaming = 'AA' +if streaming == 'SSS': + functions = functions + ['update_sss_control_structure'] import AA import AB +import SSS def glut_window(fullscreen = False): glutInit(sys.argv) @@ -73,7 +77,10 @@ wall_cells = CellList(lattice.context, lattice.queue, lattice.float_type, lid_cells = CellList(lattice.context, lattice.queue, lattice.float_type, [ gid(x,y) for x, y in geometry.inner_cells() if y == geometry.size_y-2 ]) -if streaming == 'AB': +if streaming == 'SSS': + lattice.schedule('equilibrilize', ghost_cells) + +if streaming in ['AB', 'SSS']: lattice.schedule('collide_and_stream', bulk_cells) lattice.schedule('velocity_momenta_boundary', wall_cells, numpy.array([0.0, 0.0], dtype=lattice.float_type[0])) lattice.schedule('velocity_momenta_boundary', lid_cells, numpy.array([0.1, 0.0], dtype=lattice.float_type[0])) -- cgit v1.2.3