}
}
+ //integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0
+ double sleeptime = request->detached ? smpi_or(request->size) : 0.0;
+ if(sleeptime!=0.0){
+ simcall_process_sleep(sleeptime);
+ XBT_DEBUG("receiving size of %zu : sleep %f ", request->size, smpi_or(request->size));
+ }
+
// we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later
request->real_size=request->size;
smpi_datatype_use(request->old_type);
smpi_comm_use(request->comm);
request->action = simcall_comm_irecv(mailbox, request->buf,
&request->real_size, &match_recv,
- &smpi_comm_copy_buffer_callback,
+ !smpi_process_get_replaying()? &smpi_comm_copy_buffer_callback
+ : &smpi_comm_null_copy_buffer_callback,
request, -1.0);
XBT_DEBUG("recv simcall posted");
- //integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0
- double sleeptime = request->detached ? smpi_or(request->size) : 0.0;
- if(sleeptime!=0.0){
- simcall_process_sleep(sleeptime);
- XBT_DEBUG("receiving size of %zu : sleep %f ", request->size, smpi_or(request->size));
- }
+
} else {
}
#endif
print_request("New send", request);
+
+ //if we are giving back the control to the user without waiting for completion, we have to inject timings
+ double sleeptime = 0.0;
+ if(request->detached || (request->flags & (ISEND|SSEND))){// issend should be treated as isend
+ //isend and send timings may be different
+ sleeptime = (request->flags & ISEND)? smpi_ois(request->size) : smpi_os(request->size);
+ }
+
+ if(sleeptime != 0.0){
+ simcall_process_sleep(sleeptime);
+ XBT_DEBUG("sending size of %zu : sleep %f ", request->size, smpi_os(request->size));
+ }
+
if (request->flags & RMA || request->size < sg_cfg_get_int("smpi/async_small_thres")) { // eager mode
mailbox = smpi_process_remote_mailbox(receiver);
XBT_DEBUG("Is there a corresponding recv already posted in the large mailbox %p?", mailbox);
request->refcount++;
if(request->old_type->has_subtype == 0){
oldbuf = request->buf;
- if (!_xbt_replay_is_active() && oldbuf && request->size!=0){
+ if (!smpi_process_get_replaying() && oldbuf && request->size!=0){
if((smpi_privatize_global_variables)
&& ((char*)request->buf >= start_data_exe)
&& ((char*)request->buf < start_data_exe + size_data_exe )){
buf, request->real_size,
&match_send,
&xbt_free_f, // how to free the userdata if a detached send fails
- &smpi_comm_copy_buffer_callback,
+ !smpi_process_get_replaying()? &smpi_comm_copy_buffer_callback
+ : &smpi_comm_null_copy_buffer_callback,
request,
// detach if msg size < eager/rdv switch limit
request->detached);
XBT_DEBUG("send simcall posted");
- //if we are giving back the control to the user without waiting for completion, we have to inject timings
- double sleeptime = 0.0;
- if(request->detached || (request->flags & (ISEND|SSEND))){// issend should be treated as isend
- //isend and send timings may be different
- sleeptime = (request->flags & ISEND)? smpi_ois(request->size) : smpi_os(request->size);
- }
- if(sleeptime != 0.0){
- simcall_process_sleep(sleeptime);
- XBT_DEBUG("sending size of %zu : sleep %f ", request->size, smpi_os(request->size));
- }
#ifdef HAVE_TRACING
MPI_Datatype datatype = req->old_type;
if((req->flags & ACCUMULATE) || (datatype->has_subtype == 1)){
- if (!_xbt_replay_is_active()){
+ if (!smpi_process_get_replaying()){
if( smpi_privatize_global_variables
&& ((char*)req->old_buf >= start_data_exe)
&& ((char*)req->old_buf < start_data_exe + size_data_exe )
displs[i] = count;
count += recvcounts[i];
}
- tmpbuf=(void*)xbt_malloc(count*smpi_datatype_get_extent(datatype));
+ tmpbuf=(void*)smpi_get_tmp_sendbuffer(count*smpi_datatype_get_extent(datatype));
+
mpi_coll_reduce_fun(sendbuf, tmpbuf, count, datatype, op, 0, comm);
smpi_mpi_scatterv(tmpbuf, recvcounts, displs, datatype, recvbuf,
recvcounts[rank], datatype, 0, comm);
xbt_free(displs);
- xbt_free(tmpbuf);
+ smpi_free_tmp_buffer(tmpbuf);
}
void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
char* sendtmpbuf = (char*) sendbuf;
if( sendbuf == MPI_IN_PLACE ) {
- sendtmpbuf = (char *)xbt_malloc(count*smpi_datatype_get_extent(datatype));
+ sendtmpbuf = (char *)smpi_get_tmp_sendbuffer(count*smpi_datatype_get_extent(datatype));
smpi_datatype_copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
}
if(src != root) {
// FIXME: possibly overkill we we have contiguous/noncontiguous data
// mapping...
- tmpbufs[index] = xbt_malloc(count * dataext);
+ if (!smpi_process_get_replaying())
+ tmpbufs[index] = xbt_malloc(count * dataext);
+ else
+ tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
requests[index] =
smpi_irecv_init(tmpbufs[index], count, datatype, src,
system_tag, comm);
if(op) /* op can be MPI_OP_NULL that does nothing */
smpi_op_apply(op, tmpbufs[index], recvbuf, &count, &datatype);
}
- for(index = 0; index < size - 1; index++) {
- xbt_free(tmpbufs[index]);
- }
+ for(index = 0; index < size - 1; index++) {
+ smpi_free_tmp_buffer(tmpbufs[index]);
+ }
xbt_free(tmpbufs);
xbt_free(requests);
if( sendbuf == MPI_IN_PLACE ) {
- xbt_free(sendtmpbuf);
+ smpi_free_tmp_buffer(sendtmpbuf);
}
}
}
for(other = 0; other < rank; other++) {
// FIXME: possibly overkill we we have contiguous/noncontiguous data
// mapping...
- tmpbufs[index] = xbt_malloc(count * dataext);
+ tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
requests[index] =
smpi_irecv_init(tmpbufs[index], count, datatype, other, system_tag,
comm);
}
}
for(index = 0; index < rank; index++) {
- xbt_free(tmpbufs[index]);
+ smpi_free_tmp_buffer(tmpbufs[index]);
}
for(index = 0; index < size-1; index++) {
smpi_mpi_request_free(&requests[index]);
for(other = 0; other < rank; other++) {
// FIXME: possibly overkill we we have contiguous/noncontiguous data
// mapping...
- tmpbufs[index] = xbt_malloc(count * dataext);
+ tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
requests[index] =
smpi_irecv_init(tmpbufs[index], count, datatype, other, system_tag,
comm);
}
}
for(index = 0; index < rank; index++) {
- xbt_free(tmpbufs[index]);
+ smpi_free_tmp_buffer(tmpbufs[index]);
}
for(index = 0; index < size-1; index++) {
smpi_mpi_request_free(&requests[index]);