23#include <unordered_set>
32 using namespace shamrock::patch;
34 auto edges = get_edges();
37 auto &positions = edges.positions;
38 auto &interface_infos = edges.interface_infos.values;
44 std::vector<u64> ids_vec = positions.get_refs().get_ids();
45 std::unordered_set<u64> non_empty_senders(ids_vec.begin(), ids_vec.end());
49 std::map<u64, f64> send_count_stats;
51 interface_infos.
for_each([&](
u64 sender,
u64 receiver,
const InterfaceBuildInfos &build) {
52 if (non_empty_senders.find(sender) == non_empty_senders.end()) {
59 [](
auto access,
u32 id, Tvec vmin, Tvec vmax) {
62 build.cut_volume.lower,
63 build.cut_volume.upper);
72 f64 ratio =
f64(pcnt) /
f64(xyz.get_obj_cnt());
85 res.
add_obj(sender, receiver, InterfaceIdTable{build, std::move(idxs_res), ratio});
87 send_count_stats[sender] += ratio;
90 bool has_warn =
false;
92 std::string warn_log =
"";
94 for (
auto &[k, v] : send_count_stats) {
96 warn_log += sham::format(
"\n patch {} high interf/patch volume: {}", k, v);
102 warn_log =
"\n This can lead to high mpi "
103 "overhead, try to increase the patch split crit"
108 logger::warn_ln(
"InterfaceGen",
"High interface/patch volume ratio." + warn_log);
111 edges.interface_id_table.values = std::move(res);
Solvergraph node selecting the ids of the particles sent through each ghost interface.
Header file for the patch struct and related function.
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).
size_t get_size() const
Gets the number of elements in the buffer.
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.
Build the id table of every ghost interface.
void _impl_evaluate_internal()
evaluate the node
virtual std::string _impl_get_tex() const
get the tex of the node
i32 world_rank()
Gives the rank of the current process in the MPI communicator.
void warn_ln(std::string module_name, Types... var2)
Prints a log message with multiple arguments followed by a newline.
This file contains the definition for the stacktrace related functionality.
#define __shamrock_stack_entry()
Macro to create a stack entry.
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
Functions related to the MPI communicator.