From 99923a7df7654bdd529dedd262c0671b1a7c9bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= <jgrad@icp.uni-stuttgart.de> Date: Fri, 22 Nov 2024 14:24:39 +0100 Subject: [PATCH] Fix compiler warnings in generated kernels --- python/lbmpy_walberla/templates/LatticeModel.tmpl.h | 4 ++-- python/pystencils_walberla/sweep.py | 4 ++-- python/pystencils_walberla/templates/Boundary.tmpl.h | 2 +- python/pystencils_walberla/templates/CpuPackInfo.tmpl.h | 2 +- python/pystencils_walberla/templates/GpuPackInfo.tmpl.h | 2 +- python/pystencils_walberla/templates/Sweep.tmpl.h | 8 +++++--- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/python/lbmpy_walberla/templates/LatticeModel.tmpl.h b/python/lbmpy_walberla/templates/LatticeModel.tmpl.h index 769ae027c..9c4170691 100644 --- a/python/lbmpy_walberla/templates/LatticeModel.tmpl.h +++ b/python/lbmpy_walberla/templates/LatticeModel.tmpl.h @@ -109,7 +109,7 @@ public: class Sweep { public: - Sweep( BlockDataID _pdfsID ) : pdfsID(_pdfsID) {}; + Sweep( BlockDataID _pdfsID ) : pdfsID(_pdfsID) {} //void stream ( IBlock * const block, const uint_t numberOfGhostLayersToInclude = uint_t(0) ); void collide ( IBlock * const block, const uint_t numberOfGhostLayersToInclude = uint_t(0) ); @@ -134,7 +134,7 @@ public: {{class_name}}( {{stream_collide_kernel|generate_constructor_parameters(lmIgnores+lmOffsets) }} ) : {{ stream_collide_kernel|generate_constructor_initializer_list(lmIgnores+lmOffsets) }}, currentLevel(0) - {}; + {} void configure( IBlock & block, StructuredBlockStorage & storage ) { configureBlock( &block, &storage ); } diff --git a/python/pystencils_walberla/sweep.py b/python/pystencils_walberla/sweep.py index f6e190fde..85de00f06 100644 --- a/python/pystencils_walberla/sweep.py +++ b/python/pystencils_walberla/sweep.py @@ -98,10 +98,10 @@ def generate_selective_sweep(generation_context, class_name, selection_tree, int ghost_layers_to_include: see documentation of `generate_sweep` cpu_vectorize_info: Dictionary containing information about CPU vectorization applied to the kernels cpu_openmp: Whether or not CPU kernels use OpenMP parallelization - max_threads: only relevant for GPU kernels. Will be argument of `__launch_bounds__ + max_threads: only relevant for GPU kernels. Will be argument of `__launch_bounds__` block_offset: A tuple of TypedSymbols that will function as internal variable to store storage.getBlockCellBB(block).min()) -` + """ def to_name(f): return f.name if isinstance(f, Field) else f diff --git a/python/pystencils_walberla/templates/Boundary.tmpl.h b/python/pystencils_walberla/templates/Boundary.tmpl.h index 43fd409ea..8fcce4820 100644 --- a/python/pystencils_walberla/templates/Boundary.tmpl.h +++ b/python/pystencils_walberla/templates/Boundary.tmpl.h @@ -204,7 +204,7 @@ public: auto createForceVector = []( IBlock * const , StructuredBlockStorage * const ) { return new ForceVector(); }; forceVectorID = blocks->addStructuredBlockData< ForceVector >( createForceVector, "forceVector_{{class_name}}"); {%- endif %} - }; + } void run ( {{- ["IBlock * block", kernel.kernel_selection_parameters, ["gpuStream_t stream = nullptr"] if target == 'gpu' else []] | type_identifier_list -}} diff --git a/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h b/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h index 137f4da6a..4e1f85fd1 100644 --- a/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h +++ b/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h @@ -46,7 +46,7 @@ class {{class_name}} : public ::walberla::communication::UniformPackInfo public: {{class_name}}( {{fused_kernel|generate_constructor_parameters(parameters_to_ignore=['buffer'])}} ) : {{ fused_kernel|generate_constructor_initializer_list(parameters_to_ignore=['buffer']) }} - {}; + {} ~{{class_name}}() override = default; bool constantDataExchange() const override { return true; } diff --git a/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h b/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h index 820c6b8be..06312a147 100644 --- a/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h +++ b/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h @@ -52,7 +52,7 @@ class {{class_name}} : public ::walberla::gpu::GeneratedGPUPackInfo public: {{class_name}}( {{fused_kernel|generate_constructor_parameters(parameters_to_ignore=['buffer'])}} ) : {{ fused_kernel|generate_constructor_initializer_list(parameters_to_ignore=['buffer']) }} - {}; + {} ~{{class_name}}() override = default; void pack (stencil::Direction dir, unsigned char * buffer, IBlock * block, gpuStream_t stream) override; diff --git a/python/pystencils_walberla/templates/Sweep.tmpl.h b/python/pystencils_walberla/templates/Sweep.tmpl.h index bebbe855c..b146a848c 100644 --- a/python/pystencils_walberla/templates/Sweep.tmpl.h +++ b/python/pystencils_walberla/templates/Sweep.tmpl.h @@ -32,7 +32,9 @@ #include "domain_decomposition/BlockDataID.h" #include "domain_decomposition/IBlock.h" #include "domain_decomposition/StructuredBlockStorage.h" -#include <set> + +#include <functional> +#include <unordered_map> {% for header in interface_spec.headers %} #include {{header}} @@ -60,8 +62,8 @@ class {{class_name}} { public: {{class_name}}( {{kernel|generate_constructor_parameters(parameters_to_ignore=parameters_to_ignore)}} {%if inner_outer_split%}, const Cell & outerWidth=Cell(1, 1, 1){% endif %}) - : {{ kernel|generate_constructor_initializer_list(parameters_to_ignore=parameters_to_ignore) }}{%if inner_outer_split%}{% if kernel|generate_constructor_initializer_list|length %},{% endif %} outerWidth_(outerWidth){% endif %}{%if block_offset%}, configured_(false){% endif %} - {}; + : {{ kernel|generate_constructor_initializer_list(parameters_to_ignore=parameters_to_ignore) }}{%if inner_outer_split%}{% if kernel|generate_constructor_initializer_list|length %},{% endif %} outerWidth_(outerWidth){% endif %}{%if block_offset%}{% for offset in block_offset -%}, {{offset[0]}}_({{offset[1]}}(0)) {% endfor -%}, configured_(false){% endif %} + {} {{ kernel| generate_destructor(class_name) |indent(3) }} -- GitLab