Peano
Loading...
Searching...
No Matches
exaparty.api.Project.Project Class Reference

ExaParty project. More...

Inheritance diagram for exaparty.api.Project.Project:
Collaboration diagram for exaparty.api.Project.Project:

Public Member Functions

 __init__ (self, namespace, project_name, directory=".", executable="exaparty")
 set_load_balancing (self, load_balancer_name, load_balancer_arguments)
 load_balancer_name: string Should be full-qualified name of the load balancer.
 set_Peano4_installation (self, src_path, mode=peano4.api.output.CompileMode.RELEASE)
 src_path: string Path (relative or absolute) to the src directory of Peano.
 real_mesh_size (self, target_h)
 Translate a mesh size into its real Peano mesh size.
 set_global_simulation_parameters (self, dimensions, offset, domain_size, min_end_time, max_end_time, first_plot_time_stamp, time_in_between_plots, periodic_BC=[False, False, False], plotter_precision=5, initial_grid_coarse=False)
 offset and size should be lists with dimensions double entries.
 set_output_path (self, path)
 add_particle_species (self, Particle particle)
 Add a new particle species (type) to the project.
 generate_Peano4_project (self, verbose=False)
 Build the Peano4 project.
 set_realisation (self, parallelisation=Parallelisation_DomainDecomposition, storage=Storage_Scattered, sorting=Sorting_MultiscaleSort, kernel_optimisation=KernelOptimisation_NoOptimisation)
 Specify the realisation of the project: Select.
 main_file_template (self)

Data Fields

 algorithm_step_create_grid = peano4.api.solversteps.Step("CreateGrid", False)
 algorithm_step_initial_conditions
 algorithm_step_plot = peano4.api.solversteps.Step("Plot", False)
 algorithm_step_cleanup = peano4.api.solversteps.Step("Cleanup", False)
list additional_action_sets_per_solver_step = []
tuple algorithm_steps_task_graph_compiler = None
tuple initialisation_steps_task_graph_compiler = None

Static Public Attributes

str LibraryDebug = "_debug"
str LibraryRelease = ""
str LibraryTrace = "_trace"
str LibraryAsserts = "_asserts"
str LibraryStats = "_stats"

Protected Attributes

 _project = peano4.api.Project(namespace, project_name, directory)
list _domain_offset = [0.0, 0.0, 0.0]
list _domain_size = [1.0, 1.0, 1.0]
int _dimensions = 2
float _min_terminal_time = 1.0
float _max_terminal_time = 0.0
bool _make_initial_grid_coarse = False
float _first_plot_time_stamp = 0.0
float _time_in_between_plots = 0.1
str _load_balancer_name = ""
str _load_balancer_arguments = ""
str _Peano_src_directory = "."
 _build_mode = peano4.api.output.CompileMode.ASSERTS
 _executable_name = executable
list _periodic_BC = [False, False, False]
str _output_path = "./"
list _particle_species = []
list _particle_species_set = []
float _global_max_h = 0.0
 _global_min_h = sys.float_info.max
 _plotter_precision

Private Member Functions

 __compute_global_max_h (self)
 Run over all species specified and find out what their maximum (coarsest) h is.
 __compute_global_min_h (self)
 Run over all species specified and find out what their minimum (finest) h is.
 __export_constants (self)
 We export ExaParty's constants.
 __real_max_mesh_size (self)
 Return the max mesh size that the code really will use.
 __real_min_mesh_size (self)
 Return the min mesh size that the code really will use.
 __configure_makefile (self)
 __generate_global_state_files (self)

Detailed Description

ExaParty project.

Represents an abstract ExaParty project. An ExaParty project is a Peano 4 project with a particular set of actions (algorithmic phases) that you can choose from and with particular solver types. It realises a builder mechanism, i.e. you build up your ExaParty project and then you finally tell the project "give me the Peano 4 project". From hereon, you can use this Peano 4 project to actually set up the Peano 4 application.

