nm_coll_trees.h
Go to the documentation of this file.
58 };
77void nm_coll_tree_init(struct nm_coll_tree_info_s*p_tree, nm_coll_tree_kind_t kind, int n, int self,
84void nm_coll_tree_step(const struct nm_coll_tree_info_s*p_tree, int step, int*p_parent, int*p_children, int*n_children);
97void nm_coll_tree_descendants(const struct nm_coll_tree_info_s*p_tree, int step, int self, int*p_descendants);
103nm_coll_tree_kind_t nm_coll_tree_heuristic(int comm_size, nm_len_t data_size, const struct nm_coll_topology_s*p_topology);
106nm_coll_tree_kind_t nm_coll_tree_weight_heuristic(int comm_size, nm_len_t data_size, const struct nm_coll_topology_s*p_topology);
246static inline void nm_coll_tree_status_init(struct nm_coll_tree_status_s*p_status, nm_session_t p_session,
253 nm_coll_tree_init(&p_status->tree, kind, nm_group_size(p_group), self, nm_group_get_topology(p_group), root);
255 p_status->children_requests = padico_malloc((1 + p_status->tree.max_arity) * sizeof(nm_sr_request_t));
303static inline void nm_coll_tree_set_notifier(struct nm_coll_tree_status_s*p_coll_tree, nm_sr_request_t*p_req,
310static inline int nm_coll_tree_req_index(struct nm_coll_tree_status_s*p_coll_tree, nm_sr_request_t*p_request)
int nm_group_size(nm_group_t group)
const struct nm_coll_topology_s * nm_group_get_topology(nm_group_t p_group)
nm_gate_t nm_group_get_gate(nm_group_t p_group, int rank)
static int nm_coll_tree_max_weight(const struct nm_coll_tree_info_s *p_tree)
find the weight for the local process, without knowing at wich step we have a parent
Definition nm_coll_trees.h:112
nm_coll_tree_kind_t nm_coll_tree_kind_by_name(const char *s_kind)
static void nm_coll_tree_recv(struct nm_coll_tree_status_s *p_coll_tree, int from, struct nm_data_s *p_data, nm_sr_request_t *p_req)
Definition nm_coll_trees.h:294
static void nm_coll_tree_issend(struct nm_coll_tree_status_s *p_coll_tree, int dest, struct nm_data_s *p_data, nm_sr_request_t *p_req)
Definition nm_coll_trees.h:283
static void nm_coll_tree_set_notifier(struct nm_coll_tree_status_s *p_coll_tree, nm_sr_request_t *p_req, void(*p_notifier)(nm_sr_event_t, const nm_sr_event_info_t *, void *))
Definition nm_coll_trees.h:303
void nm_coll_tree_descendants(const struct nm_coll_tree_info_s *p_tree, int step, int self, int *p_descendants)
get all the leaves below the 'self' vertex, including self
void nm_coll_tree_init(struct nm_coll_tree_info_s *p_tree, nm_coll_tree_kind_t kind, int n, int self, const struct nm_coll_topology_s *p_topology, int root)
static void nm_coll_tree_send(struct nm_coll_tree_status_s *p_coll_tree, int dest, struct nm_data_s *p_data, nm_sr_request_t *p_req)
Definition nm_coll_trees.h:274
static int nm_coll_r2v(int i, const struct nm_coll_tree_info_s *p_tree)
translate real ranks to virtual ranks (with root=0)
Definition nm_coll_trees.h:216
int nm_coll_binary_nb_nodes_in_left_subtree(const struct nm_coll_tree_info_s *const p_tree)
int nm_coll_tree_has_descendants(nm_coll_tree_kind_t k)
whether this coll_tree kind implements 'descendants' method for scatter/gather
static int nm_coll_v2r(int i, const struct nm_coll_tree_info_s *p_tree)
translate virtual ranks (with root=0) to real ranks
Definition nm_coll_trees.h:222
void nm_coll_tree_destroy(struct nm_coll_tree_info_s *p_tree)
const char * nm_coll_tree_kind_name(nm_coll_tree_kind_t kind)
static void nm_coll_tree_status_init(struct nm_coll_tree_status_s *p_status, nm_session_t p_session, nm_coll_tree_kind_t kind, nm_group_t p_group, int root, int self, nm_tag_t tag)
initialize a common status for non-blocking collective
Definition nm_coll_trees.h:246
nm_coll_tree_kind_t nm_coll_tree_heuristic(int comm_size, nm_len_t data_size, const struct nm_coll_topology_s *p_topology)
heuristic to select a coll_tree kind for a generic tree-based collective
void nm_coll_tree_step(const struct nm_coll_tree_info_s *p_tree, int step, int *p_parent, int *p_children, int *n_children)
get the parent & children for the local node at the given step.
int nm_coll_tree_has_weight(nm_coll_tree_kind_t k)
static int nm_coll_ipow(int base, int exp)
fast integer power() = base ^ exp
Definition nm_coll_trees.h:158
int nm_coll_tree_weight(const struct nm_coll_tree_info_s *p_tree, int step, int self)
static int nm_coll_tree_req_index(struct nm_coll_tree_status_s *p_coll_tree, nm_sr_request_t *p_request)
Definition nm_coll_trees.h:310
nm_coll_tree_kind_t nm_coll_tree_weight_heuristic(int comm_size, nm_len_t data_size, const struct nm_coll_topology_s *p_topology)
heuristic to select a coll_tree kind for a tree-based collective that needs weights (scatter/gather)
static void nm_coll_tree_status_destroy(struct nm_coll_tree_status_s *p_status)
Definition nm_coll_trees.h:260
@ NM_COLL_TREE_DEFAULT
for public interfaces, will fallback to one of the previous tree kinds
Definition nm_coll_trees.h:56
static int nm_atomic_inc(int *v)
increment int, atomic only when multithread
Definition nm_core_interface.h:885
int nm_sr_request_monitor(nm_session_t p_session, nm_sr_request_t *p_request, nm_sr_event_t mask, nm_sr_event_notifier_t notifier)
Set a notification function called upon request completion.
static void nm_sr_send_init(nm_session_t p_session, nm_sr_request_t *p_request)
Init a send request.
static int nm_sr_send_issend(nm_session_t p_session, nm_sr_request_t *p_request, nm_gate_t p_gate, nm_tag_t tag)
send a built request in synchronous mode
static void nm_sr_send_pack_data(nm_session_t p_session, nm_sr_request_t *p_request, const struct nm_data_s *p_data)
Pack data described through an iterator into the given request.
static int nm_sr_request_set_ref(nm_sr_request_t *p_request, void *ref)
Add a user reference to a request.
assert(p_data->ops.p_traversal !=NULL)
Basic primitives to display info & warnings.
static int nm_sr_isend_data(nm_session_t p_session, nm_gate_t p_gate, nm_tag_t tag, struct nm_data_s *p_data, nm_sr_request_t *p_request)
Definition nm_sendrecv_interface.h:353
static int nm_sr_irecv_data(nm_session_t p_session, nm_gate_t p_gate, nm_tag_t tag, struct nm_data_s *p_data, nm_sr_request_t *p_request)
Definition nm_sendrecv_interface.h:458
a description of hierarchy of processes; both vects are empty when no topology is available
Definition nm_group.h:55
struct nm_coll_topology_s * p_topology
topology information of the nodes we will run the collective on; may be NULL
Definition nm_coll_trees.h:70
int height
tree height: number of communications steps in the tree (0 for a single node)
Definition nm_coll_trees.h:69
common status for a non-blocking operation that walks a tree
Definition nm_coll_trees.h:232
nm_sr_request_t * children_requests
Definition nm_coll_trees.h:239
a data descriptor, used to pack/unpack data from app layout to/from contiguous buffers
Definition nm_data.h:199
Definition nm_session_private.h:24