48 inline void balance_load(std::function<
void(
void)> load_balance_update) {
52 "DataInserterUtility",
"---------------------------------------------"));
59 for (; i < max_runs; i++) {
64 load_balance_update();
72 sched.scheduler_step(
false,
false);
73 sched.scheduler_step(
true,
true);
75 u64 npatch_new = sched.patch_list.global.size();
76 if (npatch_new != npatch_last) {
77 npatch_last = npatch_new;
85 "DataInserterUtility",
86 "patch count stable after",
93 "DataInserterUtility",
"---------------------------------------------"));
114 std::string main_field_name,
116 std::function<
void(
void)> load_balance_update) {
117 using namespace shamrock::patch;
119 u64 pdat_ob_cnt = pdat_ins.get_obj_cnt();
121 u64 sum_push = shamalgs::collective::allreduce_sum(pdat_ob_cnt);
123 logger::info_ln(
"DataInserterUtility",
"pushing data in scheduler, N =", sum_push);
126 if (pdat_ob_cnt < split_threshold) {
127 bool should_insert =
true;
130 pdat.insert_elements(pdat_ins);
131 should_insert =
false;
136 "Not implemented yet please keep the obj count to be "
137 "inserted below the split_threshold, sorrrrrry ...");
151 sched.check_patchdata_locality_correctness();
156 "DataInserterUtility",
"reattributing data done in ", treatrib.
get_time_str());
160 balance_load(load_balance_update);
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
SchedulerPatchList patch_list
handle the list of the patches of the scheduler
std::vector< shamrock::patch::Patch > global
contain the list of all patches in the simulation
Class Timer measures the time elapsed since the timer was started.
std::string get_time_str() const
Converts the stored nanosecond time to a string representation.
void start()
Starts the timer.
void stop()
Stops the timer and stores the elapsed time in nanoseconds.
u64 push_patch_data(shamrock::patch::PatchDataLayer &pdat_ins, std::string main_field_name, u32 split_threshold, std::function< void(void)> load_balance_update)
Pushes data into the scheduler.
DataInserterUtility(PatchScheduler &sched)
Constructor.
Utility class used to move the objects between patches.
void reatribute_patch_objects(SerialPatchTree< T > &sptree, std::string position_field)
Reattribute objects based on a given position field.
PatchDataLayer container class, the layout is described in patchdata_layout.
void throw_unimplemented(SourceLocation loc=SourceLocation{})
Throw a std::runtime_error saying that the function is unimplemented.
i32 world_rank()
Gives the rank of the current process in the MPI communicator.
namespace for the main framework
void info_ln(std::string module_name, Types... var2)
Prints a log message with multiple arguments followed by a newline.
Patch object that contain generic patch information.
Functions related to the MPI communicator.
#define ON_RANK_0(x)
Macro to execute code only on rank 0.
void Barrier(MPI_Comm comm)
MPI wrapper for MPI_Barrier.