Skip to content
Snippets Groups Projects
Commit 0968cbff authored by Daniel Bauer's avatar Daniel Bauer :speech_balloon:
Browse files

Merge branch 'kohl/timing-c-printer' into 'main'

Adding a timer around the C printer call in CppMethod.from_kernel_function.

See merge request !27
parents 82a3d030 1304dc59
No related branches found
No related tags found
1 merge request!27Adding a timer around the C printer call in CppMethod.from_kernel_function.
Pipeline #68679 passed with warnings
...@@ -598,71 +598,72 @@ class HyTeGElementwiseOperator: ...@@ -598,71 +598,72 @@ class HyTeGElementwiseOperator:
for member in kernel_wrapper_type.member_variables(): for member in kernel_wrapper_type.member_variables():
operator_cpp_class.add(member) operator_cpp_class.add(member)
# Add all kernels to the class. with TimedLogger("Generating C code from kernel AST(s)"):
for operator_method in self.operator_methods: # Add all kernels to the class.
for operator_method in self.operator_methods:
num_integrals = len(operator_method.integration_infos) num_integrals = len(operator_method.integration_infos)
if num_integrals != len( if num_integrals != len(
operator_method.kernel_functions operator_method.kernel_functions
) or num_integrals != len(operator_method.operation_counts): ) or num_integrals != len(operator_method.operation_counts):
raise HOGException( raise HOGException(
"There should be as many IntegrationInfo (aka integrals) as KernelFunctions (aka kernels)." "There should be as many IntegrationInfo (aka integrals) as KernelFunctions (aka kernels)."
) )
for ( for (
integration_info, integration_info,
sub_kernel, sub_kernel,
operation_count, operation_count,
platform_dependent_funcs, platform_dependent_funcs,
) in zip( ) in zip(
operator_method.integration_infos, operator_method.integration_infos,
operator_method.kernel_functions, operator_method.kernel_functions,
operator_method.operation_counts, operator_method.operation_counts,
operator_method.platform_dependent_funcs, operator_method.platform_dependent_funcs,
): ):
kernel_docstring = "\n".join( kernel_docstring = "\n".join(
[ [
f"\nIntegral: {integration_info.name}", f"\nIntegral: {integration_info.name}",
f"- volume element: {integration_info.geometry}", f"- volume element: {integration_info.geometry}",
f"- kernel type: {operator_method.kernel_wrapper_type.name}", f"- kernel type: {operator_method.kernel_wrapper_type.name}",
f"- loop strategy: {integration_info.loop_strategy}", f"- loop strategy: {integration_info.loop_strategy}",
f"- quadrature rule: {integration_info.quad}", f"- quadrature rule: {integration_info.quad}",
f"- blending map: {integration_info.blending}", f"- blending map: {integration_info.blending}",
f"- operations per element:", f"- operations per element:",
operation_count, operation_count,
] ]
) )
if class_files == CppClassFiles.HEADER_IMPL_AND_VARIANTS: if class_files == CppClassFiles.HEADER_IMPL_AND_VARIANTS:
operator_cpp_class.add( operator_cpp_class.add(
CppMethodWithVariants( CppMethodWithVariants(
{ {
platform: CppMethod.from_kernel_function( platform: CppMethod.from_kernel_function(
plat_dep_kernel, plat_dep_kernel,
is_const=True, is_const=True,
visibility="private", visibility="private",
docstring=indent( docstring=indent(
kernel_docstring, kernel_docstring,
"/// ", "/// ",
), ),
) )
for platform, plat_dep_kernel in platform_dependent_funcs.items() for platform, plat_dep_kernel in platform_dependent_funcs.items()
} }
)
) )
) else:
else: operator_cpp_class.add(
operator_cpp_class.add( CppMethod.from_kernel_function(
CppMethod.from_kernel_function( sub_kernel,
sub_kernel, is_const=True,
is_const=True, visibility="private",
visibility="private", docstring=indent(
docstring=indent( kernel_docstring,
kernel_docstring, "/// ",
"/// ", ),
), )
) )
)
# Free symbols that shall be settable through the ctor. # Free symbols that shall be settable through the ctor.
# Those are only free symbols that have been explicitly defined by the user. Other undefined sympy symbols are # Those are only free symbols that have been explicitly defined by the user. Other undefined sympy symbols are
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment