*/
void SIMIX_network_copy_data(smx_comm_t comm)
{
+ size_t buff_size = comm->src_buff_size;
+
+ DEBUG6("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)",
+ comm,
+ comm->src_proc->smx_host->name, comm->src_buff,
+ comm->dst_proc->smx_host->name, comm->dst_buff,
+ buff_size);
+
/* If there is no data to be copy then return */
if(!comm->src_buff || !comm->dst_buff)
return;
/* Copy at most dst_buff_size bytes of the message to receiver's buffer */
- size_t buff_size = comm->src_buff_size;
if (comm->dst_buff_size)
buff_size = MIN(buff_size,*(comm->dst_buff_size));
if(buff_size == 0)
return;
- DEBUG6("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)",
- comm,
- comm->src_proc->smx_host->name, comm->src_buff,
- comm->dst_proc->smx_host->name, comm->dst_buff,
- buff_size);
(*SIMIX_network_copy_data_callback)(comm, buff_size);
/* pimple to display the message sizes */
MPI_Request smpi_mpi_isend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
MPI_Request smpi_mpi_irecv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm);
void smpi_mpi_recv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status* status);
-void smpi_mpi_send(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm);
+void smpi_mpi_send(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
void smpi_mpi_sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst, int sendtag, void* recvbuf, int recvcount, MPI_Datatype recvtype, int src, int recvtag, MPI_Comm comm, MPI_Status* status);
int smpi_mpi_test(MPI_Request* request, MPI_Status* status);
int smpi_mpi_testany(int count, MPI_Request requests[], int* index, MPI_Status* status);
XBT_LOG_EXTERNAL_CATEGORY(smpi_sender);
XBT_LOG_EXTERNAL_CATEGORY(smpi_util);
+#define EAGER_LIMIT 65536
+
void smpi_process_init(int* argc, char*** argv) {
int index;
smpi_process_data_t data;
/* MPI Low level calls */
MPI_Request smpi_mpi_isend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) {
MPI_Request request;
+ size_t size = smpi_datatype_size(datatype) * count;
+ if (size > EAGER_LIMIT) {
+ /* Warning: this (zero-length synchronous) call will come back here with size == 0 */
+ smpi_mpi_send (NULL, 0, MPI_BYTE, dst, tag, comm);
+ }
request = xbt_new(s_smpi_mpi_request_t, 1);
request->comm = comm;
request->src = smpi_comm_rank(comm);
request->dst = dst;
request->tag = tag;
- request->size = smpi_datatype_size(datatype) * count;
+ request->size = size;
request->complete = 0;
request->data = request;
smpi_process_post_send(comm, request);
MPI_Request smpi_mpi_irecv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm) {
MPI_Request request;
+ size_t size = smpi_datatype_size(datatype) * count;
+ if (size > EAGER_LIMIT) {
+ /* Warning: this (zero-length synchronous) call will come back here with size == 0 */
+ smpi_mpi_recv (NULL, 0, MPI_BYTE, src, tag, comm, MPI_STATUS_IGNORE);
+ }
request = xbt_new(s_smpi_mpi_request_t, 1);
request->comm = comm;
request->src = src;
request->dst = smpi_comm_rank(comm);
request->tag = tag;
- request->size = smpi_datatype_size(datatype) * count;
+ request->size = size;
request->complete = 0;
request->data = MPI_REQUEST_NULL;
smpi_process_post_recv(request);
smpi_mpi_wait(&request, status);
}
-void smpi_mpi_send(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm) {
+void smpi_mpi_send(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) {
MPI_Request request;
- request = smpi_mpi_isend(buf, count, datatype, src, tag, comm);
+ request = smpi_mpi_isend(buf, count, datatype, dst, tag, comm);
smpi_mpi_wait(&request, MPI_STATUS_IGNORE);
}