aboutsummaryrefslogtreecommitdiff
path: root/boltzgen/kernel/generator.py
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-11-05 19:57:17 +0100
committerAdrian Kummerlaender2019-11-05 19:57:17 +0100
commit02cb01c94fe26d425371ab74feeb50e8a9bf6bf6 (patch)
treeacfbca6533a1a8d9c22afac9f4be14bf08bb9c63 /boltzgen/kernel/generator.py
parent78f5edec8151db38ebf933e915fcca5f65b1cad5 (diff)
downloadboltzgen-02cb01c94fe26d425371ab74feeb50e8a9bf6bf6.tar
boltzgen-02cb01c94fe26d425371ab74feeb50e8a9bf6bf6.tar.gz
boltzgen-02cb01c94fe26d425371ab74feeb50e8a9bf6bf6.tar.bz2
boltzgen-02cb01c94fe26d425371ab74feeb50e8a9bf6bf6.tar.xz
boltzgen-02cb01c94fe26d425371ab74feeb50e8a9bf6bf6.zip
Implement AA pattern for C++ target
Note that special care has to be taken to provide ghost cells around active cells so the algorithm has somewhere to stream to and from. This is also the case for the AB pattern but there they only have to be equilibrilized once instead of after every other time step. Even when such an equilibrilization is performed there is still a potential bug as inbound populations at the outer boundary are never streamed to (this is not a problem for AB using pull-only streaming). A vectorizable solution may require direction-specific ghost cell equilibrization.
Diffstat (limited to 'boltzgen/kernel/generator.py')
-rw-r--r--boltzgen/kernel/generator.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/boltzgen/kernel/generator.py b/boltzgen/kernel/generator.py
index dd44a56..ee5bf8b 100644
--- a/boltzgen/kernel/generator.py
+++ b/boltzgen/kernel/generator.py
@@ -10,7 +10,7 @@ template_lookup = TemplateLookup(directories = [
])
class Generator:
- def __init__(self, model, target, precision, index, layout):
+ def __init__(self, model, target, precision, index, layout, streaming):
self.model = model
self.descriptor = self.model.descriptor
self.target = target
@@ -26,6 +26,8 @@ class Generator:
except AttributeError:
raise Exception("There is no layout '%s'" % layout) from None
+ self.streaming = streaming
+
def instantiate(self, template, geometry, extras = []):
template_path = Path(__file__).parent/("template/%s.%s.mako" % (template, self.target))
if not template_path.exists():
@@ -35,10 +37,10 @@ class Generator:
descriptor = self.descriptor,
model = self.model,
geometry = geometry,
+ float_type = self.float_type,
index = self.index_impl(geometry),
layout = self.layout_impl(self.descriptor, self.index_impl, geometry),
- streaming = 'AB',
- float_type = self.float_type,
+ streaming = self.streaming,
extras = extras
)
@@ -53,9 +55,9 @@ class Generator:
descriptor = self.descriptor,
model = self.model,
geometry = geometry,
+ float_type = self.float_type,
index = self.index_impl(geometry),
layout = self.layout_impl(self.descriptor, self.index_impl, geometry),
- streaming = 'AB',
- float_type = self.float_type,
+ streaming = self.streaming,
extras = extras
)