int already_init;
MPI_Initialized(&already_init);
if(already_init == 0){
- smpi_process_init(argc, argv);
- smpi_process_mark_as_initialized();
- int rank = smpi_process_index();
+ Process::init(argc, argv);
+ smpi_process()->mark_as_initialized();
+ int rank = smpi_process()->index();
TRACE_smpi_init(rank);
TRACE_smpi_computing_init(rank);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
int PMPI_Finalize()
{
smpi_bench_end();
- int rank = smpi_process_index();
+ int rank = smpi_process()->index();
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_FINALIZE;
TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
- smpi_process_finalize();
+ smpi_process()->finalize();
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
- TRACE_smpi_finalize(smpi_process_index());
- smpi_process_destroy();
+ TRACE_smpi_finalize(smpi_process()->index());
+ smpi_process()->destroy();
return MPI_SUCCESS;
}
int PMPI_Finalized(int* flag)
{
- *flag=smpi_process_finalized();
+ *flag=smpi_process()!=nullptr ? smpi_process()->finalized() : 0;
return MPI_SUCCESS;
}
if (flag == nullptr) {
return MPI_ERR_ARG;
} else {
- *flag = smpi_process_index() == 0;
+ *flag = smpi_process()->index() == 0;
return MPI_SUCCESS;
}
}
int PMPI_Abort(MPI_Comm comm, int errorcode)
{
smpi_bench_end();
- smpi_process_destroy();
+ smpi_process()->destroy();
// FIXME: should kill all processes in comm instead
simcall_process_kill(SIMIX_process_self());
return MPI_SUCCESS;
} else if (rank == nullptr) {
return MPI_ERR_ARG;
} else {
- *rank = group->rank(smpi_process_index());
+ *rank = group->rank(smpi_process()->index());
return MPI_SUCCESS;
}
}
return MPI_ERR_GROUP;
} else if (newcomm == nullptr) {
return MPI_ERR_ARG;
- } else if(group->rank(smpi_process_index())==MPI_UNDEFINED){
+ } else if(group->rank(smpi_process()->index())==MPI_UNDEFINED){
*newcomm= MPI_COMM_NULL;
return MPI_SUCCESS;
}else{
retval = MPI_ERR_TAG;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int src_traced = comm->group()->index(src);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
} else if(tag<0 && tag != MPI_ANY_TAG){
retval = MPI_ERR_TAG;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int dst_traced = comm->group()->index(dst);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_ISEND;
} else if(tag<0 && tag != MPI_ANY_TAG){
retval = MPI_ERR_TAG;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int dst_traced = comm->group()->index(dst);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_ISSEND;
} else if(tag<0 && tag != MPI_ANY_TAG){
retval = MPI_ERR_TAG;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int src_traced = comm->group()->index(src);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
extra->type = TRACING_RECV;
} else if(tag < 0 && tag != MPI_ANY_TAG){
retval = MPI_ERR_TAG;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int dst_traced = comm->group()->index(dst);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_SEND;
} else if(tag<0 && tag != MPI_ANY_TAG){
retval = MPI_ERR_TAG;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int dst_traced = comm->group()->index(dst);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_SSEND;
retval = MPI_ERR_TAG;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int dst_traced = comm->group()->index(dst);
int src_traced = comm->group()->index(src);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
smpi_empty_status(status);
retval = MPI_SUCCESS;
} else {
- int rank = ((*request)->comm() != MPI_COMM_NULL) ? smpi_process_index() : -1;
+ int rank = ((*request)->comm() != MPI_COMM_NULL) ? smpi_process()->index() : -1;
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_TEST;
retval = MPI_SUCCESS;
} else {
- int rank = (request!=nullptr && (*request)->comm() != MPI_COMM_NULL) ? smpi_process_index() : -1;
+ int rank = (request!=nullptr && (*request)->comm() != MPI_COMM_NULL) ? smpi_process()->index() : -1;
int src_traced = (*request)->src();
int dst_traced = (*request)->dst();
savedvals[i]=(savedvalstype){req->src(), req->dst(), (req->flags() & RECV), req->tag(), req->comm()};
}
}
- int rank_traced = smpi_process_index();
+ int rank_traced = smpi_process()->index();
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_WAITANY;
extra->send_size=count;
savedvals[i].valid=0;
}
}
- int rank_traced = smpi_process_index();
+ int rank_traced = smpi_process()->index();
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_WAITALL;
extra->send_size=count;
} else if (!datatype->is_valid()) {
retval = MPI_ERR_ARG;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int root_traced = comm->group()->index(root);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
extra->type = TRACING_BARRIER;
TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
sendtmpcount=0;
sendtmptype=recvtype;
}
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int root_traced = comm->group()->index(root);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
extra->type = TRACING_GATHER;
sendtmptype=recvtype;
}
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int root_traced = comm->group()->index(root);
int i = 0;
int size = comm->size();
sendcount=recvcount;
sendtype=recvtype;
}
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
extra->type = TRACING_ALLGATHER;
int known = 0;
sendcount=recvcounts[comm->rank()];
sendtype=recvtype;
}
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int i = 0;
int size = comm->size();
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
recvtype = sendtype;
recvcount = sendcount;
}
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int root_traced = comm->group()->index(root);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
extra->type = TRACING_SCATTER;
recvtype = sendtype;
recvcount = sendcounts[comm->rank()];
}
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int root_traced = comm->group()->index(root);
int i = 0;
int size = comm->size();
} else if (!datatype->is_valid() || op == MPI_OP_NULL) {
retval = MPI_ERR_ARG;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int root_traced = comm->group()->index(root);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
extra->type = TRACING_REDUCE;
sendtmpbuf = static_cast<char*>(xbt_malloc(count*datatype->get_extent()));
Datatype::copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
}
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
extra->type = TRACING_ALLREDUCE;
int known = 0;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
extra->type = TRACING_SCAN;
int known = 0;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
extra->type = TRACING_EXSCAN;
int known = 0;
} else if (recvcounts == nullptr) {
retval = MPI_ERR_ARG;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int i = 0;
int size = comm->size();
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
} else {
int count = comm->size();
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
extra->type = TRACING_REDUCE_SCATTER;
extra->num_processes = count;
} else if ((sendbuf != MPI_IN_PLACE && sendtype == MPI_DATATYPE_NULL) || recvtype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
extra->type = TRACING_ALLTOALL;
recvdisps == nullptr) {
retval = MPI_ERR_ARG;
} else {
- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int i = 0;
int size = comm->size();
instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
}
int PMPI_Initialized(int* flag) {
- *flag=smpi_process_initialized();
+ *flag=(smpi_process()!=nullptr && smpi_process()->initialized());
return MPI_SUCCESS;
}
if (win == MPI_WIN_NULL) {
retval = MPI_ERR_WIN;
} else {
- int rank = smpi_process_index();
+ int rank = smpi_process()->index();
TRACE_smpi_collective_in(rank, -1, __FUNCTION__, nullptr);
retval = win->fence(assert);
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
} else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
retval = MPI_ERR_TYPE;
} else {
- int rank = smpi_process_index();
+ int rank = smpi_process()->index();
MPI_Group group;
win->get_group(&group);
int src_traced = group->index(target_rank);
} else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
retval = MPI_ERR_TYPE;
} else {
- int rank = smpi_process_index();
+ int rank = smpi_process()->index();
MPI_Group group;
win->get_group(&group);
int dst_traced = group->index(target_rank);
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
} else {
- int rank = smpi_process_index();
+ int rank = smpi_process()->index();
MPI_Group group;
win->get_group(&group);
int src_traced = group->index(target_rank);
} else if (group==MPI_GROUP_NULL){
retval = MPI_ERR_GROUP;
} else {
- int rank = smpi_process_index();
+ int rank = smpi_process()->index();
TRACE_smpi_collective_in(rank, -1, __FUNCTION__, nullptr);
retval = win->post(group,assert);
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
} else if (group==MPI_GROUP_NULL){
retval = MPI_ERR_GROUP;
} else {
- int rank = smpi_process_index();
+ int rank = smpi_process()->index();
TRACE_smpi_collective_in(rank, -1, __FUNCTION__, nullptr);
retval = win->start(group,assert);
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
if (win == MPI_WIN_NULL) {
retval = MPI_ERR_WIN;
} else {
- int rank = smpi_process_index();
+ int rank = smpi_process()->index();
TRACE_smpi_collective_in(rank, -1, __FUNCTION__, nullptr);
retval = win->complete();
if (win == MPI_WIN_NULL) {
retval = MPI_ERR_WIN;
} else {
- int rank = smpi_process_index();
+ int rank = smpi_process()->index();
TRACE_smpi_collective_in(rank, -1, __FUNCTION__, nullptr);
retval = win->wait();