-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
/* PMPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
int PMPI_Win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *win){
int retval = 0;
return retval;
}
+int PMPI_Win_allocate_shared( MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, void *base, MPI_Win *win){
+ int retval = 0;
+ smpi_bench_end();
+ if (comm == MPI_COMM_NULL) {
+ retval= MPI_ERR_COMM;
+ }else if (disp_unit <= 0 || size < 0 ){
+ retval= MPI_ERR_OTHER;
+ }else{
+ void* ptr = nullptr;
+ int rank = comm->rank();
+ if(rank==0){
+ ptr = xbt_malloc(size*comm->size());
+ if(ptr==nullptr)
+ return MPI_ERR_NO_MEM;
+ }
+
+ 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);
+ retval = MPI_SUCCESS;
+ }
+ smpi_bench_begin();
+ return retval;
+}
+
int PMPI_Win_create_dynamic( MPI_Info info, MPI_Comm comm, MPI_Win *win){
int retval = 0;
smpi_bench_end();
if (win == MPI_WIN_NULL) {
retval = MPI_ERR_WIN;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_fence"));
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_fence"));
retval = win->fence(assert);
TRACE_smpi_comm_out(my_proc_id);
}
((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
retval = MPI_ERR_TYPE;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+ TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData("Get", target_rank, origin_datatype->is_replayable()
? origin_count
: origin_count * origin_datatype->size(),
- encode_datatype(origin_datatype)));
+ simgrid::smpi::Datatype::encode(origin_datatype)));
retval = win->get( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
target_datatype);
} else if(request == nullptr){
retval = MPI_ERR_REQUEST;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+ TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData(
"Rget", target_rank,
origin_datatype->is_replayable() ? origin_count : origin_count * origin_datatype->size(),
- encode_datatype(origin_datatype)));
+ simgrid::smpi::Datatype::encode(origin_datatype)));
retval = win->get( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
target_datatype, request);
((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
retval = MPI_ERR_TYPE;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
- int dst_traced = group->actor(target_rank)->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+ int dst_traced = group->actor(target_rank)->get_pid();
+ TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData("Put", target_rank, origin_datatype->is_replayable()
? origin_count
: origin_count * origin_datatype->size(),
- encode_datatype(origin_datatype)));
+ simgrid::smpi::Datatype::encode(origin_datatype)));
TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, SMPI_RMA_TAG, origin_count * origin_datatype->size());
retval = win->put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
} else if(request == nullptr){
retval = MPI_ERR_REQUEST;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
- int dst_traced = group->actor(target_rank)->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+ int dst_traced = group->actor(target_rank)->get_pid();
+ TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData(
"Rput", target_rank,
origin_datatype->is_replayable() ? origin_count : origin_count * origin_datatype->size(),
- encode_datatype(origin_datatype)));
+ simgrid::smpi::Datatype::encode(origin_datatype)));
TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, SMPI_RMA_TAG, origin_count * origin_datatype->size());
retval = win->put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+ TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData(
"Accumulate", target_rank,
origin_datatype->is_replayable() ? origin_count : origin_count * origin_datatype->size(),
- encode_datatype(origin_datatype)));
+ simgrid::smpi::Datatype::encode(origin_datatype)));
retval = win->accumulate( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
target_datatype, op);
} else if(request == nullptr){
retval = MPI_ERR_REQUEST;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+ TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData(
"Raccumulate", target_rank,
origin_datatype->is_replayable() ? origin_count : origin_count * origin_datatype->size(),
- encode_datatype(origin_datatype)));
+ simgrid::smpi::Datatype::encode(origin_datatype)));
retval = win->accumulate( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
target_datatype, op, request);
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+ TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData(
"Get_accumulate", target_rank,
target_datatype->is_replayable() ? target_count : target_count * target_datatype->size(),
- encode_datatype(target_datatype)));
+ simgrid::smpi::Datatype::encode(target_datatype)));
retval = win->get_accumulate( origin_addr, origin_count, origin_datatype, result_addr,
result_count, result_datatype, target_rank, target_disp,
} else if(request == nullptr){
retval = MPI_ERR_REQUEST;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+ TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData(
"Rget_accumulate", target_rank,
target_datatype->is_replayable() ? target_count : target_count * target_datatype->size(),
- encode_datatype(target_datatype)));
+ simgrid::smpi::Datatype::encode(target_datatype)));
retval = win->get_accumulate( origin_addr, origin_count, origin_datatype, result_addr,
result_count, result_datatype, target_rank, target_disp,
} else if ((datatype == MPI_DATATYPE_NULL) || (not datatype->is_valid())) {
retval = MPI_ERR_TYPE;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+ TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData("Compare_and_swap", target_rank,
datatype->is_replayable() ? 1 : datatype->size(),
- encode_datatype(datatype)));
+ simgrid::smpi::Datatype::encode(datatype)));
retval = win->compare_and_swap(origin_addr, compare_addr, result_addr, datatype, target_rank, target_disp);
} else if (group==MPI_GROUP_NULL){
retval = MPI_ERR_GROUP;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_post"));
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_post"));
retval = win->post(group,assert);
TRACE_smpi_comm_out(my_proc_id);
}
} else if (group==MPI_GROUP_NULL){
retval = MPI_ERR_GROUP;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_start"));
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_start"));
retval = win->start(group,assert);
TRACE_smpi_comm_out(my_proc_id);
}
if (win == MPI_WIN_NULL) {
retval = MPI_ERR_WIN;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_complete"));
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_complete"));
retval = win->complete();
if (win == MPI_WIN_NULL) {
retval = MPI_ERR_WIN;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_wait"));
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_wait"));
retval = win->wait();
} else if (rank == MPI_PROC_NULL){
retval = MPI_SUCCESS;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+ int 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);
} else if (rank == MPI_PROC_NULL){
retval = MPI_SUCCESS;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_unlock"));
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_unlock"));
retval = win->unlock(rank);
TRACE_smpi_comm_out(my_proc_id);
}
if (win == MPI_WIN_NULL) {
retval = MPI_ERR_WIN;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_lock_all"));
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_lock_all"));
retval = win->lock_all(assert);
TRACE_smpi_comm_out(my_proc_id);
}
if (win == MPI_WIN_NULL) {
retval = MPI_ERR_WIN;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_unlock_all"));
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_unlock_all"));
retval = win->unlock_all();
TRACE_smpi_comm_out(my_proc_id);
}
} else if (rank == MPI_PROC_NULL){
retval = MPI_SUCCESS;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_flush"));
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush"));
retval = win->flush(rank);
TRACE_smpi_comm_out(my_proc_id);
}
} else if (rank == MPI_PROC_NULL){
retval = MPI_SUCCESS;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_flush_local"));
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush_local"));
retval = win->flush_local(rank);
TRACE_smpi_comm_out(my_proc_id);
}
if (win == MPI_WIN_NULL) {
retval = MPI_ERR_WIN;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_flush_all"));
+ int my_proc_id = simgrid::s4u::this_actor::get_pid();
+ TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush_all"));
retval = win->flush_all();
TRACE_smpi_comm_out(my_proc_id);
}
if (win == MPI_WIN_NULL) {
retval = MPI_ERR_WIN;
} else {
- int my_proc_id = simgrid::s4u::Actor::self()->getPid();
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_flush_local_all"));
+ int 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"));
retval = win->flush_local_all();
TRACE_smpi_comm_out(my_proc_id);
}
return retval;
}
+int PMPI_Win_shared_query (MPI_Win win, int rank, MPI_Aint* size, int* disp_unit, void* baseptr)
+{
+ if (win==MPI_WIN_NULL)
+ return MPI_ERR_TYPE;
+ else
+ return win->shared_query(rank, size, disp_unit, baseptr);
+}
int PMPI_Win_get_attr (MPI_Win win, int keyval, void *attribute_val, int* flag)
{
MPI_Fint PMPI_Win_c2f(MPI_Win win){
return win->c2f();
}
-
-}