Skip to content
Snippets Groups Projects
Commit 9159b1f5 authored by Markus Holzer's avatar Markus Holzer Committed by Christoph Schwarzmeier
Browse files

Minor Fixes for Codegen applications

parent ee4ba5e9
Branches
Tags
No related merge requests found
...@@ -123,7 +123,9 @@ with CodeGeneration() as ctx: ...@@ -123,7 +123,9 @@ with CodeGeneration() as ctx:
# GENERATE SWEEPS # # GENERATE SWEEPS #
################### ###################
cpu_vec = {'assume_inner_stride_one': True, 'nontemporal': True} # by default NT Stores are deactivated because they do not work in all cases
# must be activated to achieve full potential for example on AVX512 CPUs
cpu_vec = {'assume_inner_stride_one': True, 'nontemporal': False}
vp = [('int32_t', 'cudaBlockSize0'), vp = [('int32_t', 'cudaBlockSize0'),
('int32_t', 'cudaBlockSize1'), ('int32_t', 'cudaBlockSize1'),
......
...@@ -97,7 +97,7 @@ with CodeGeneration() as ctx: ...@@ -97,7 +97,7 @@ with CodeGeneration() as ctx:
openmp = True if ctx.openmp else False openmp = True if ctx.openmp else False
field_type = "float64" if ctx.double_accuracy else "float32" field_type = "float64" if ctx.double_accuracy else "float32"
if ctx.optimize_for_localhost: if ctx.optimize_for_localhost:
cpu_vec = {"nontemporal": True, "assume_aligned": True} cpu_vec = {"nontemporal": False, "assume_aligned": True}
else: else:
cpu_vec = None cpu_vec = None
......
...@@ -109,7 +109,7 @@ void testPoisson() ...@@ -109,7 +109,7 @@ void testPoisson()
// Registering the sweep // Registering the sweep
timeloop.add() << BeforeFunction( commScheme, "Communication" ) timeloop.add() << BeforeFunction( commScheme, "Communication" )
<< Sweep( pystencils::Poisson(fId, fieldID, dx, dy), "Poisson Kernel" ); << Sweep( pystencils::Poisson(fId, fieldID, dx*dx, dy*dy), "Poisson Kernel" );
timeloop.run(); timeloop.run();
......
...@@ -6,14 +6,14 @@ from pystencils_walberla import CodeGeneration, generate_sweep ...@@ -6,14 +6,14 @@ from pystencils_walberla import CodeGeneration, generate_sweep
with CodeGeneration() as ctx: with CodeGeneration() as ctx:
field_type = "float64" if ctx.double_accuracy else "float32" field_type = "float64" if ctx.double_accuracy else "float32"
# ----- Solving the 2D Poisson equation with rhs -------------------------- # ----- Solving the 2D Poisson equation with rhs --------------------------
dx = sp.Symbol("dx") dx2 = sp.Symbol("dx_square")
dy = sp.Symbol("dy") dy2 = sp.Symbol("dy_square")
src, dst, rhs = ps.fields(f"src, src_tmp, rhs: {field_type}[2D]", layout='fzyx') src, dst, rhs = ps.fields(f"src, src_tmp, rhs: {field_type}[2D]", layout='fzyx')
@ps.kernel @ps.kernel
def kernel_func(): def kernel_func():
src[0, 0] @= ((dy**2 * (src[1, 0] + src[-1, 0])) src[0, 0] @= ((dy2 * (src[1, 0] + src[-1, 0]))
+ (dx**2 * (src[0, 1] + src[0, -1])) + (dx2 * (src[0, 1] + src[0, -1]))
- (rhs[0, 0] * dx**2 * dy**2)) / (2 * (dx**2 + dy**2)) - (rhs[0, 0] * dx2 * dy2)) / (2.0 * (dx2 + dy2))
generate_sweep(ctx, 'Poisson', kernel_func) generate_sweep(ctx, 'Poisson', kernel_func)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment