48 inline void balance_load(std::function<
void(
void)> load_balance_update) {
52 "DataInserterUtility",
"---------------------------------------------"));
59 for (; i < max_runs; i++) {
61 logger::info_ln(
"DataInserterUtility",
"Compute load ...");
64 load_balance_update();
66 shamcomm::mpi::Barrier(MPI_COMM_WORLD);
69 logger::info_ln(
"DataInserterUtility",
"run scheduler step ...");
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 ...");
141 logger::info_ln(
"DataInserterUtility",
"reattributing data ...");
151 sched.check_patchdata_locality_correctness();
156 "DataInserterUtility",
"reattributing data done in ", treatrib.
get_time_str());
158 shamcomm::mpi::Barrier(MPI_COMM_WORLD);
160 balance_load(load_balance_update);
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
void scheduler_step(bool do_split_merge, bool do_load_balancing)
scheduler step
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 end()
Stops the timer and stores the elapsed time in nanoseconds.
void start()
Starts the timer.
Class to insert data in the PatchScheduler.
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
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.