Peano
Loading...
Searching...
No Matches
UpdateParticle_MultiLevelInteraction_StackOfLists_ContiguousParticles.py
Go to the documentation of this file.
1# This file is part of the ExaParty project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3import peano4.api
5
6
7from .TaskGraphKernelWrappers import (
8 construct_touch_vertex_first_time_call,
9 construct_touch_cell_first_time_call,
10 construct_touch_vertex_last_time_call,
11)
12
15):
16 """!
17
18 Plain wrapper around peano4.api.toolbox.particles.UpdateParticle_MultiLevelInteraction_StackOfLists_ContiguousParticles that introduces tasks
19
20 The interesting stuff is actually happing in
21 TaskGarphKernelWrappers.py however.
22
23 """
24
26 self,
27 particle_set,
28 particle_particle_interaction_kernel,
29 touch_vertex_first_time_compute_particle_update_kernel,
30 touch_vertex_last_time_compute_particle_update_kernel,
31 prepare_traversal_kernel,
32 unprepare_traversal_kernel,
33 additional_includes,
34 active_particle_set,
35 alter_particle_position_or_interaction_radius,
36 wait_for_all_tasks_to_finish_after_traversal,
37 ):
38 """!
39
40 Construct
41
42
43 @param wait_for_all_tasks_to_finish_after_traversal: Boolean
44 If this one is set, we insert a wait into the unprepare traversal
45 event. Each rank then waits for all tasks to be completed before
46 it continues. We have a strong synchronisation point.
47
48 @param alter_particle_position_or_interaction_radius: Boolean
49 Set if the underlying AlgorithmStep's effect might change a
50 particle's position or interaction radius.
51 @see exaparty.api.particle.AlgorithmStep.AlgorithmStep.may_trigger_rerun()
52
53 """
54 if wait_for_all_tasks_to_finish_after_traversal:
55 unprepare_traversal_kernel = (
56 unprepare_traversal_kernel
57 + """
58 tarch::multicore::waitForAllTasks();
59 """
60 )
61
62 super(
63 UpdateParticle_MultiLevelInteraction_StackOfLists_ContiguousParticles, self
64 ).__init__(
65 particle_set,
66 particle_particle_interaction_kernel=construct_touch_cell_first_time_call(
67 particle_set,
68 particle_particle_interaction_kernel,
69 use_multilevel_dependencies=True
70 ),
71 touch_vertex_first_time_compute_particle_update_kernel=construct_touch_vertex_first_time_call(
72 particle_set,
73 touch_vertex_first_time_compute_particle_update_kernel,
74 use_multilevel_dependencies=True
75 ),
76 touch_vertex_last_time_compute_particle_update_kernel=construct_touch_vertex_last_time_call(
77 particle_set,
78 touch_vertex_last_time_compute_particle_update_kernel,
79 use_multilevel_dependencies=True,
80 alter_particle_position_or_interaction_radius=alter_particle_position_or_interaction_radius
81 ),
82 prepare_traversal_kernel=prepare_traversal_kernel,
83 unprepare_traversal_kernel=unprepare_traversal_kernel,
84 additional_includes=additional_includes
85 + """
86#include "tarch/multicore/Task.h"
87#include "exaparty/exaparty.h"
88#include "exaparty/TaskNumber.h"
89 """,
90 active_particle_set=active_particle_set,
91 )
92
93 def get_body_of_operation(self, operation_name):
94 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_BEGIN_TRAVERSAL:
95 return "_pendingDependencies.clear();"
96 else:
97 return super(
98 UpdateParticle_MultiLevelInteraction_StackOfLists_ContiguousParticles, self
99 ).get_body_of_operation(operation_name)
100
101 def get_attributes(self):
102 return (
103 super(UpdateParticle_MultiLevelInteraction_StackOfLists_ContiguousParticles, self).get_attributes()
104 + """
105 ::exaparty::PendingDependencies _pendingDependencies;
106 """
107 )
108
110 return __name__.replace(".py", "").replace(".", "_")
__init__(self, particle_set, particle_particle_interaction_kernel, touch_vertex_first_time_compute_particle_update_kernel, touch_vertex_last_time_compute_particle_update_kernel, prepare_traversal_kernel, unprepare_traversal_kernel, additional_includes, active_particle_set, alter_particle_position_or_interaction_radius, wait_for_all_tasks_to_finish_after_traversal)
Construct.