XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
#define CHECK_RMA\
- CHECK_BUFFER(1, origin_addr, origin_count)\
CHECK_COUNT(2, origin_count)\
CHECK_TYPE(3, origin_datatype)\
- CHECK_PROC(4, target_rank)\
- CHECK_NEGATIVE(4, MPI_ERR_RANK, target_rank)\
+ CHECK_BUFFER(1, origin_addr, origin_count, origin_datatype)\
+ CHECK_PROC_RMA(4, target_rank, win)\
CHECK_COUNT(6, target_count)\
CHECK_TYPE(7, target_datatype)
#define CHECK_TARGET_DISP(num)\
if(win->dynamic()==0)\
- CHECK_NEGATIVE((num), MPI_ERR_RMA_RANGE, target_disp)\
+ CHECK_NEGATIVE((num), MPI_ERR_RMA_RANGE, target_disp)
+
/* PMPI User level calls */
int PMPI_Win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *win){
CHECK_COMM(5)
CHECK_NEGATIVE(2, MPI_ERR_OTHER, size)
CHECK_NEGATIVE(3, MPI_ERR_OTHER, disp_unit)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (base == nullptr && size != 0){
retval= MPI_ERR_OTHER;
}else{
*win = new simgrid::smpi::Win( base, size, disp_unit, info, comm);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
CHECK_NEGATIVE(2, MPI_ERR_OTHER, size)
CHECK_NEGATIVE(3, MPI_ERR_OTHER, disp_unit)
void* ptr = xbt_malloc(size);
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
*static_cast<void**>(base) = ptr;
*win = new simgrid::smpi::Win( ptr, size, disp_unit, info, comm,1);
- smpi_bench_begin();
return MPI_SUCCESS;
}
if(rank==0){
ptr = xbt_malloc(size*comm->size());
}
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
simgrid::smpi::colls::bcast(&ptr, sizeof(void*), MPI_BYTE, 0, comm);
simgrid::smpi::colls::barrier(comm);
*static_cast<void**>(base) = (char*)ptr+rank*size;
*win = new simgrid::smpi::Win( ptr, size, disp_unit, info, comm,rank==0);
- smpi_bench_begin();
return MPI_SUCCESS;
}
int PMPI_Win_create_dynamic( MPI_Info info, MPI_Comm comm, MPI_Win *win){
CHECK_COMM(2)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
*win = new simgrid::smpi::Win(info, comm);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_NEGATIVE(3, MPI_ERR_OTHER, size)
if (base == nullptr && size != 0)
return MPI_ERR_OTHER;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int retval = win->attach(base, size);
- smpi_bench_begin();
return retval;
}
{
CHECK_WIN(1, win)
CHECK_NULL(2, MPI_ERR_OTHER, base)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int retval = win->detach(base);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_free( MPI_Win* win){
CHECK_NULL(1, MPI_ERR_WIN, win)
CHECK_WIN(1, (*win))
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
delete *win;
- smpi_bench_begin();
return MPI_SUCCESS;
}
{
CHECK_WIN(1, win)
CHECK_NULL(2, MPI_ERR_ARG, info)
- *info = win->info();
+ *info = new simgrid::smpi::Info(win->info());
return MPI_SUCCESS;
}
int PMPI_Win_get_group(MPI_Win win, MPI_Group * group){
CHECK_WIN(1, win)
win->get_group(group);
- (*group)->ref();
+ if (*group != MPI_COMM_WORLD->group() && *group != MPI_GROUP_NULL && *group != MPI_GROUP_EMPTY)
+ (*group)->ref();
return MPI_SUCCESS;
}
int PMPI_Win_fence( int assert, MPI_Win win){
CHECK_WIN(2, win)
- smpi_bench_end();
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ const SmpiBenchGuard suspend_bench;
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_fence"));
int retval = win->fence(assert);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win){
- CHECK_RMA
CHECK_WIN(8, win)
+ CHECK_RMA
CHECK_TARGET_DISP(5)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
TRACE_smpi_comm_in(my_proc_id, __func__,
target_datatype);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win, MPI_Request* request){
if(target_rank==MPI_PROC_NULL)
*request = MPI_REQUEST_NULL;
- CHECK_RMA
CHECK_WIN(8, win)
+ CHECK_RMA
CHECK_TARGET_DISP(5)
CHECK_NULL(9, MPI_ERR_ARG, request)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
TRACE_smpi_comm_in(my_proc_id, __func__,
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Put(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win){
- CHECK_RMA
CHECK_WIN(8, win)
+ CHECK_RMA
CHECK_TARGET_DISP(5)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
- int dst_traced = group->actor(target_rank)->get_pid();
+ aid_t dst_traced = group->actor(target_rank);
TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData("Put", target_rank, origin_datatype->is_replayable()
? origin_count
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win, MPI_Request* request){
if(target_rank==MPI_PROC_NULL)
*request = MPI_REQUEST_NULL;
- CHECK_RMA
CHECK_WIN(8, win)
+ CHECK_RMA
CHECK_TARGET_DISP(5)
CHECK_NULL(9, MPI_ERR_ARG, request)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
- int dst_traced = group->actor(target_rank)->get_pid();
+ aid_t dst_traced = group->actor(target_rank);
TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData(
"Rput", target_rank,
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
- CHECK_RMA
- CHECK_OP(8)
CHECK_WIN(9, win)
+ CHECK_RMA
+ CHECK_MPI_NULL(8, MPI_OP_NULL, MPI_ERR_OP, op)
CHECK_TARGET_DISP(5)
int retval = 0;
- smpi_bench_end();
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ const SmpiBenchGuard suspend_bench;
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
TRACE_smpi_comm_in(my_proc_id, __func__,
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request){
if(target_rank==MPI_PROC_NULL)
*request = MPI_REQUEST_NULL;
- CHECK_RMA
- CHECK_OP(8)
CHECK_WIN(9, win)
+ CHECK_RMA
+ CHECK_MPI_NULL(8, MPI_OP_NULL, MPI_ERR_OP, op)
CHECK_TARGET_DISP(5)
CHECK_NULL(10, MPI_ERR_ARG, request)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
TRACE_smpi_comm_in(my_proc_id, __func__,
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Get_accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr,
int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, int target_count,
MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
- if (op != MPI_NO_OP)
- CHECK_BUFFER(1, origin_addr, origin_count)
CHECK_COUNT(2, origin_count)
if(origin_count>0)
CHECK_TYPE(3, origin_datatype)
- CHECK_BUFFER(4, result_addr, result_count)
+ if (op != MPI_NO_OP)
+ CHECK_BUFFER(1, origin_addr, origin_count, origin_datatype)
CHECK_COUNT(5, result_count)
CHECK_TYPE(6, result_datatype)
- CHECK_PROC(7, target_rank)
- CHECK_NEGATIVE(7, MPI_ERR_RANK, target_rank)
+ CHECK_BUFFER(4, result_addr, result_count, result_datatype)
+ CHECK_WIN(12, win)
+ CHECK_PROC_RMA(7, target_rank, win)
CHECK_COUNT(9, target_count)
CHECK_TYPE(10, target_datatype)
- CHECK_OP(11)
- CHECK_WIN(12, win)
+ CHECK_MPI_NULL(11, MPI_OP_NULL, MPI_ERR_OP, op)
CHECK_TARGET_DISP(8)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
TRACE_smpi_comm_in(my_proc_id, __func__,
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request){
if(target_rank==MPI_PROC_NULL)
*request = MPI_REQUEST_NULL;
- CHECK_BUFFER(1, origin_addr, origin_count)
CHECK_COUNT(2, origin_count)
CHECK_TYPE(3, origin_datatype)
- CHECK_BUFFER(4, result_addr, result_count)
+ CHECK_BUFFER(1, origin_addr, origin_count, origin_datatype)
CHECK_COUNT(5, result_count)
CHECK_TYPE(6, result_datatype)
- CHECK_PROC(7, target_rank)
- CHECK_NEGATIVE(7, MPI_ERR_RANK, target_rank)
+ CHECK_BUFFER(4, result_addr, result_count, result_datatype)
+ CHECK_WIN(12, win)
+ CHECK_PROC_RMA(7, target_rank, win)
CHECK_COUNT(9, target_count)
CHECK_TYPE(10, target_datatype)
- CHECK_OP(11)
- CHECK_WIN(12, win)
+ CHECK_MPI_NULL(11, MPI_OP_NULL, MPI_ERR_OP, op)
CHECK_TARGET_DISP(8)
CHECK_NULL(10, MPI_ERR_ARG, request)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
TRACE_smpi_comm_in(my_proc_id, __func__,
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
CHECK_NULL(2, MPI_ERR_BUFFER, compare_addr)
CHECK_NULL(3, MPI_ERR_BUFFER, result_addr)
CHECK_TYPE(4, datatype)
- CHECK_PROC(5, target_rank)
- CHECK_NEGATIVE(5, MPI_ERR_RANK, target_rank)
CHECK_WIN(6, win)
+ CHECK_PROC_RMA(5, target_rank, win)
CHECK_TARGET_DISP(6)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
TRACE_smpi_comm_in(my_proc_id, __func__,
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_post(MPI_Group group, int assert, MPI_Win win){
CHECK_GROUP(1, group)
CHECK_WIN(2, win)
- smpi_bench_end();
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ const SmpiBenchGuard suspend_bench;
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_post"));
int retval = win->post(group,assert);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_start(MPI_Group group, int assert, MPI_Win win){
CHECK_GROUP(1, group)
CHECK_WIN(2, win)
- smpi_bench_end();
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ const SmpiBenchGuard suspend_bench;
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_start"));
int retval = win->start(group,assert);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_complete(MPI_Win win){
CHECK_WIN(1, win)
- smpi_bench_end();
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ const SmpiBenchGuard suspend_bench;
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_complete"));
int retval = win->complete();
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_wait(MPI_Win win){
CHECK_WIN(1, win)
- smpi_bench_end();
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ const SmpiBenchGuard suspend_bench;
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_wait"));
int retval = win->wait();
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win){
- CHECK_PROC(2, rank)
CHECK_WIN(4, win)
+ CHECK_PROC_RMA(2, rank, win)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (lock_type != MPI_LOCK_EXCLUSIVE &&
lock_type != MPI_LOCK_SHARED) {
retval = MPI_ERR_LOCKTYPE;
} else {
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_lock"));
retval = win->lock(lock_type,rank,assert);
TRACE_smpi_comm_out(my_proc_id);
}
- smpi_bench_begin();
return retval;
}
int PMPI_Win_unlock(int rank, MPI_Win win){
- CHECK_PROC(1, rank)
CHECK_WIN(2, win)
- smpi_bench_end();
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ CHECK_PROC_RMA(1, rank, win)
+ const SmpiBenchGuard suspend_bench;
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_unlock"));
int retval = win->unlock(rank);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_lock_all(int assert, MPI_Win win){
CHECK_WIN(2, win)
- smpi_bench_end();
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ const SmpiBenchGuard suspend_bench;
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_lock_all"));
int retval = win->lock_all(assert);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_unlock_all(MPI_Win win){
CHECK_WIN(1, win)
- smpi_bench_end();
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ const SmpiBenchGuard suspend_bench;
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_unlock_all"));
int retval = win->unlock_all();
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_flush(int rank, MPI_Win win){
- CHECK_PROC(1, rank)
CHECK_WIN(2, win)
- smpi_bench_end();
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ CHECK_PROC_RMA(1, rank, win)
+ const SmpiBenchGuard suspend_bench;
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush"));
int retval = win->flush(rank);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_flush_local(int rank, MPI_Win win){
- CHECK_PROC(1, rank)
- CHECK_WIN(2, win) smpi_bench_end();
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ CHECK_WIN(2, win)
+ CHECK_PROC_RMA(1, rank, win)
+ const SmpiBenchGuard suspend_bench;
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush_local"));
int retval = win->flush_local(rank);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_flush_all(MPI_Win win){
CHECK_WIN(1, win)
- smpi_bench_end();
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ const SmpiBenchGuard suspend_bench;
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush_all"));
int retval = win->flush_all();
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_flush_local_all(MPI_Win win){
CHECK_WIN(1, win)
- smpi_bench_end();
- int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ const SmpiBenchGuard suspend_bench;
+ aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush_local_all"));
int retval = win->flush_local_all();
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}