}
-static void smpi_empty_status(MPI_Status * status) {
+void smpi_empty_status(MPI_Status * status) {
if(status != MPI_STATUS_IGNORE) {
status->MPI_SOURCE=MPI_ANY_SOURCE;
status->MPI_TAG=MPI_ANY_TAG;
void smpi_mpi_waitall(int count, MPI_Request requests[],
MPI_Status status[])
{
- int index, c;
+ int index, c;
MPI_Status stat;
MPI_Status *pstat = status == MPI_STATUSES_IGNORE ? MPI_STATUS_IGNORE : &stat;
-
+ //tag invalid requests in the set
for(c = 0; c < count; c++) {
- if(MC_IS_ENABLED) {
- smpi_mpi_wait(&requests[c], pstat);
- index = c;
- } else {
- index = smpi_mpi_waitany(count, requests, pstat);
- if(index == MPI_UNDEFINED) {
- break;
+ if(requests[c]==MPI_REQUEST_NULL || requests[c]->dst == MPI_PROC_NULL ){
+ if(status != MPI_STATUSES_IGNORE)
+ smpi_empty_status(&status[c]);
+ }else if(requests[c]->src == MPI_PROC_NULL ){
+ if(status != MPI_STATUSES_IGNORE) {
+ smpi_empty_status(&status[c]);
+ status[c].MPI_SOURCE=MPI_PROC_NULL;
}
}
- if(status != MPI_STATUSES_IGNORE) {
- memcpy(&status[index], pstat, sizeof(*pstat));
+ }
+
+ for(c = 0; c < count; c++) {
+ if(MC_IS_ENABLED) {
+ smpi_mpi_wait(&requests[c], pstat);
+ index = c;
+ } else {
+ index = smpi_mpi_waitany(count, requests, pstat);
+ if(index == MPI_UNDEFINED) {
+ break;
+ }
+ if(status != MPI_STATUSES_IGNORE) {
+ memcpy(&status[index], pstat, sizeof(*pstat));
+
+ }
}
}
}
MPI_Status *pstat = status == MPI_STATUSES_IGNORE ? MPI_STATUS_IGNORE : &stat;
count = 0;
- for(i = 0; i < incount; i++) {
- if(smpi_mpi_testany(incount, requests, &index, pstat)) {
- if(index!=MPI_UNDEFINED){
- indices[count] = index;
- count++;
- if(status != MPI_STATUSES_IGNORE) {
- memcpy(&status[index], pstat, sizeof(*pstat));
- }
- }else{
- return MPI_UNDEFINED;
+ for(i = 0; i < incount; i++)
+ {
+ index=smpi_mpi_waitany(incount, requests, pstat);
+ if(index!=MPI_UNDEFINED){
+ indices[count] = index;
+ count++;
+ if(status != MPI_STATUSES_IGNORE) {
+ memcpy(&status[index], pstat, sizeof(*pstat));
}
+ }else{
+ return MPI_UNDEFINED;
}
}
return count;
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
+ } else if (dst == MPI_PROC_NULL) {
+ retval = MPI_SUCCESS;
} else {
*request = smpi_mpi_send_init(buf, count, datatype, dst, tag, comm);
retval = MPI_SUCCESS;
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
+ } else if (src == MPI_PROC_NULL) {
+ retval = MPI_SUCCESS;
} else {
*request = smpi_mpi_recv_init(buf, count, datatype, src, tag, comm);
retval = MPI_SUCCESS;
int retval;
smpi_bench_end();
- if (request == NULL) {
+ if (request == NULL || *request == MPI_REQUEST_NULL) {
retval = MPI_ERR_ARG;
} else {
smpi_mpi_start(*request);
int retval;
smpi_bench_end();
- if (request == NULL) {
+ if (request == MPI_REQUEST_NULL) {
retval = MPI_ERR_ARG;
} else {
smpi_mpi_request_free(request);
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
+ }else if (src == MPI_PROC_NULL) {
+ *request = MPI_REQUEST_NULL;
+ retval = MPI_SUCCESS;
} else {
*request = smpi_mpi_irecv(buf, count, datatype, src, tag, comm);
retval = MPI_SUCCESS;
int retval;
smpi_bench_end();
+ if (request == NULL) {
+ retval = MPI_ERR_ARG;
+ } else if (comm == MPI_COMM_NULL) {
+ retval = MPI_ERR_COMM;
+ } else if (dst == MPI_PROC_NULL) {
+ *request = MPI_REQUEST_NULL;
+ retval = MPI_SUCCESS;
+ } else {
+
#ifdef HAVE_TRACING
int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
TRACE_smpi_computing_out(rank);
TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
TRACE_smpi_send(rank, rank, dst_traced);
#endif
- if (request == NULL) {
- retval = MPI_ERR_ARG;
- } else if (comm == MPI_COMM_NULL) {
- retval = MPI_ERR_COMM;
- } else {
+
*request = smpi_mpi_isend(buf, count, datatype, dst, tag, comm);
retval = MPI_SUCCESS;
- }
+
#ifdef HAVE_TRACING
TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
(*request)->send = 1;
TRACE_smpi_computing_in(rank);
#endif
+ }
+
smpi_bench_begin();
return retval;
}
int retval;
smpi_bench_end();
+
+ if (comm == MPI_COMM_NULL) {
+ retval = MPI_ERR_COMM;
+ } else if (src == MPI_PROC_NULL) {
+ smpi_empty_status(status);
+ status->MPI_SOURCE = MPI_PROC_NULL;
+ retval = MPI_SUCCESS;
+ } else {
#ifdef HAVE_TRACING
int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
int src_traced = smpi_group_index(smpi_comm_group(comm), src);
TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
#endif
- if (comm == MPI_COMM_NULL) {
- retval = MPI_ERR_COMM;
- } else {
+
smpi_mpi_recv(buf, count, datatype, src, tag, comm, status);
retval = MPI_SUCCESS;
- }
+
#ifdef HAVE_TRACING
//the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
if(status!=MPI_STATUS_IGNORE)src_traced = smpi_group_index(smpi_comm_group(comm), status->MPI_SOURCE);
TRACE_smpi_recv(rank, src_traced, rank);
TRACE_smpi_computing_in(rank);
#endif
+ }
+
smpi_bench_begin();
return retval;
}
#endif
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
+ } else if (dst == MPI_PROC_NULL) {
+ retval = MPI_SUCCESS;
} else {
smpi_mpi_send(buf, count, datatype, dst, tag, comm);
retval = MPI_SUCCESS;
} else if (sendtype == MPI_DATATYPE_NULL
|| recvtype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
+ } else if (src == MPI_PROC_NULL || dst == MPI_PROC_NULL) {
+ smpi_empty_status(status);
+ status->MPI_SOURCE = MPI_PROC_NULL;
+ retval = MPI_SUCCESS;
} else {
smpi_mpi_sendrecv(sendbuf, sendcount, sendtype, dst, sendtag, recvbuf,
recvcount, recvtype, src, recvtag, comm, status);
if (request == MPI_REQUEST_NULL || flag == NULL) {
retval = MPI_ERR_ARG;
} else if (*request == MPI_REQUEST_NULL) {
- *flag=TRUE;
+ *flag= TRUE;
retval = MPI_ERR_REQUEST;
} else {
*flag = smpi_mpi_test(request, status);
smpi_bench_end();
if (status == NULL) {
- retval = MPI_ERR_ARG;
- }else if (comm == MPI_COMM_NULL) {
- retval = MPI_ERR_COMM;
+ retval = MPI_ERR_ARG;
+ } else if (comm == MPI_COMM_NULL) {
+ retval = MPI_ERR_COMM;
+ } else if (source == MPI_PROC_NULL) {
+ smpi_empty_status(status);
+ status->MPI_SOURCE = MPI_PROC_NULL;
+ retval = MPI_SUCCESS;
} else {
- smpi_mpi_probe(source, tag, comm, status);
- retval = MPI_SUCCESS;
+ smpi_mpi_probe(source, tag, comm, status);
+ retval = MPI_SUCCESS;
}
smpi_bench_begin();
return retval;
smpi_bench_end();
if (flag == NULL) {
- retval = MPI_ERR_ARG;
- }else if (status == NULL) {
- retval = MPI_ERR_ARG;
- }else if (comm == MPI_COMM_NULL) {
- retval = MPI_ERR_COMM;
+ retval = MPI_ERR_ARG;
+ } else if (status == NULL) {
+ retval = MPI_ERR_ARG;
+ } else if (comm == MPI_COMM_NULL) {
+ retval = MPI_ERR_COMM;
+ } else if (source == MPI_PROC_NULL) {
+ smpi_empty_status(status);
+ status->MPI_SOURCE = MPI_PROC_NULL;
+ retval = MPI_SUCCESS;
} else {
- smpi_mpi_iprobe(source, tag, comm, flag, status);
- retval = MPI_SUCCESS;
+ smpi_mpi_iprobe(source, tag, comm, flag, status);
+ retval = MPI_SUCCESS;
}
smpi_bench_begin();
return retval;
int retval;
smpi_bench_end();
+
+ if (request == NULL) {
+ retval = MPI_ERR_ARG;
+ } else if (*request == MPI_REQUEST_NULL) {
+ retval = MPI_ERR_REQUEST;
+ } else {
+
#ifdef HAVE_TRACING
int rank = request && (*request)->comm != MPI_COMM_NULL
? smpi_process_index()
int is_wait_for_receive = (*request)->recv;
TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
#endif
- if (request == NULL) {
- retval = MPI_ERR_ARG;
- } else if (*request == MPI_REQUEST_NULL) {
- retval = MPI_ERR_REQUEST;
- } else {
+
smpi_mpi_wait(request, status);
retval = MPI_SUCCESS;
- }
+
#ifdef HAVE_TRACING
TRACE_smpi_ptp_out(rank, src_traced, dst_traced, __FUNCTION__);
if (is_wait_for_receive) {
TRACE_smpi_recv(rank, src_traced, dst_traced);
}
TRACE_smpi_computing_in(rank);
-
#endif
+
+ }
+
smpi_bench_begin();
return retval;
}
xbt_dynar_t dsts = xbt_dynar_new(sizeof(int), NULL);
xbt_dynar_t recvs = xbt_dynar_new(sizeof(int), NULL);
for (i = 0; i < count; i++) {
- MPI_Request req = requests[i]; //all req should be valid in Waitall
- int *asrc = xbt_new(int, 1);
- int *adst = xbt_new(int, 1);
- int *arecv = xbt_new(int, 1);
- *asrc = req->src;
- *adst = req->dst;
- *arecv = req->recv;
- xbt_dynar_insert_at(srcs, i, asrc);
- xbt_dynar_insert_at(dsts, i, adst);
- xbt_dynar_insert_at(recvs, i, arecv);
- xbt_free(asrc);
- xbt_free(adst);
- xbt_free(arecv);
+ MPI_Request req = requests[i];
+ if(req){
+ int *asrc = xbt_new(int, 1);
+ int *adst = xbt_new(int, 1);
+ int *arecv = xbt_new(int, 1);
+ *asrc = req->src;
+ *adst = req->dst;
+ *arecv = req->recv;
+ xbt_dynar_insert_at(srcs, i, asrc);
+ xbt_dynar_insert_at(dsts, i, adst);
+ xbt_dynar_insert_at(recvs, i, arecv);
+ xbt_free(asrc);
+ xbt_free(adst);
+ xbt_free(arecv);
+ }else {
+ int *t = xbt_new(int, 1);
+ xbt_dynar_insert_at(srcs, i, t);
+ xbt_dynar_insert_at(dsts, i, t);
+ xbt_dynar_insert_at(recvs, i, t);
+ xbt_free(t);
+ }
}
int rank_traced = smpi_process_index();
TRACE_smpi_computing_out(rank_traced);