23using namespace shammodels::gsph;
26auto GSPHGhostHandler<vec>::gen_id_table_interfaces(GeneratorMap &&gen)
29 using namespace shamrock::patch;
33 std::map<u64, f64> send_count_stats;
35 const u32 ixyz = sched.pdl_old().template get_field_idx<vec>(
"xyz");
37 gen.for_each([&](
u64 sender,
u64 receiver, InterfaceBuildInfos &build) {
42 [](
auto access,
u32 id, vec vmin, vec vmax) {
45 build.cut_volume.lower,
46 build.cut_volume.upper);
48 u32 pcnt = idxs_res.get_size();
68 res.
add_obj(sender, receiver, InterfaceIdTable{build, std::move(idxs_res), ratio});
70 send_count_stats[sender] += ratio;
73 bool has_warn =
false;
75 std::string warn_log =
"";
77 for (
auto &[k, v] : send_count_stats) {
84 warn_log =
"\n High interf/patch volume. This can lead to high mpi "
85 "overhead, try to increase the patch split crit"
90 logger::warn_ln(
"InterfaceGen",
"High interface/patch volume ratio." + warn_log);
97void GSPHGhostHandler<vec>::gen_debug_patch_ghost(
101 static u32 cnt_dump_debug = 0;
103 std::string loc_graph =
"";
104 interf_info.
for_each([&loc_graph](
u64 send,
u64 recv, InterfaceIdTable &info) {
105 loc_graph += sham::format(
" p{} -> p{}\n", send, recv);
108 sched.for_each_patch_data(
111 loc_graph += sham::format(
112 " p{} [label= \"id={} N={}\"]\n",
id,
id, pdat.
get_obj_cnt());
116 std::string dot_graph =
"";
119 dot_graph =
"strict digraph {\n" + dot_graph +
"}";
122 std::string fname = sham::format(
"ghost_graph_{}.dot", cnt_dump_debug);
constexpr const char * xyz
Position field (3D coordinates).
GSPH-specific ghost handler using Newtonian physics field names.
double f64
Alias for double.
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
A buffer allocated in USM (Unified Shared Memory).
Container for objects shared between two distributed data elements.
void for_each(std::function< void(u64, u64, T &)> &&f)
Apply a function to all stored objects.
iterator add_obj(u64 left_id, u64 right_id, T &&obj)
Add an object associated with a patch pair.
PatchDataLayer container class, the layout is described in patchdata_layout.
u32 get_obj_cnt() const
get the number of objects (particles) stored in this layer
This header file contains utility functions related to exception handling in the code.
MPI string gather / allgather helpers (declarations; implementations in shamalgs/src/collective/gathe...
void gather_str(const std::string &send_vec, std::string &recv_vec)
Gathers a string from all nodes and store the result in a std::string.
void write_string_to_file(std::string filename, std::string s)
dump a string to a file
i32 world_rank()
Gives the rank of the current process in the MPI communicator.
void info_ln(std::string module_name, Types... var2)
Prints a log message with multiple arguments followed by a newline.
void warn_ln(std::string module_name, Types... var2)
Prints a log message with multiple arguments followed by a newline.
shambase::details::BasicStackEntry StackEntry
Alias for shambase::details::BasicStackEntry.
Patch object that contain generic patch information.
static bool is_in_patch_converted(sycl::vec< T, 3 > val, sycl::vec< T, 3 > min_val, sycl::vec< T, 3 > max_val)
check if particle is in the asked range, given the output of @convert_coord