-/* Copyright (c) 2007-2013. The SimGrid Team.
+/* Copyright (c) 2007-2014. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
static int factor_cmp(const void *pa, const void *pb)
{
- return (((s_smpi_factor_t*)pa)->factor > ((s_smpi_factor_t*)pb)->factor);
+ return (((s_smpi_factor_t*)pa)->factor > ((s_smpi_factor_t*)pb)->factor) ? 1 :
+ (((s_smpi_factor_t*)pa)->factor < ((s_smpi_factor_t*)pb)->factor) ? -1 : 0;
}
smpi_factor = xbt_dynar_new(sizeof(s_smpi_factor_t), NULL);
radical_elements = xbt_str_split(smpi_coef_string, ";");
xbt_dynar_foreach(radical_elements, iter, value) {
+ memset(&fact, 0, sizeof(s_smpi_factor_t));
radical_elements2 = xbt_str_split(value, ":");
if (xbt_dynar_length(radical_elements2) <2 || xbt_dynar_length(radical_elements2) > 5)
xbt_die("Malformed radical for smpi factor!");
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, request);
+ request->action = simcall_comm_irecv(mailbox, request->buf,
+ &request->real_size, &match_recv,
+ request, -1.0);
//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;
request->refcount++;
if(request->old_type->has_subtype == 0){
oldbuf = request->buf;
- if (oldbuf && request->size!=0){
+ if (!_xbt_replay_is_active() && oldbuf && request->size!=0){
request->buf = xbt_malloc(request->size);
memcpy(request->buf,oldbuf,request->size);
}
simcall_comm_isend(mailbox, request->size, -1.0,
request->buf, request->real_size,
&match_send,
- &smpi_mpi_request_free_voidp, // how to free the userdata if a detached send fails
+ &xbt_free, // how to free the userdata if a detached send fails
request,
// detach if msg size < eager/rdv switch limit
request->detached);
flag = simcall_comm_test((*request)->action);
if (flag) {
finish_wait(request, status);
+ if (*request != MPI_REQUEST_NULL && !((*request)->flags & PERSISTENT))
*request = MPI_REQUEST_NULL;
}
}
if(i != -1) {
*index = map[i];
finish_wait(&requests[*index], status);
+ if (requests[*index] != MPI_REQUEST_NULL && (requests[*index]->flags & NON_PERSISTENT))
requests[*index] = MPI_REQUEST_NULL;
flag = 1;
}
if ((*request)->action != NULL) { // this is not a detached send
simcall_comm_wait((*request)->action, -1.0);
- }
-
#ifdef HAVE_MC
if(MC_is_active())
(*request)->action->comm.dst_data = NULL; // dangling pointer : dst_data is freed with a wait, need to set it to NULL for system state comparison
#endif
+ }
finish_wait(request, status);
- *request = MPI_REQUEST_NULL;
+ if (*request != MPI_REQUEST_NULL && ((*request)->flags & NON_PERSISTENT))
+ *request = MPI_REQUEST_NULL;
// FIXME for a detached send, finish_wait is not called:
}
size=0;//so we free the dynar but don't do the waitany call
index=i;
finish_wait(&requests[i], status);//cleanup if refcount = 0
+ if (requests[i] != MPI_REQUEST_NULL && (requests[i]->flags & NON_PERSISTENT))
requests[i]=MPI_REQUEST_NULL;//set to null
break;
}
if (i != -1) {
index = map[i];
finish_wait(&requests[index], status);
+ if (requests[i] != MPI_REQUEST_NULL && (requests[i]->flags & NON_PERSISTENT))
requests[index] = MPI_REQUEST_NULL;
}
}
index = smpi_mpi_waitany(count, requests, pstat);
if (index == MPI_UNDEFINED)
break;
+ if (requests[index] != MPI_REQUEST_NULL && (requests[index]->flags & NON_PERSISTENT))
requests[index]=MPI_REQUEST_NULL;
}
if (status != MPI_STATUSES_IGNORE) {
if(status != MPI_STATUSES_IGNORE) {
status[index] = *pstat;
}
+ if (requests[index] != MPI_REQUEST_NULL && (requests[index]->flags & NON_PERSISTENT))
requests[index]=MPI_REQUEST_NULL;
}else{
return MPI_UNDEFINED;
if(status != MPI_STATUSES_IGNORE) {
status[i] = *pstat;
}
+ if (requests[i]->flags & NON_PERSISTENT)
requests[i]=MPI_REQUEST_NULL;
-
}
}else{
count_dead++;