int dxr3_rte_init(dxr3_driver_t *drv) { rte_data_t* this; if (!rte_init()) { xprintf(drv->class->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: failed to init librte\n")); return 0; }
int main (int argc, char **argv) { int i, rc; rte_group_t group_world; rte_ec_handle_t ec; rc = rte_init (&argc, &argv, &group_world); if (rc != RTE_SUCCESS) { printf ("rte_init() failed\n"); return -1; } printf ("Group size: %d, My rank: %d\n", rte_group_size(group_world), rte_group_rank(group_world)); for (i = 0; i < rte_group_size(group_world); i++) { ec = rte_group_index_to_ec (group_world, i); printf ("Rank %d is %s\n", i, rte_get_ec_node_name(ec)); } rte_finalize(); return 0; }
int main (int argc, char **argv) { int rc = 0; int my_rank, i; struct rte_iovec_t my_tlv; char *sendstr = "Hello World!"; rte_request_handle_t request; rte_init (&argc, &argv, &group); { char* value; value = getenv("RTE_DEBUG"); if (NULL != value && 0 == strcmp(value, "1")) { char hostname[256]; int value=1; gethostname (hostname, sizeof(hostname)); printf ("Please attach debugger on hostname:%s to PID:%d, argc:%d", hostname, getpid(), argc); while (value++) { sleep (1); } } } /* get the group size */ group_size = rte_group_size (group); /* get my rank */ my_rank = rte_group_rank (group); /* get printeble string for my processes name */ aname_str_self = rte_get_ec_node_name(rte_get_my_ec()); /* initialize the called back list, to track the agents that called back */ agents_called_back = calloc ( group_size, sizeof (int) ); my_tlv.type = &rte_int1; my_tlv.count = 13; fprintf (stderr, "%s I am beginning!\n", rte_get_ec_node_name(rte_get_my_ec())); /* create a persistent request object */ rc = rte_recv_nbcb (RTE_ANYSOURCE, 1, RTE_RECV_REQUEST_PERSISTENT, group, &request_complete_fn, NULL); if (RTE_SUCCESS != rc) { fprintf (stderr, "Error: failed to allocate request\n"); exit (-1); } my_tlv.iov_base = sendstr; /* send a message to all peers */ for (i = 0; i < group_size; i++) { /* dont send to myself */ if (my_rank == i) continue; aname_str_dest = rte_get_ec_node_name(rte_group_index_to_ec(group,i)); if (NULL == aname_str_dest) { fprintf (stderr, "Error: failed to get EC string\n"); exit (-1); } fprintf (stderr, "%s sending to %s...\n", aname_str_self, aname_str_dest); rte_send (&my_tlv, 1, rte_group_index_to_ec(group, i), 1, group); if (NULL != aname_str_dest) { free (aname_str_dest); aname_str_dest = NULL; } } while (done < group_size) { rte_progress(); } fprintf (stderr, "%s I am done!\n", rte_get_ec_node_name(rte_get_my_ec())); rte_finalize (); if (NULL != aname_str_self) free (aname_str_self); return rc; }