#include <stdlib.h>
#include <stdio.h>
const char msg[] = "Hello, world!";
{
printf("rpc_hello_handler()- received header: len = %lu\n", rlen);
char*buf = malloc(rlen);
}
{
printf("received body: %s\n", buf);
free(buf);
}
int main(int argc, char**argv)
{
{
NM_FATAL(
"This example works only with two processes.\n");
}
int rank = -1;
int peer = (
size > 1) ? (1 - rank) : rank;
&rpc_hello_handler, &rpc_hello_finalizer, NULL);
return 0;
}
void nm_coll_barrier(nm_comm_t comm, nm_tag_t tag)
void nm_comm_destroy(nm_comm_t p_comm)
destroy a communicator- no synchronization is done
nm_comm_t nm_comm_world(const char *label)
create a new global communicator with given label
int nm_launcher_get_rank(int *rank)
Returns process rank.
int nm_launcher_get_size(int *size)
Returns the number of nodes.
int nm_launcher_exit(void)
Cleans session.
int nm_launcher_get_gate(int dest, nm_gate_t *gate)
Returns the gate for the process dest.
static int nm_launcher_init(int *argc, char **argv)
Initializes nmad.
static void nm_rpc_token_set_ref(nm_rpc_token_t p_token, void *ref)
attach a user reference to a token, to transmit information between rpc handler and finalizer
static void nm_rpc_recv_header(nm_rpc_token_t p_token, void *hptr, nm_len_t hlen)
receive header; to be called from a handler; data is available immediately upon function return
void nm_rpc_req_pack_body(nm_rpc_req_t p_rpc_req, const void *ptr, nm_len_t len)
pack a body chunk into an rpc request; may be called multiple times for multiple body chunks.
nm_rpc_req_t nm_rpc_req_init(nm_rpc_service_t p_service, nm_gate_t p_gate, nm_tag_t tag)
initializes a new rpc send request
static void nm_rpc_req_wait(nm_rpc_req_t p_req)
wait for a send request completion
static void nm_rpc_irecv_body(nm_rpc_token_t p_token, void *ptr, nm_len_t len)
asynchronously posts the recv for the body of a received request; to be called from a handler; there ...
void nm_rpc_req_pack_header(nm_rpc_req_t p_rpc_req, const void *ptr, nm_len_t len)
pack a header chunk into an rpc request; may be called multiple times for multiple header chunks.
void nm_rpc_req_isend(nm_rpc_req_t p_req)
send an rpc request once it is built; non-blocking operation, user must set a notifier or explicitely...
void nm_rpc_unregister(nm_rpc_service_t p_service)
stop listenning from RPC requests on given service
static void * nm_rpc_token_get_ref(nm_rpc_token_t p_token)
get a user reference previously attached to the token
nm_rpc_service_t nm_rpc_register(nm_session_t p_session, nm_tag_t tag, nm_tag_t tag_mask, nm_rpc_handler_t p_handler, nm_rpc_finalizer_t p_finalizer, void *ref)
register a new RPC service, listenning on the given tag/tag_mask.
int nm_session_open(nm_session_t *pp_session, const char *label)
Open a new session, assuming processes are already connected.
int nm_session_close(nm_session_t p_session)
Disconnect and destroy a session.
nm_tag_t tag
the user-supplied tag
static nm_session_t p_session
#define NM_FATAL(format,...)
nm_mpi_communicator_t * p_comm
communicator used for communication
nm_len_t size
size of the onsided data (not incuding target-side completion)
#define NM_LEN_UNDEFINED
length is undefined
uint64_t nm_tag_t
user tags, 64 bits, contained in indirect hashtable
uint64_t nm_len_t
data length used by nmad
#define NM_TAG_MASK_FULL
tag mask that matches all bits
Connection to another process.
descriptor for a registered RPC service