xbt_dynar_t comms = xbt_dynar_new(sizeof(smx_action_t), NULL);
unsigned int cursor = 0;
int got = 0;
- smx_action_t comm = NULL;
gras_socket_t sock = NULL;
gras_trp_sg_sock_data_t sock_data;
xbt_dynar_foreach(trp_proc->sockets, cursor, sock) {
got = SIMIX_req_comm_waitany(comms);
/* retrieve the message sent in that communication */
- xbt_dynar_get_cpy(comms, got, &(comm));
- msg = SIMIX_req_comm_get_src_data(comm);
sock = xbt_dynar_get_as(trp_proc->sockets, got, gras_socket_t);
sock_data = (gras_trp_sg_sock_data_t) sock->data;
- VERB3("Got something. Communication %p's over rdv_server=%p, rdv_client=%p",
- comm,sock_data->rdv_server,sock_data->rdv_client);
- SIMIX_req_comm_destroy(comm);
+ msg = sock_data->msg;
+ VERB2("Got something. Communication over rdv_server=%p, rdv_client=%p",
+ sock_data->rdv_server,sock_data->rdv_client);
/* Reinstall a waiting communication on that rdv */
/* xbt_dynar_foreach(trp_proc->sockets,cursor,sock) {
sock_data->comm_recv =
SIMIX_req_comm_irecv(gras_socket_im_the_server(sock) ?
sock_data->rdv_server : sock_data->rdv_client,
- NULL, 0, NULL, NULL);
+ &sock_data->msg, NULL, NULL, NULL);
return msg;
}
payload, msg->payl);
}
- comm = SIMIX_req_comm_isend(target_rdv, whole_payload_size, -1, &msg, sizeof(void *), NULL, msg, 0);
+ comm = SIMIX_req_comm_isend(target_rdv, whole_payload_size, -1, msg, sizeof(void *), NULL, msg, 0);
SIMIX_req_comm_wait(comm, -1);
VERB0("Message sent (and received)");
/* initialize synchronization stuff on the socket */
data->rdv_server = pr->rdv;
data->rdv_client = SIMIX_req_rdv_create(NULL);
- data->comm_recv = SIMIX_req_comm_irecv(data->rdv_client, NULL, 0, NULL, NULL);
+ data->comm_recv = SIMIX_req_comm_irecv(data->rdv_client, &data->msg, NULL, NULL, NULL);
/* connect that simulation data to the socket */
sock->data = data;
data->client = NULL;
data->rdv_server = pr->rdv;
data->rdv_client = NULL;
- data->comm_recv = SIMIX_req_comm_irecv(pr->rdv, NULL, 0, NULL, NULL);
+ data->comm_recv = SIMIX_req_comm_irecv(pr->rdv, &data->msg, NULL, NULL, NULL);
sock->data = data;
smx_rdv_t rdv_server; /* The rendez-vous point to use */
smx_rdv_t rdv_client; /* The rendez-vous point to use */
- smx_action_t comm_recv; /* The comm of irecv on receiver side */
+ smx_action_t comm_recv; /* The comm of irecv on receiver side */
+ gras_msg_t msg; /* The destination buffer of the comm data */
int server_port;
int client_port;
static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_action_t comm);
static XBT_INLINE void SIMIX_rdv_remove(smx_rdv_t rdv, smx_action_t comm);
static smx_action_t SIMIX_rdv_get_request(smx_rdv_t rdv, e_smx_comm_type_t type,
- int (*match_fun)(void *, void *), void *);
+ int (*match_fun)(void *, void *), void *);
static void SIMIX_rdv_free(void *data);
void SIMIX_network_init(void)
/* If the communication action is detached then decrease the refcount
* by one, so it will be eliminated by the receivers destroy call */
- if(detached){
+ if (detached) {
action->comm.detached = 1;
action->comm.refcount--;
}
{
xbt_assert0(comm, "Invalid parameter");
- /* FIXME remove this request type (auto-destroy finished comms) */
+ /* FIXME remove this request type: comms are auto-destroyed now,
+ * but what happens with unfinished comms? */
+
+ /*
smx_req_t req = SIMIX_req_mine();
req->call = REQ_COMM_DESTROY;
req->comm_destroy.comm = comm;
SIMIX_request_push();
+ */
}
void SIMIX_req_comm_cancel(smx_action_t comm)
status->MPI_SOURCE = req->src;
status->MPI_TAG = req->tag;
status->MPI_ERROR = MPI_SUCCESS;
- status->count = SIMIX_req_comm_get_dst_buff_size(req->action);
+ status->count = req->size;
}
- SIMIX_req_comm_destroy(req->action);
print_request("Finishing", req);
if(req->flags & NON_PERSISTENT) {
smpi_mpi_request_free(request);