Peano
Loading...
Searching...
No Matches
UpdateParticle_MultiLevelInteraction_Sets.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
6from .TaskGraphKernelWrappers import (
7 construct_touch_vertex_first_time_call,
8 construct_touch_cell_first_time_call,
9 construct_touch_vertex_last_time_call,
10)
11
12
15):
16 """!
17
18 Slight modification of toolbox's update particle action set
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(UpdateParticle_MultiLevelInteraction_Sets, self).__init__(
63 particle_set,
64 particle_particle_interaction_kernel=construct_touch_cell_first_time_call(
65 particle_set,
66 particle_particle_interaction_kernel,
67 use_multilevel_dependencies=True
68 ),
69 touch_vertex_first_time_compute_particle_update_kernel=construct_touch_vertex_first_time_call(
70 particle_set,
71 touch_vertex_first_time_compute_particle_update_kernel,
72 use_multilevel_dependencies=True
73 ),
74 touch_vertex_last_time_compute_particle_update_kernel=construct_touch_vertex_last_time_call(
75 particle_set,
76 touch_vertex_last_time_compute_particle_update_kernel,
77 use_multilevel_dependencies=True,
78 alter_particle_position_or_interaction_radius=alter_particle_position_or_interaction_radius
79 ),
80 prepare_traversal_kernel=prepare_traversal_kernel,
81 unprepare_traversal_kernel=unprepare_traversal_kernel,
82 additional_includes=additional_includes
83 + """
84#include "tarch/multicore/Task.h"
85#include "exaparty/exaparty.h"
86#include "exaparty/TaskNumber.h"
87 """,
88 active_particle_set=active_particle_set,
89 )
90
91 def get_body_of_operation(self, operation_name):
92 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_BEGIN_TRAVERSAL:
93 return "_pendingDependencies.clear();"
94 else:
95 return super(
96 UpdateParticle_MultiLevelInteraction_Sets, self
97 ).get_body_of_operation(operation_name)
98
99 def get_attributes(self):
100 return (
101 super(UpdateParticle_MultiLevelInteraction_Sets, self).get_attributes()
102 + """
103 ::exaparty::PendingDependencies _pendingDependencies;
104 """
105 )
106
108 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.