Chi-Tech
sweepscheduler_constrdestr.cc
Go to the documentation of this file.
1#include "sweepscheduler.h"
2
3#include "chi_runtime.h"
4#include "chi_log.h"
5
6// ###################################################################
7/**Sweep scheduler constructor*/
9 SchedulingAlgorithm in_scheduler_type,
11 SweepChunk& in_sweep_chunk)
12 : scheduler_type_(in_scheduler_type),
13 angle_agg_(in_angle_agg),
14 sweep_chunk_(in_sweep_chunk),
15 sweep_event_tag_(Chi::log.GetRepeatingEventTag("Sweep Timing")),
16 sweep_timing_events_tag_(
17 {Chi::log.GetRepeatingEventTag("Sweep Chunk Only Timing"),
19
20{
21 angle_agg_.InitializeReflectingBCs();
22
23 if (scheduler_type_ == SchedulingAlgorithm::DEPTH_OF_GRAPH)
24 InitializeAlgoDOG();
25
26 //=================================== Initialize delayed upstream data
27 for (auto& angsetgrp : in_angle_agg.angle_set_groups)
28 for (auto& angset : angsetgrp.AngleSets())
29 angset->InitializeDelayedUpstreamData();
30
31 //=================================== Get local max num messages accross
32 // anglesets
33 int local_max_num_messages = 0;
34 for (auto& angsetgrp : in_angle_agg.angle_set_groups)
35 for (auto& angset : angsetgrp.AngleSets())
36 local_max_num_messages =
37 std::max(angset->GetMaxBufferMessages(), local_max_num_messages);
38
39 //=================================== Reconcile all local maximums
40 int global_max_num_messages = 0;
41 MPI_Allreduce(&local_max_num_messages,
42 &global_max_num_messages,
43 1,
44 MPI_INT,
45 MPI_MAX,
46 Chi::mpi.comm);
47
48 //=================================== Propogate items back to sweep buffers
49 for (auto& angsetgrp : in_angle_agg.angle_set_groups)
50 for (auto& angset : angsetgrp.AngleSets())
51 angset->SetMaxBufferMessages(global_max_num_messages);
52}
53
54// ###################################################################
55/**Returns the referenced sweep chunk.*/
58{
59 return sweep_chunk_;
60}
static chi::ChiLog & log
Definition: chi_runtime.h:81
static chi::MPI_Info & mpi
Definition: chi_runtime.h:78
size_t GetRepeatingEventTag(std::string event_name)
Definition: chi_log.cc:176
SweepScheduler(SchedulingAlgorithm in_scheduler_type, AngleAggregation &in_angle_agg, SweepChunk &in_sweep_chunk)