Please do not use this class directly. Use one of its subclasses.

See also
generate_Peano4_project()

Definition at line 27 of file Project.py.

Constructor & Destructor Documentation

◆ __init__()

exaparty.api.Project.Project.__init__ ( self,
namespace,
project_name,
directory = ".",
executable = "exaparty" )

Definition at line 46 of file Project.py.

Member Function Documentation

◆ __compute_global_max_h()

exaparty.api.Project.Project.__compute_global_max_h ( self)
private

Run over all species specified and find out what their maximum (coarsest) h is.

This value is then used to constrain the mesh adaptivity: The mesh should never be coarser than this, but also the initial mesh should meet this global maximum h.

The outcome is stored in self._global_max_h.

Definition at line 134 of file Project.py.

Referenced by generate_Peano4_project().

Here is the caller graph for this function:

◆ __compute_global_min_h()

exaparty.api.Project.Project.__compute_global_min_h ( self)
private

Run over all species specified and find out what their minimum (finest) h is.

This value is then used to constrain the mesh adaptivity: The mesh should never be coarser than this, but also the initial mesh should meet this global maximum h.

The outcome is stored in self._global_min_h.

Definition at line 151 of file Project.py.

Referenced by generate_Peano4_project().

Here is the caller graph for this function:

◆ __configure_makefile()

◆ __export_constants()

exaparty.api.Project.Project.__export_constants ( self)
private

We export ExaParty's constants.

Besides the constants from ExaParty, I also export some parameters from Peano onto the ExaParty constants file. Therefore, it is important that you parse the configure output before we export the constants.

Definition at line 168 of file Project.py.

References convert::input::PeanoTextPatchFileReader._dimensions, exahype2.api.dslhype.SyntaxTree.Matrix._dimensions, exahype2.api.dslhype.SyntaxTree.MemoryAllocation._dimensions, exahype2.api.dslhype.SyntaxTree.MemoryDeallocation._dimensions, exahype2.api.dslhype.SyntaxTree.Subscript._dimensions, exahype2.api.dslhype.SyntaxTree.TDataBlock._dimensions, exahype2.api.dslhype.SyntaxTree.TSimpleMemref._dimensions, exahype2.api.Project.Project._dimensions, _dimensions, exahype2.api.Project.Project._domain_offset, _domain_offset, exahype2.api.Project.Project._domain_size, _domain_size, exahype2.api.fv.PlotAsVTKFile.PlotAsVTKFile._first_plot_time_stamp, exahype2.api.fv.WriteCheckpoint.WriteCheckpoint._first_plot_time_stamp, exahype2.api.rkfd4.PlotAsVTKFile.PlotAsVTKFile._first_plot_time_stamp, exahype2.api.rkfd4.WriteCheckpoint.WriteCheckpoint._first_plot_time_stamp, _first_plot_time_stamp, exahype2.api.Project.Project._max_terminal_time, _max_terminal_time, exahype2.api.Project.Project._min_terminal_time, _min_terminal_time, _project, exahype2.api.fv.PlotAsVTKFile.PlotAsVTKFile._time_in_between_plots, exahype2.api.fv.WriteCheckpoint.WriteCheckpoint._time_in_between_plots, exahype2.api.rkfd4.PlotAsVTKFile.PlotAsVTKFile._time_in_between_plots, exahype2.api.rkfd4.WriteCheckpoint.WriteCheckpoint._time_in_between_plots, and _time_in_between_plots.

Referenced by api.Project.Project.__configure_makefile(), and generate_Peano4_project().

Here is the caller graph for this function:

◆ __generate_global_state_files()

exaparty.api.Project.Project.__generate_global_state_files ( self)
private

◆ __real_max_mesh_size()

exaparty.api.Project.Project.__real_max_mesh_size ( self)
private

Return the max mesh size that the code really will use.

See the explanation in the generated Readme.md file or in real_mesh_size why this value is smaller than the real mesh size.

