Commit d0752769 authored by Frederik Hennig's avatar Frederik Hennig
Browse files

excluded benchmark definitions

parent 2a408922
Pipeline #28833 failed with stages
in 360 minutes and 4 seconds
import pystencils as ps
import numpy as np
from lbmpy.creationfunctions import create_lb_update_rule
from lbmpy.advanced_streaming.utility import get_timesteps, Timestep
from pystencils.data_types import TypedSymbol
from pystencils.simp import SimplificationStrategy, sympy_cse
from ba_praktikum.subexpression_insertion import insert_aliases, insert_zeros, insert_symbol_times_minus_one
from lbmpy.stencils import get_stencil
from pystencils.simp.simplifications import add_subexpressions_for_divisions
from pystencils_walberla import generate_pack_info_from_kernel
from pystencils_walberla import CodeGeneration, generate_sweep
from lbmpy.methods.centeredcumulant import create_with_default_polynomial_cumulants as create_cm_method
from lbmpy.macroscopic_value_kernels import pdf_initialization_assignments
# Zero and Alias Insertion
default_insertions = SimplificationStrategy()
default_insertions.add(insert_zeros)
default_insertions.add(insert_aliases)
# Zero, Alias and Minus-One Insertion
minus_one_insertion = SimplificationStrategy()
minus_one_insertion.add(insert_zeros)
minus_one_insertion.add(insert_aliases)
minus_one_insertion.add(insert_symbol_times_minus_one)
# Post-CSE + Zero, Alias and Minus-One Insertion
post_cse = SimplificationStrategy()
post_cse.add(insert_zeros)
post_cse.add(insert_aliases)
post_cse.add(add_subexpressions_for_divisions)
post_cse.add(sympy_cse)
post_cse.add(insert_symbol_times_minus_one)
SIMPLIFICATION_STRATEGIES = {
'no_simp': (False, default_insertions),
'pre_cse': (True, minus_one_insertion),
'post_cse': ("extract_one_half_only", post_cse)
}
stencil = get_stencil("D3Q27")
dim = len(stencil[0])
Q = len(stencil)
method_params = {
'stencil': stencil,
'relaxation_rates': [1.0, 2.0, 1.7] + [1.0] * 9
}
streaming_pattern = 'aa'
target = 'gpu'
gpu_block_size = (TypedSymbol("cudaBlockSize0", np.int32),
TypedSymbol("cudaBlockSize1", np.int32),
TypedSymbol("cudaBlockSize2", np.int32))
gpu_indexing_params = {
"block_size" : gpu_block_size
}
domain_size = (512, 512, 512)
field_layout = 'fzyx' # SoA
pdf_field = ps.fields(f'pdfs({Q}) : [{dim}D]', layout=field_layout)
u_field, rho_field = ps.fields(f'u({dim}), rho(1) : [{dim}D]', layout=field_layout)
output = {
'density': rho_field,
'velocity': u_field
}
optimization = {
'target': target,
'field_layout': field_layout, # SoA
'symbolic_field': pdf_field
}
SWEEP_CLASS_PATTERN = "CumulantLBKernel{timestep}"
def create_cm_collision_rule(method_params, pre_simplification, post_simplification, output):
lb_method = create_cm_method(**method_params)
lb_collision_rule = lb_method.get_collision_rule(pre_simplification)
cqc = lb_method.conserved_quantity_computation
output_eqs = cqc.output_equations_from_pdfs(
lb_method.pre_collision_pdf_symbols, output)
lb_collision_rule = lb_collision_rule.new_merged(output_eqs)
lb_collision_rule = post_simplification(lb_collision_rule)
return lb_collision_rule
from ba_praktikum.walberla_bm.bm_definitions import *
with CodeGeneration() as ctx:
pre_simp, post_simp = SIMPLIFICATION_STRATEGIES[ctx.config]
timesteps = get_timesteps(streaming_pattern)
# TODO: Change
simp_idx = int(ctx.config)
simp = SIMPLIFICATION_STRATEGIES[simp_idx]
# Generate LB sweeps
lb_collision_rule = create_cm_collision_rule(method_params, pre_simp, post_simp, output)
lb_update_rules = []
lb_collision_rule = get_cm_collision_rule(simp, True)
lb_update_rules = [get_update_rules(lb_collision_rule)]
for t in timesteps:
update_rule = create_lb_update_rule(collision_rule=lb_collision_rule,
streaming_pattern=streaming_pattern, timestep=t, optimization=optimization)
lb_update_rules.append(update_rule)
classname = SWEEP_CLASS_PATTERN.format(timestep=t)
classname = f"CumulantLBKernel{str(t)}"
update_rule = lb_update_rules[t.idx]
generate_sweep(ctx, classname, update_rule, target=target, gpu_indexing_params=gpu_indexing_params)
# Init Assignments
......
Markdown is supported
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