Peano
Loading...
Searching...
No Matches
GlobalFixedTimeStepWithEnclaveTasking.py
Go to the documentation of this file.
1# This file is part of the ExaHyPE2 project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3from exahype2.solvers.PDETerms import PDETerms
4from exahype2.solvers.fv.EnclaveTasking import EnclaveTasking
5
6import jinja2
7
8from .kernels import create_abstract_solver_declarations
9from .kernels import create_abstract_solver_definitions
10from .kernels import create_solver_declarations
11from .kernels import create_solver_definitions
12from .kernels import create_rusanov_kernel_definitions
13from .kernels import create_compute_Riemann_kernel_for_Rusanov_dsl
14
15from .kernels import SolverVariant
16from .kernels import KernelVariant
17
18from exahype2.solvers.fv.FixedTimeSteppingCodeSnippets import FixedTimeSteppingCodeSnippets
19
20
22 def __init__(self,
23 name, patch_size, unknowns, auxiliary_variables, min_volume_h, max_volume_h, normalised_time_step_size,
24 flux=PDETerms.User_Defined_Implementation,
25 ncp=PDETerms.None_Implementation,
26 eigenvalues=PDETerms.User_Defined_Implementation,
27 boundary_conditions=PDETerms.User_Defined_Implementation,
28 refinement_criterion=PDETerms.Empty_Implementation,
29 initial_conditions=PDETerms.User_Defined_Implementation,
30 source_term=PDETerms.None_Implementation,
31 plot_grid_properties=False,
32 pde_terms_without_state=False, overlap=1
33 ):
34 """
35 time_step_size: Float
36 This is the normalised time step size w.r.t. the coarsest admissible h value. If
37 the code employs AMR on top of it and refines further, it will automatically
38 downscale the time step size accordingly. So hand in a valid time step size w.r.t.
39 to max_volume_h.
40 """
41 super(GlobalFixedTimeStepWithEnclaveTasking,self).__init__(name,
42 patch_size,
43 overlap,
44 unknowns,
45 auxiliary_variables,
46 min_volume_h,
47 max_volume_h,
48 plot_grid_properties,
49 pde_terms_without_state,
50 kernel_namespace="rusanov")
51 self._normalised_time_step_size = normalised_time_step_size
52
53 self._flux_implementation_flux_implementation = PDETerms.None_Implementation
54 self._ncp_implementation_ncp_implementation = PDETerms.None_Implementation
57
59 ncp=ncp,
60 eigenvalues=eigenvalues,
61 boundary_conditions=boundary_conditions,
62 refinement_criterion=refinement_criterion,
63 initial_conditions=initial_conditions,
64 source_term=source_term)
65
66
68 flux=None,ncp=None,
69 eigenvalues=None,
70 boundary_conditions=None,refinement_criterion=None,initial_conditions=None,source_term=None,
71 memory_location = None,
72 use_split_loop = False,
73 additional_action_set_includes = "",
74 additional_user_includes = ""
75 ):
76 """
77 If you pass in User_Defined, then the generator will create C++ stubs
78 that you have to befill manually. If you pass in None_Implementation, it
79 will create nop, i.e., no implementation or defaults. Any other string
80 is copied 1:1 into the implementation. If you pass in None, then the
81 set value so far won't be overwritten.
82
83 Please note that not all options are supported by all solvers.
84
85 This routine should be the very last invoked by the constructor.
86 """
87 if flux is not None: self._flux_implementation_flux_implementation = flux
88 if ncp is not None: self._ncp_implementation_ncp_implementation = ncp
89 if eigenvalues is not None: self._eigenvalues_implementation_eigenvalues_implementation = eigenvalues
90 if source_term is not None: self._source_term_implementation_source_term_implementation = source_term
91
92 create_rusanov_kernel_definitions(self._patch_size_patch_size,
98 compute_max_eigenvalue_of_next_time_step = True
99 )
100
101 self._compute_kernel_call_compute_kernel_call = create_compute_Riemann_kernel_for_Rusanov_dsl(
105 compute_max_eigenvalue_of_next_time_step = False,
106 solver_variant = SolverVariant.WithVirtualFunctions,
107 kernel_variant = KernelVariant.PatchWiseAoS
108 )
109
110 self._compute_kernel_call_stateless_compute_kernel_call_stateless = create_compute_Riemann_kernel_for_Rusanov_dsl(
114 compute_max_eigenvalue_of_next_time_step = False,
115 solver_variant = SolverVariant.Stateless,
116 kernel_variant = KernelVariant.PatchWiseAoS
117 )
118
123 compute_max_eigenvalue_of_next_time_step = True,
124 solver_variant = SolverVariant.Stateless,
125 kernel_variant = KernelVariant.PatchWiseAoS
126 )
127
132 compute_max_eigenvalue_of_next_time_step = True,
133 solver_variant = SolverVariant.Accelerator,
134 kernel_variant = KernelVariant.PatchWiseAoS
135 )
136
138
140 self._abstract_solver_user_declarations_abstract_solver_user_declarations += solver_code_snippets.create_abstract_solver_user_declarations()
142 self._abstract_solver_user_definitions_abstract_solver_user_definitions += solver_code_snippets.create_abstract_solver_user_definitions()
143
146
147 self._compute_time_step_size_compute_time_step_size = solver_code_snippets.create_compute_time_step_size()
148 self._compute_new_time_step_size_compute_new_time_step_size = solver_code_snippets.create_compute_new_time_step_size()
149
150 self._start_time_step_implementation_start_time_step_implementation = solver_code_snippets.create_start_time_step_implementation()
151 self._finish_time_step_implementation_finish_time_step_implementation = solver_code_snippets.create_finish_time_step_implementation()
152 self._constructor_implementation_constructor_implementation = solver_code_snippets.create_abstract_solver_constructor_statements()
153
154 super(GlobalFixedTimeStepWithEnclaveTasking,self).set_implementation(boundary_conditions, refinement_criterion, initial_conditions, memory_location, use_split_loop, additional_action_set_includes, additional_user_includes)
155
156
158 super(GlobalFixedTimeStepWithEnclaveTasking,self).create_data_structures()
160
161 @property
163 return super(GlobalFixedTimeStepWithEnclaveTasking, self).user_action_set_includes + """
164#include "kernels/rusanov.h"
165"""
Enclave tasking variant of the Finite Volume scheme.
_optimise_patch_storage_for_global_time_stepping(self)
Make storage and loading more restrictive such that enclave data are not held in-between primary and ...
set_implementation(self, boundary_conditions, refinement_criterion, initial_conditions, memory_location, use_split_loop, additional_action_set_includes, additional_user_includes)
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
Code snippet generator for fixed time stepping in the Runge-Kutta schemes.
user_action_set_includes(self)
Add further includes to this property, if your action sets require some additional routines from othe...
set_implementation(self, flux=None, ncp=None, eigenvalues=None, boundary_conditions=None, refinement_criterion=None, initial_conditions=None, source_term=None, memory_location=None, use_split_loop=False, additional_action_set_includes="", additional_user_includes="")
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
__init__(self, name, patch_size, unknowns, auxiliary_variables, min_volume_h, max_volume_h, normalised_time_step_size, flux=PDETerms.User_Defined_Implementation, ncp=PDETerms.None_Implementation, eigenvalues=PDETerms.User_Defined_Implementation, boundary_conditions=PDETerms.User_Defined_Implementation, refinement_criterion=PDETerms.Empty_Implementation, initial_conditions=PDETerms.User_Defined_Implementation, source_term=PDETerms.None_Implementation, plot_grid_properties=False, pde_terms_without_state=False, overlap=1)
time_step_size: Float This is the normalised time step size w.r.t.
create_data_structures(self)
This routine does not really add new data, but it heavily tailors when data are stored,...