Definition at line 357 of file Project.py.

References _global_max_h, and real_mesh_size().

Here is the call graph for this function:

◆ __real_min_mesh_size()

exaparty.api.Project.Project.__real_min_mesh_size ( self)
private

Return the min mesh size that the code really will use.

See the explanation in the generated Readme.md file or in real_mesh_size why this value is smaller than the real mesh size.

Definition at line 369 of file Project.py.

References _global_min_h, and real_mesh_size().

Here is the call graph for this function:

◆ add_particle_species()

exaparty.api.Project.Project.add_particle_species ( self,
Particle particle )

Add a new particle species (type) to the project.

You get the container back in which the particles are handled on the rank. Use this one where another action set requires a particle set.

Definition at line 465 of file Project.py.

References _particle_species, and _particle_species_set.

◆ generate_Peano4_project()

exaparty.api.Project.Project.generate_Peano4_project ( self,
verbose = False )

Build the Peano4 project.

The main job of this routine is to add all the action sets et al that you require to run this ExaHyPE2 application.

This routine generates a Peano project, i.e. the domain-specific ExaHyPE view is translated into a Peano model. Once you have called this routine, any changes to the ExaHyPE 2 configuration do not propagate into the Peano setup anymore. If you alter the ExaHyPE setup, you have to call generate_Peano4_project() again to get a new snapshot/version of the Peano setup.

Initial grid

The initial grid will be a regular one, spanned through

According to the documentation of peano4.api.toolbox.CreateRegularGrid, the action set will produce a mesh that is just finer than the mesh width passed, so we meet the max mesh width, but do not create a mesh that is significantly finer.

As we insert particles in SPH, we have therefore to make this initial resolution three times coarser than what we allow, as we only insert particles into the finest mesh.

Task graph compiler

The core contribution of the generation is the task graph compiler which really is a mapping of algorithm steps per particle species onto grid sweeps. The actual mapping is outsourced into the function represented by self.task_graph_compiler. This way, users can switch the translator's behaviour. This function returns a sequence of mesh traversals. On top of that, we have the default traversals to create a grid, to plot it, to initialise the setup, and to clean up after we're done.

Once we have our three default steps plus a sequence of algorithmic steps per time step, we run through the following steps:

  • Create a particle set around each species and add it to the project as global variable. This is the global container administering these guys.
  • Tell each algorithmic step to use this particle set. An exception could be the grid creation. At this point, we don't have particles yet. We add the data structure nevertheless. It ensures that we have all the data in place, and it we also then can be sure that everything is properly initialised. The actual particle set will be empty at this point of the simulation.
  • Ensure that plotting and initialisation use the update particle-grid association properly. The plot has to update it, as previous steps might have started a resort yet might not have finished it.
  • Add all the algorithmic steps, including the default ones, to the project.

Particle initialisation and proper sorting

The particle initialisation might end up with an invalid association of particles to vertices. The graph compiler might make the first step of a time step sequence sort if and only if the last one has altered the particles' position. Consequently, we might end up with an initialisation which yields an inconsistent data association. We therefore make it sort the particles, but we need another grid sweep to finalise this sort in case we have to do some global rearrangements. This is our rationale why we realise the initialisation in two steps.

Definition at line 479 of file Project.py.

References __compute_global_max_h(), __compute_global_min_h(), __configure_makefile(), exahype2.api.Project.Project.__export_constants(), __export_constants(), __generate_global_state_files(), exahype2.api.Project.Project._build_mode, _build_mode, _global_max_h, _global_min_h, _make_initial_grid_coarse, _particle_species_set, exahype2.api.Project.Project._Peano_src_directory, _Peano_src_directory, _project, additional_action_sets_per_solver_step, algorithm_step_cleanup, algorithm_step_create_grid, algorithm_step_initial_conditions, algorithm_step_plot, algorithm_steps_task_graph_compiler, peano4.api.toolbox.api.EnumerateCellsAndVertices.create_cell_marker(), peano4.api.toolbox.api.EnumerateCellsAndVertices.create_vertex_marker(), and initialisation_steps_task_graph_compiler.

