int PMPI_Init(int *argc, char ***argv)
{
smpi_process_init(argc, argv);
+ smpi_process_mark_as_initialized();
#ifdef HAVE_TRACING
int rank = smpi_process_index();
TRACE_smpi_init(rank);
int src_traced = (*request)->src;
int dst_traced = (*request)->dst;
+ MPI_Comm comm = (*request)->comm;
int is_wait_for_receive = (*request)->recv;
TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
#endif
retval = MPI_SUCCESS;
#ifdef HAVE_TRACING
+ //the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
TRACE_smpi_ptp_out(rank, src_traced, dst_traced, __FUNCTION__);
if (is_wait_for_receive) {
+ src_traced = (status!=MPI_STATUS_IGNORE) ?
+ smpi_group_rank(smpi_comm_group(comm), status->MPI_SOURCE) :
+ src_traced;
TRACE_smpi_recv(rank, src_traced, dst_traced);
}
TRACE_smpi_computing_in(rank);
int *srcs = xbt_new(int, count);
int *dsts = xbt_new(int, count);
int *recvs = xbt_new(int, count);
+ MPI_Comm *comms = xbt_new(MPI_Comm, count);
+
for (i = 0; i < count; i++) {
MPI_Request req = requests[i]; //already received requests are no longer valid
if (req) {
srcs[i] = req->src;
dsts[i] = req->dst;
recvs[i] = req->recv;
+ comms[i] = req->comm;
}
}
int rank_traced = smpi_process_index();
#ifdef HAVE_TRACING
if(*index!=MPI_UNDEFINED){
int src_traced = srcs[*index];
+ //the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
int dst_traced = dsts[*index];
int is_wait_for_receive = recvs[*index];
if (is_wait_for_receive) {
+ src_traced = (status!=MPI_STATUSES_IGNORE) ?
+ smpi_group_rank(smpi_comm_group(comms[*index]), status[*index].MPI_SOURCE) :
+ srcs[*index];
TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
}
TRACE_smpi_ptp_out(rank_traced, src_traced, dst_traced, __FUNCTION__);
xbt_free(srcs);
xbt_free(dsts);
xbt_free(recvs);
+ xbt_free(comms);
+
}
TRACE_smpi_computing_in(rank_traced);
#endif
int *srcs = xbt_new(int, count);
int *dsts = xbt_new(int, count);
int *recvs = xbt_new(int, count);
- int valid_count = 0;
+ int *valid = xbt_new(int, count);
+ MPI_Comm *comms = xbt_new(MPI_Comm, count);
+
+ //int valid_count = 0;
for (i = 0; i < count; i++) {
MPI_Request req = requests[i];
if(req!=MPI_REQUEST_NULL){
- srcs[valid_count] = req->src;
- dsts[valid_count] = req->dst;
- recvs[valid_count] = req->recv;
- valid_count++;
+ srcs[i] = req->src;
+ dsts[i] = req->dst;
+ recvs[i] = req->recv;
+ comms[i] = req->comm;
+ valid[i]=1;;
+ }else{
+ valid[i]=0;
}
}
int rank_traced = smpi_process_index();
#endif
int retval = smpi_mpi_waitall(count, requests, status);
#ifdef HAVE_TRACING
- for (i = 0; i < valid_count; i++) {
- int src_traced = srcs[i];
- int dst_traced = dsts[i];
- int is_wait_for_receive = recvs[i];
- if (is_wait_for_receive) {
- TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
+ for (i = 0; i < count; i++) {
+ if(valid[i]){
+ //int src_traced = srcs[*index];
+ //the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
+
+ int dst_traced = dsts[i];
+ int is_wait_for_receive = recvs[i];
+ if (is_wait_for_receive) {
+ int src_traced = (status!=MPI_STATUSES_IGNORE) ?
+ smpi_group_rank(smpi_comm_group(comms[i]), status[i].MPI_SOURCE) :
+ srcs[i];
+ TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
+ }
}
}
TRACE_smpi_ptp_out(rank_traced, -1, -1, __FUNCTION__);
xbt_free(srcs);
xbt_free(dsts);
xbt_free(recvs);
+ xbt_free(valid);
+ xbt_free(comms);
+
TRACE_smpi_computing_in(rank_traced);
#endif
smpi_bench_begin();
|| ((recvbuf !=MPI_IN_PLACE) && (recvtype == MPI_DATATYPE_NULL))) {
retval = MPI_ERR_TYPE;
} else {
-
- if(recvbuf==MPI_IN_PLACE){
- recvcount=0;
+ if (recvbuf == MPI_IN_PLACE) {
+ recvtype=sendtype;
+ recvcount=sendcount;
}
mpi_coll_scatter_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount,
recvtype, root, comm);
|| ((recvbuf !=MPI_IN_PLACE) && (recvtype == MPI_DATATYPE_NULL))) {
retval = MPI_ERR_TYPE;
} else {
-
- if(recvbuf==MPI_IN_PLACE){
- recvcount=0;
+ if (recvbuf == MPI_IN_PLACE) {
+ recvtype=sendtype;
+ recvcount=sendcounts[smpi_comm_rank(comm)];
}
-
smpi_mpi_scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf,
recvcount, recvtype, root, comm);
retval = MPI_SUCCESS;
retval = MPI_ERR_ARG;
} else {
- char* sendtmpbuf = (char*) sendbuf;
- if( sendbuf == MPI_IN_PLACE ) {
- sendtmpbuf = (char *)xbt_malloc(count*smpi_datatype_get_extent(datatype));
- smpi_datatype_copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
- }
-
- mpi_coll_reduce_fun(sendtmpbuf, recvbuf, count, datatype, op, root, comm);
-
- if( sendbuf == MPI_IN_PLACE ) {
- xbt_free(sendtmpbuf);
- }
+ mpi_coll_reduce_fun(sendbuf, recvbuf, count, datatype, op, root, comm);
retval = MPI_SUCCESS;
}
return retval;
}
+int PMPI_Type_create_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
+ int retval;
+
+ smpi_bench_end();
+ if (old_type == MPI_DATATYPE_NULL) {
+ retval = MPI_ERR_TYPE;
+ } else if (count<0){
+ retval = MPI_ERR_COUNT;
+ } else {
+ retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
+ }
+ smpi_bench_begin();
+ return retval;
+}
+
int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
int retval,i;
return retval;
}
+int PMPI_Type_create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
+ return PMPI_Type_hindexed(count, blocklens,indices,old_type,new_type);
+}
+
int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
int retval,i;
int PMPI_Initialized(int* flag) {
- *flag=(smpi_process_data()!=NULL);
+ *flag=smpi_process_initialized();
return MPI_SUCCESS;
}