A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Handle inactive requests in test and wait.
[simgrid.git]
/
src
/
smpi
/
smpi_base.c
diff --git
a/src/smpi/smpi_base.c
b/src/smpi/smpi_base.c
index
e1d0252
..
6aeceb5
100644
(file)
--- a/
src/smpi/smpi_base.c
+++ b/
src/smpi/smpi_base.c
@@
-316,10
+316,9
@@
void smpi_mpi_start(MPI_Request request)
{
smx_rdv_t mailbox;
- xbt_assert(!request->action,
- "Cannot (re)start a non-finished communication");
- if(request->flags & PREPARED)request->flags &= ~PREPARED;
- if(request->flags & RECV) {
+ xbt_assert(!request->action, "Cannot (re)start a non-finished communication");
+ request->flags &= ~PREPARED;
+ if (request->flags & RECV) {
print_request("New recv", request);
//FIXME: if receive is posted with a large size, but send is smaller, mailboxes may not match !
if (request->size < sg_cfg_get_int("smpi/async_small_thres"))
@@
-558,11
+557,10
@@
int smpi_mpi_get_count(MPI_Status * status, MPI_Datatype datatype)
static void finish_wait(MPI_Request * request, MPI_Status * status)
{
MPI_Request req = *request;
- if(status != MPI_STATUS_IGNORE)
- smpi_empty_status(status);
+ smpi_empty_status(status);
if(!(req->detached && req->flags & SEND) && !(req->flags & PREPARED)){
-
if(status != MPI_STATUS_IGNORE) {
+ if(status != MPI_STATUS_IGNORE) {
int src = req->src == MPI_ANY_SOURCE ? req->real_src : req->src;
status->MPI_SOURCE = smpi_group_rank(smpi_comm_group(req->comm), src);
status->MPI_TAG = req->tag == MPI_ANY_TAG ? req->real_tag : req->tag;
@@
-577,8
+575,8
@@
static void finish_wait(MPI_Request * request, MPI_Status * status)
MPI_Datatype datatype = req->old_type;
if(datatype->has_subtype == 1){
-
// This part handles the problem of non-contignous memory
-
// the unserialization at the reception
+ // This part handles the problem of non-contignous memory
+ // the unserialization at the reception
s_smpi_subtype_t *subtype = datatype->substruct;
if(req->flags & RECV) {
subtype->unserialize(req->buf, req->old_buf, req->real_size/smpi_datatype_size(datatype) , datatype->substruct);
@@
-591,13
+589,13
@@
static void finish_wait(MPI_Request * request, MPI_Status * status)
}
#ifdef HAVE_TRACING
- if (TRACE_smpi_view_internals()) {
- if(req->flags & RECV){
- int rank = smpi_process_index();
- int src_traced = (req->src == MPI_ANY_SOURCE ? req->real_src : req->src);
- TRACE_smpi_recv(rank, src_traced, rank);
- }
+ if (TRACE_smpi_view_internals()) {
+ if(req->flags & RECV){
+ int rank = smpi_process_index();
+ int src_traced = (req->src == MPI_ANY_SOURCE ? req->real_src : req->src);
+ TRACE_smpi_recv(rank, src_traced, rank);
}
+ }
#endif
if(req->detached_sender!=NULL){
@@
-615,15
+613,15
@@
int smpi_mpi_test(MPI_Request * request, MPI_Status * status) {
int flag;
//assume that request is not MPI_REQUEST_NULL (filtered in PMPI_Test or smpi_mpi_testall before)
- if ((*request)->action == NULL)
-
flag = 1;
- else
- flag = simcall_comm_test((*request)->action);
- if(flag) {
- finish_wait(request, status);
-
request=MPI_REQUEST_NULL
;
- }else{
- smpi_empty_status(status);
+ smpi_empty_status(status);
+ flag = 1;
+ if (!((*request)->flags & PREPARED)) {
+ if ((*request)->action != NULL)
+ flag = simcall_comm_test((*request)->action);
+ if (flag) {
+
finish_wait(request, status)
;
+ *request = MPI_REQUEST_NULL;
+ }
}
return flag;
}
@@
-641,7
+639,8
@@
int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
map = xbt_new(int, count);
size = 0;
for(i = 0; i < count; i++) {
- if((requests[i]!=MPI_REQUEST_NULL) && requests[i]->action) {
+ if ((requests[i] != MPI_REQUEST_NULL) && requests[i]->action &&
+ !(requests[i]->flags & PREPARED)) {
xbt_dynar_push(comms, &requests[i]->action);
map[size] = i;
size++;
@@
-653,6
+652,7
@@
int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
if(i != -1) {
*index = map[i];
finish_wait(&requests[*index], status);
+ requests[*index] = MPI_REQUEST_NULL;
flag = 1;
}
}else{
@@
-675,7
+675,7
@@
int smpi_mpi_testall(int count, MPI_Request requests[],
int flag=1;
int i;
for(i=0; i<count; i++){
- if
(requests[i]!= MPI_REQUEST_NULL)
{
+ if
(requests[i] != MPI_REQUEST_NULL && !(requests[i]->flags & PREPARED))
{
if (smpi_mpi_test(&requests[i], pstat)!=1){
flag=0;
}else{
@@
-752,6
+752,11
@@
void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
void smpi_mpi_wait(MPI_Request * request, MPI_Status * status)
{
print_request("Waiting", *request);
+ if ((*request)->flags & PREPARED) {
+ smpi_empty_status(status);
+ return;
+ }
+
if ((*request)->action != NULL) { // this is not a detached send
simcall_comm_wait((*request)->action, -1.0);
}
@@
-762,7
+767,7
@@
void smpi_mpi_wait(MPI_Request * request, MPI_Status * status)
#endif
finish_wait(request, status);
-
request=
MPI_REQUEST_NULL;
+
*request =
MPI_REQUEST_NULL;
// FIXME for a detached send, finish_wait is not called:
}
@@
-781,7
+786,7
@@
int smpi_mpi_waitany(int count, MPI_Request requests[],
size = 0;
XBT_DEBUG("Wait for one of %d", count);
for(i = 0; i < count; i++) {
- if
(requests[i] != MPI_REQUEST_NULL
) {
+ if
(requests[i] != MPI_REQUEST_NULL && !(requests[i]->flags & PREPARED)
) {
if (requests[i]->action != NULL) {
XBT_DEBUG("Waiting any %p ", requests[i]);
xbt_dynar_push(comms, &requests[i]->action);
@@
-804,6
+809,7
@@
int smpi_mpi_waitany(int count, MPI_Request requests[],
if (i != -1) {
index = map[i];
finish_wait(&requests[index], status);
+ requests[index] = MPI_REQUEST_NULL;
}
}
xbt_free(map);
@@
-826,7
+832,8
@@
int smpi_mpi_waitall(int count, MPI_Request requests[],
//tag invalid requests in the set
if (status != MPI_STATUSES_IGNORE) {
for (c = 0; c < count; c++) {
- if (requests[c] == MPI_REQUEST_NULL || requests[c]->dst == MPI_PROC_NULL) {
+ if (requests[c] == MPI_REQUEST_NULL || requests[c]->dst == MPI_PROC_NULL ||
+ (requests[c]->flags & PREPARED)) {
smpi_empty_status(&status[c]);
} else if (requests[c]->src == MPI_PROC_NULL) {
smpi_empty_status(&status[c]);