Here is the call graph for this function:

◆ main_file_template()

exaparty.api.Project.Project.main_file_template ( self)

Definition at line 975 of file Project.py.

◆ real_mesh_size()

exaparty.api.Project.Project.real_mesh_size ( self,
target_h )

Translate a mesh size into its real Peano mesh size.

Peano uses three-partitioning. That is, it will neve be able to match given refinement instructions exactly. All it can do is to approximate them.

Returns
Tuple of mesh size and mesh levels

Definition at line 338 of file Project.py.

References exahype2.api.Project.Project._domain_size, and _domain_size.

Referenced by __real_max_mesh_size(), and __real_min_mesh_size().

Here is the caller graph for this function:

◆ set_global_simulation_parameters()

exaparty.api.Project.Project.set_global_simulation_parameters ( self,
dimensions,
offset,
domain_size,
min_end_time,
max_end_time,
first_plot_time_stamp,
time_in_between_plots,
periodic_BC = [False, False, False],
plotter_precision = 5,
initial_grid_coarse = False )

offset and size should be lists with dimensions double entries.

first_plot_time_stamp: Float Is irrelevant if time_in_between_plots equals zero

time_in_between_plots: Float Set to zero if you don't want to have any plots

max_end_time: Float If you set it zero (or actually any value msmaller than min_end_time), then the code will run until the cell that lags behind the most hits the min time. If you specify a valid max time however, you can stop the sim as soon as the most advanced cell exceeds this threshold.

initial_grid_coarse: Bool If true, make the initial grid coarse, i.e. according to max cell size, which is specified via max_h in the added particle species. Otherwise, make initial grid fine, i.e. according to the particle species' min_h.

Definition at line 385 of file Project.py.

References convert::input::PeanoTextPatchFileReader._dimensions, exahype2.api.dslhype.SyntaxTree.Matrix._dimensions, exahype2.api.dslhype.SyntaxTree.MemoryAllocation._dimensions, exahype2.api.dslhype.SyntaxTree.MemoryDeallocation._dimensions, exahype2.api.dslhype.SyntaxTree.Subscript._dimensions, exahype2.api.dslhype.SyntaxTree.TDataBlock._dimensions, exahype2.api.dslhype.SyntaxTree.TSimpleMemref._dimensions, exahype2.api.Project.Project._dimensions, _dimensions, exahype2.api.Project.Project._domain_offset, _domain_offset, exahype2.api.Project.Project._domain_size, _domain_size, exahype2.api.fv.PlotAsVTKFile.PlotAsVTKFile._first_plot_time_stamp, exahype2.api.fv.WriteCheckpoint.WriteCheckpoint._first_plot_time_stamp, exahype2.api.rkfd4.PlotAsVTKFile.PlotAsVTKFile._first_plot_time_stamp, exahype2.api.rkfd4.WriteCheckpoint.WriteCheckpoint._first_plot_time_stamp, _first_plot_time_stamp, _make_initial_grid_coarse, exahype2.api.Project.Project._max_terminal_time, _max_terminal_time, exahype2.api.Project.Project._min_terminal_time, _min_terminal_time, exahype2.api.Project.Project._periodic_BC, _periodic_BC, exahype2.api.fv.PlotAsVTKFile.PlotAsVTKFile._plotter_precision, exahype2.api.fv.WriteCheckpoint.WriteCheckpoint._plotter_precision, exahype2.api.rkfd4.PlotAsVTKFile.PlotAsVTKFile._plotter_precision, exahype2.api.rkfd4.WriteCheckpoint.WriteCheckpoint._plotter_precision, _plotter_precision, exahype2.api.fv.PlotAsVTKFile.PlotAsVTKFile._time_in_between_plots, exahype2.api.fv.WriteCheckpoint.WriteCheckpoint._time_in_between_plots, exahype2.api.rkfd4.PlotAsVTKFile.PlotAsVTKFile._time_in_between_plots, exahype2.api.rkfd4.WriteCheckpoint.WriteCheckpoint._time_in_between_plots, and _time_in_between_plots.

