if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
} else if (src == MPI_PROC_NULL) {
- smpi_empty_status(status);
+ Status::empty(status);
status->MPI_SOURCE = MPI_PROC_NULL;
retval = MPI_SUCCESS;
} else if (src!=MPI_ANY_SOURCE && (src >= comm->group()->size() || src <0)){
} else if (!sendtype->is_valid() || !recvtype->is_valid()) {
retval = MPI_ERR_TYPE;
} else if (src == MPI_PROC_NULL || dst == MPI_PROC_NULL) {
- smpi_empty_status(status);
+ Status::empty(status);
status->MPI_SOURCE = MPI_PROC_NULL;
retval = MPI_SUCCESS;
}else if (dst >= comm->group()->size() || dst <0 ||
retval = MPI_ERR_ARG;
} else if (*request == MPI_REQUEST_NULL) {
*flag= true;
- smpi_empty_status(status);
+ Status::empty(status);
retval = MPI_SUCCESS;
} else {
int rank = ((*request)->comm() != MPI_COMM_NULL) ? smpi_process()->index() : -1;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
} else if (source == MPI_PROC_NULL) {
- smpi_empty_status(status);
+ Status::empty(status);
status->MPI_SOURCE = MPI_PROC_NULL;
retval = MPI_SUCCESS;
} else {
retval = MPI_ERR_COMM;
} else if (source == MPI_PROC_NULL) {
*flag=true;
- smpi_empty_status(status);
+ Status::empty(status);
status->MPI_SOURCE = MPI_PROC_NULL;
retval = MPI_SUCCESS;
} else {
smpi_bench_end();
- smpi_empty_status(status);
+ Status::empty(status);
if (request == nullptr) {
retval = MPI_ERR_ARG;
TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
Colls::barrier(comm);
+
+ //Barrier can be used to synchronize RMA calls. Finish all requests from comm before.
+ comm->finish_rma_calls();
+
retval = MPI_SUCCESS;
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
} else if (status->count % size != 0) {
return MPI_UNDEFINED;
} else {
- *count = smpi_mpi_get_count(status, datatype);
+ *count = Status::get_count(status, datatype);
return MPI_SUCCESS;
}
}
} else if (ndims < 0 || (ndims > 0 && (dims == nullptr || periodic == nullptr)) || comm_cart == nullptr) {
return MPI_ERR_ARG;
} else{
- new Topo_Cart(comm_old, ndims, dims, periodic, reorder, comm_cart);
+ Topo_Cart* topo = new Topo_Cart(comm_old, ndims, dims, periodic, reorder, comm_cart);
+ if(*comm_cart==MPI_COMM_NULL)
+ delete topo;
return MPI_SUCCESS;
}
}
return MPI_ERR_ARG;
}
MPIR_Cart_Topology cart = topo->sub(remain_dims, comm_new);
+ if(*comm_new==MPI_COMM_NULL)
+ delete cart;
if(cart==nullptr)
return MPI_ERR_ARG;
return MPI_SUCCESS;
return retval;
}
+int PMPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win){
+ int retval = 0;
+ smpi_bench_end();
+ if (win == MPI_WIN_NULL) {
+ retval = MPI_ERR_WIN;
+ } else if (lock_type != MPI_LOCK_EXCLUSIVE &&
+ lock_type != MPI_LOCK_SHARED) {
+ retval = MPI_ERR_LOCKTYPE;
+ } else if (rank == MPI_PROC_NULL){
+ retval = MPI_SUCCESS;
+ } else {
+ int myrank = smpi_process()->index();
+ TRACE_smpi_collective_in(myrank, -1, __FUNCTION__, nullptr);
+ retval = win->lock(lock_type,rank,assert);
+ TRACE_smpi_collective_out(myrank, -1, __FUNCTION__);
+ }
+ smpi_bench_begin();
+ return retval;
+}
+
+int PMPI_Win_unlock(int rank, MPI_Win win){
+ int retval = 0;
+ smpi_bench_end();
+ if (win == MPI_WIN_NULL) {
+ retval = MPI_ERR_WIN;
+ } else if (rank == MPI_PROC_NULL){
+ retval = MPI_SUCCESS;
+ } else {
+ int myrank = smpi_process()->index();
+ TRACE_smpi_collective_in(myrank, -1, __FUNCTION__, nullptr);
+ retval = win->unlock(rank);
+ TRACE_smpi_collective_out(myrank, -1, __FUNCTION__);
+ }
+ smpi_bench_begin();
+ return retval;
+}
+
int PMPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr){
void *ptr = xbt_malloc(size);
if(ptr==nullptr)