NewMadeleine

Documentation

« back to PM2 home.
nm_coll_dynamic_interface.h
Go to the documentation of this file.
1/*
2 * NewMadeleine
3 * Copyright (C) 2019-2021 (see AUTHORS file)
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 */
15
16
17/*
18 * nm_coll_dynamic_interface
19 * --------------------------
20 *
21 * Deprecated: use the mcast interface instead.
22 *
23 * Provide abstraction to broadcast data to several nodes in a dynamic fashion:
24 * - only sender node has to know all the recipient nodes
25 * - nodes can receive data from broadcasts or from regular sends
26 *
27 *
28 * Basic use:
29 * 1. Initialize the interface by calling nm_coll_dynamic_init_multicast()
30 * 2. Send broadcasts with nm_coll_dynamic_send*() functions
31 * 3. Receive data with nm_coll_dynamic_register_recv*() functions
32 * 4. Shutdown the interface by calling nm_coll_dynamic_shutdown()
33 *
34 * See examples/coll_dynamic/nm_coll_dynamic_basic.c for a basic example.
35 *
36 *
37 * Three types of tree can be used for broadcasting: binomial, binary or chained
38 * trees.
39 * Binomial tree is the default scheme.
40 * You can set the type of tree to use by calling nm_coll_dynamic_set_tree_kind()
41 * of by defining the environment variable NMAD_COLL_DYNAMIC_TREE to `binary`,
42 * `binomial` or `chain`.
43 *
44 *
45 * When receiving a broadcast message, default behaviour is forwarding data to
46 * other nodes and then return received data to the application. This behaviour
47 * can be reversed: when a broadcast message is received, data is copied to an
48 * internal buffer, data is returned to the application and then data stored in
49 * the internal buffer is forwarded to other nodes. To do so, you have to define
50 * the environment variable NMAD_COLL_DYNAMIC_COPY to `1`.
51 *
52 *
53 * This interface use the RPC interface, with a dedicated session, so you can use
54 * the whole space of tags for your application.
55 */
56
57#ifndef NM_COLL_DYNAMIC_H
58#define NM_COLL_DYNAMIC_H
59
61#include <nm_coll_interface.h>
62
63#ifdef PIOMAN
64
65typedef void (*callback_function)(void*);
66typedef void (*callback_function_come_from_coop)(struct nm_data_s*, nm_len_t, void*);
67typedef void (*callback_function_normal_recv)(nm_sr_request_t*, void*);
68
69
70void nm_coll_dynamic_init_multicast();
71
72
76void nm_coll_dynamic_recv_register_recv(nm_session_t p_session, int src_node, nm_tag_t tag, void *data,
77 nm_len_t len, nm_sr_request_t *p_request, piom_cond_t* cond_wait_recv,
78 callback_function_come_from_coop come_from_coop_callback,
79 callback_function end_recv_callback, callback_function_normal_recv normal_recv_callback,
80 void* arg);
81void nm_coll_dynamic_recv_register_recv_data(nm_session_t p_session, int src_node, nm_tag_t tag, struct nm_data_s* data,
82 nm_len_t len, nm_sr_request_t *p_request, piom_cond_t* cond_wait_recv,
83 callback_function_come_from_coop come_from_coop_callback,
84 callback_function end_recv_callback, callback_function_normal_recv normal_recv_callback,
85 void* arg);
86
91int nm_coll_dynamic_remove_recv(int src_node, nm_tag_t tag);
92
93
98void nm_coll_dynamic_send(int* nodes, int* prios, int nb_nodes, nm_tag_t tag, void* data, nm_len_t body_len, callback_function end_send_callback, void* arg);
99void nm_coll_dynamic_send_data(int* nodes, int* prios, int nb_nodes, nm_tag_t tag, struct nm_data_s* body_data, nm_len_t body_len, callback_function end_send_callback, void* arg);
100
101void nm_coll_dynamic_shutdown(void);
102
103void nm_coll_dynamic_set_tree_kind(nm_coll_tree_kind_t kind);
104
105#else /* PIOMAN */
106# error "cannot use interface coll_dynamic without pioman"
107#endif /* PIOMAN */
108
109#endif /* NM_COLL_DYNAMIC_H */
110
enum nm_coll_tree_kind_e nm_coll_tree_kind_t
nm_tag_t tag
the user-supplied tag
static nm_session_t p_session
uint16_t len
chunk len
Definition nm_headers.h:0
uint64_t nm_tag_t
user tags, 64 bits, contained in indirect hashtable
Definition nm_types.h:56
uint64_t nm_len_t
data length used by nmad
Definition nm_types.h:68
a data descriptor, used to pack/unpack data from app layout to/from contiguous buffers
Definition nm_data.h:196
internal defintion of the sendrecv request