◆ set_load_balancing()

exaparty.api.Project.Project.set_load_balancing ( self,
load_balancer_name,
load_balancer_arguments )

load_balancer_name: string Should be full-qualified name of the load balancer.

By default, I recommend to pass "toolbox::loadbalancing::strategies::SpreadOutHierarchically", but you might be well-advices to study different classes within the namespace toolbox.loadbalancing.

load_balancer_arguments: string If your load balancing requires parameters, add them here. It is a string that will be copied into the C++ class instantiation. Please add the brackets yourself, i.e. "(3,4,5)" is fine, but "3,4,5" is not. The only exception is the empty parameter list. Here, you can/should simply add the empty string.

Definition at line 84 of file Project.py.

References exahype2.api.Project.Project._load_balancer_arguments, _load_balancer_arguments, exahype2.api.Project.Project._load_balancer_name, and _load_balancer_name.

◆ set_output_path()

◆ set_Peano4_installation()

exaparty.api.Project.Project.set_Peano4_installation ( self,
src_path,
mode = peano4.api.output.CompileMode.RELEASE )

src_path: string Path (relative or absolute) to the src directory of Peano.

This path should hold both the headers (in subdirectories) and all the static libraries.

mode: peano4.api.output.CompileMode

Definition at line 110 of file Project.py.

References exahype2.api.Project.Project._build_mode, _build_mode, exahype2.api.Project.Project._Peano_src_directory, and _Peano_src_directory.

◆ set_realisation()

exaparty.api.Project.Project.set_realisation ( self,
parallelisation = Parallelisation_DomainDecomposition,
storage = Storage_Scattered,
sorting = Sorting_MultiscaleSort,
kernel_optimisation = KernelOptimisation_NoOptimisation )

Specify the realisation of the project: Select.

  • which parallelisation method to use (domain-decomposition, task-graph, multisweep-task-graph)
  • which storage strategy to use (scattered, continuous-per-vertex, global-continuous)
  • which particle sorting strategy to use (multiscale-sort, bucket-sort)
  • which kernel optimisation to use (no-optimisation, vectorise-all, vectorise-distance-checks-preamble)

Available options for all these are kept in ./ProjectRealisation.py.

Only call this function after adding particle species to the project via self.add_particle_species().

Definition at line 714 of file Project.py.

References _particle_species, _particle_species_set, algorithm_steps_task_graph_compiler, and initialisation_steps_task_graph_compiler.

Field Documentation

◆ _build_mode

exaparty.api.Project.Project._build_mode = peano4.api.output.CompileMode.ASSERTS
protected

◆ _dimensions

◆ _domain_offset

◆ _domain_size

◆ _executable_name

◆ _first_plot_time_stamp

exaparty.api.Project.Project._first_plot_time_stamp = 0.0
protected

Definition at line 55 of file Project.py.

Referenced by __export_constants(), and set_global_simulation_parameters().

◆ _global_max_h

exaparty.api.Project.Project._global_max_h = 0.0
protected

Definition at line 145 of file Project.py.

Referenced by __real_max_mesh_size(), and generate_Peano4_project().

◆ _global_min_h

exaparty.api.Project.Project._global_min_h = sys.float_info.max
protected

Definition at line 162 of file Project.py.

Referenced by __real_min_mesh_size(), and generate_Peano4_project().

◆ _load_balancer_arguments

str exaparty.api.Project.Project._load_balancer_arguments = ""
protected

◆ _load_balancer_name

str exaparty.api.Project.Project._load_balancer_name = ""
protected

◆ _make_initial_grid_coarse

