XBT_PUBLIC(void) SIMIX_comm_set_copy_data_callback(void (*callback) (smx_action_t, size_t));
XBT_PUBLIC(void) SIMIX_comm_copy_pointer_callback(smx_action_t comm, size_t buff_size);
XBT_PUBLIC(void) SIMIX_comm_copy_buffer_callback(smx_action_t comm, size_t buff_size);
+XBT_PUBLIC(void) smpi_comm_copy_data_callback(smx_action_t comm, size_t buff_size);
+
XBT_PUBLIC(smx_action_t) SIMIX_comm_get_send_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data);
XBT_PUBLIC(int) SIMIX_comm_has_send_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data);
XBT_PUBLIC(int) SIMIX_comm_has_recv_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data);
memcpy(comm->comm.dst_buff, comm->comm.src_buff, buff_size);
}
+void smpi_comm_copy_data_callback(smx_action_t comm, size_t buff_size)
+{
+ memcpy(comm->comm.dst_buff, comm->comm.src_buff, buff_size);
+ if (comm->comm.detached) // if this is a detached send, the source buffer was duplicated by SMPI sender to make the original buffer available to the application ASAP
+ free(comm->comm.src_buff);
+}
+
/**
* \brief Copy the communication data from the sender's buffer to the receiver's one
* \param comm The communication
void smpi_mpi_start(MPI_Request request)
{
smx_rdv_t mailbox;
+ int detached = 0;
xbt_assert(!request->action,
"Cannot (re)start a non-finished communication");
smpi_group_index(smpi_comm_group(request->comm), request->dst));
// FIXME: SIMIX does not yet support non-contiguous datatypes
+ if (request->size < 64*1024 ) { // eager mode => detached send (FIXME: this limit should be configurable)
+ void *oldbuf = request->buf;
+ detached = 1;
+ request->buf = malloc(request->size);
+ memcpy(request->buf,oldbuf,request->size);
+ }
+
request->action =
SIMIX_req_comm_isend(mailbox, request->size, -1.0,
request->buf, request->size, &match_send, request,
// detach if msg size < eager/rdv switch limit
- request->size < 64*1024 ? 1:0);
- // if detached request->action == NULL
+ detached);
+
#ifdef HAVE_TRACING
SIMIX_req_set_category (request->action, TRACE_internal_smpi_get_category());
#endif
MPI_Group group;
char name[MAILBOX_NAME_MAXLEN];
- SIMIX_comm_set_copy_data_callback
- (&SIMIX_comm_copy_buffer_callback);
+ SIMIX_comm_set_copy_data_callback(&smpi_comm_copy_data_callback);
process_count = SIMIX_process_count();
process_data = xbt_new(smpi_process_data_t, process_count);
for (i = 0; i < process_count; i++) {