bool exaparty.api.Project.Project._make_initial_grid_coarse = False
protected

Definition at line 54 of file Project.py.

Referenced by generate_Peano4_project(), and set_global_simulation_parameters().

◆ _max_terminal_time

exaparty.api.Project.Project._max_terminal_time = 0.0
protected

Definition at line 53 of file Project.py.

Referenced by __export_constants(), and set_global_simulation_parameters().

◆ _min_terminal_time

exaparty.api.Project.Project._min_terminal_time = 1.0
protected

Definition at line 52 of file Project.py.

Referenced by __export_constants(), and set_global_simulation_parameters().

◆ _output_path

str exaparty.api.Project.Project._output_path = "./"
protected

◆ _particle_species

exaparty.api.Project.Project._particle_species = []
protected

Definition at line 65 of file Project.py.

Referenced by __generate_global_state_files(), add_particle_species(), and set_realisation().

◆ _particle_species_set

exaparty.api.Project.Project._particle_species_set = []
protected

Definition at line 66 of file Project.py.

Referenced by add_particle_species(), generate_Peano4_project(), and set_realisation().

◆ _Peano_src_directory

str exaparty.api.Project.Project._Peano_src_directory = "."
protected

◆ _periodic_BC

exaparty.api.Project.Project._periodic_BC = [False, False, False]
protected

Definition at line 62 of file Project.py.

Referenced by set_global_simulation_parameters().

◆ _plotter_precision

exaparty.api.Project.Project._plotter_precision
protected

◆ _project

◆ _time_in_between_plots

exaparty.api.Project.Project._time_in_between_plots = 0.1
protected

Definition at line 56 of file Project.py.

Referenced by __export_constants(), and set_global_simulation_parameters().

◆ additional_action_sets_per_solver_step

list exaparty.api.Project.Project.additional_action_sets_per_solver_step = []

Definition at line 75 of file Project.py.

Referenced by generate_Peano4_project().

◆ algorithm_step_cleanup

exaparty.api.Project.Project.algorithm_step_cleanup = peano4.api.solversteps.Step("Cleanup", False)

Definition at line 73 of file Project.py.

Referenced by generate_Peano4_project().

◆ algorithm_step_create_grid

exaparty.api.Project.Project.algorithm_step_create_grid = peano4.api.solversteps.Step("CreateGrid", False)

◆ algorithm_step_initial_conditions

exaparty.api.Project.Project.algorithm_step_initial_conditions
Initial value:
"InitialConditions", False
)

Definition at line 69 of file Project.py.

Referenced by generate_Peano4_project().

◆ algorithm_step_plot

exaparty.api.Project.Project.algorithm_step_plot = peano4.api.solversteps.Step("Plot", False)

◆ algorithm_steps_task_graph_compiler

tuple exaparty.api.Project.Project.algorithm_steps_task_graph_compiler = None

Definition at line 78 of file Project.py.

Referenced by generate_Peano4_project(), and set_realisation().

◆ initialisation_steps_task_graph_compiler

tuple exaparty.api.Project.Project.initialisation_steps_task_graph_compiler = None

Definition at line 79 of file Project.py.

Referenced by generate_Peano4_project(), and set_realisation().

◆ LibraryAsserts

str exaparty.api.Project.Project.LibraryAsserts = "_asserts"
static

Definition at line 107 of file Project.py.

◆ LibraryDebug

str exaparty.api.Project.Project.LibraryDebug = "_debug"
static

Definition at line 104 of file Project.py.

◆ LibraryRelease

str exaparty.api.Project.Project.LibraryRelease = ""
static

Definition at line 105 of file Project.py.

◆ LibraryStats

str exaparty.api.Project.Project.LibraryStats = "_stats"
static

Definition at line 108 of file Project.py.

◆ LibraryTrace

str exaparty.api.Project.Project.LibraryTrace = "_trace"
static

Definition at line 106 of file Project.py.


The documentation for this class was generated from the following file: