A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[SMPI] Win::~Win(): Use class member rank_ instead of a local var
[simgrid.git]
/
src
/
smpi
/
mpi
/
smpi_win.cpp
diff --git
a/src/smpi/mpi/smpi_win.cpp
b/src/smpi/mpi/smpi_win.cpp
index
f2782d1
..
d88430e
100644
(file)
--- a/
src/smpi/mpi/smpi_win.cpp
+++ b/
src/smpi/mpi/smpi_win.cpp
@@
-3,7
+3,8
@@
/* 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. */
/* 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. */
-#include "private.h"
+#include "smpi_win.hpp"
+#include "private.hpp"
#include "smpi_coll.hpp"
#include "smpi_comm.hpp"
#include "smpi_datatype.hpp"
#include "smpi_coll.hpp"
#include "smpi_comm.hpp"
#include "smpi_datatype.hpp"
@@
-11,7
+12,6
@@
#include "smpi_keyvals.hpp"
#include "smpi_process.hpp"
#include "smpi_request.hpp"
#include "smpi_keyvals.hpp"
#include "smpi_process.hpp"
#include "smpi_request.hpp"
-#include "smpi_win.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_rma, smpi, "Logging specific to SMPI (RMA operations)");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_rma, smpi, "Logging specific to SMPI (RMA operations)");
@@
-70,8
+70,7
@@
Win::~Win(){
comm_->remove_rma_win(this);
Colls::barrier(comm_);
comm_->remove_rma_win(this);
Colls::barrier(comm_);
- int rank=comm_->rank();
- if(rank == 0)
+ if (rank_ == 0)
MSG_barrier_destroy(bar_);
xbt_mutex_destroy(mut_);
xbt_mutex_destroy(lock_mut_);
MSG_barrier_destroy(bar_);
xbt_mutex_destroy(mut_);
xbt_mutex_destroy(lock_mut_);
@@
-195,7
+194,7
@@
int Win::put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
if(opened_==0){//check that post/start has been done
// no fence or start .. lock ok ?
int locked=0;
if(opened_==0){//check that post/start has been done
// no fence or start .. lock ok ?
int locked=0;
- for
(auto
it : recv_win->lockers_)
+ for
(auto const&
it : recv_win->lockers_)
if (it == comm_->rank())
locked = 1;
if(locked != 1)
if (it == comm_->rank())
locked = 1;
if(locked != 1)
@@
-211,11
+210,11
@@
int Win::put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
if(target_rank != comm_->rank()){
//prepare send_request
MPI_Request sreq = Request::rma_send_init(origin_addr, origin_count, origin_datatype, smpi_process()->index(),
if(target_rank != comm_->rank()){
//prepare send_request
MPI_Request sreq = Request::rma_send_init(origin_addr, origin_count, origin_datatype, smpi_process()->index(),
- comm_->group()->
index(target_rank)
, SMPI_RMA_TAG+1, comm_, MPI_OP_NULL);
+ comm_->group()->
actor(target_rank)->getPid()-1
, SMPI_RMA_TAG+1, comm_, MPI_OP_NULL);
//prepare receiver request
MPI_Request rreq = Request::rma_recv_init(recv_addr, target_count, target_datatype, smpi_process()->index(),
//prepare receiver request
MPI_Request rreq = Request::rma_recv_init(recv_addr, target_count, target_datatype, smpi_process()->index(),
- comm_->group()->
index(target_rank)
, SMPI_RMA_TAG+1, recv_win->comm_, MPI_OP_NULL);
+ comm_->group()->
actor(target_rank)->getPid()-1
, SMPI_RMA_TAG+1, recv_win->comm_, MPI_OP_NULL);
//start send
sreq->start();
//start send
sreq->start();
@@
-252,7
+251,7
@@
int Win::get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
if(opened_==0){//check that post/start has been done
// no fence or start .. lock ok ?
int locked=0;
if(opened_==0){//check that post/start has been done
// no fence or start .. lock ok ?
int locked=0;
- for
(auto
it : send_win->lockers_)
+ for
(auto const&
it : send_win->lockers_)
if (it == comm_->rank())
locked = 1;
if(locked != 1)
if (it == comm_->rank())
locked = 1;
if(locked != 1)
@@
-268,12
+267,12
@@
int Win::get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
if(target_rank != comm_->rank()){
//prepare send_request
MPI_Request sreq = Request::rma_send_init(send_addr, target_count, target_datatype,
if(target_rank != comm_->rank()){
//prepare send_request
MPI_Request sreq = Request::rma_send_init(send_addr, target_count, target_datatype,
- comm_->group()->
index(target_rank)
, smpi_process()->index(), SMPI_RMA_TAG+2, send_win->comm_,
+ comm_->group()->
actor(target_rank)->getPid()-1
, smpi_process()->index(), SMPI_RMA_TAG+2, send_win->comm_,
MPI_OP_NULL);
//prepare receiver request
MPI_Request rreq = Request::rma_recv_init(origin_addr, origin_count, origin_datatype,
MPI_OP_NULL);
//prepare receiver request
MPI_Request rreq = Request::rma_recv_init(origin_addr, origin_count, origin_datatype,
- comm_->group()->
index(target_rank)
, smpi_process()->index(), SMPI_RMA_TAG+2, comm_,
+ comm_->group()->
actor(target_rank)->getPid()-1
, smpi_process()->index(), SMPI_RMA_TAG+2, comm_,
MPI_OP_NULL);
//start the send, with another process than us as sender.
MPI_OP_NULL);
//start the send, with another process than us as sender.
@@
-307,14
+306,14
@@
int Win::get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
int Win::accumulate( 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_Request* request)
{
int Win::accumulate( 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_Request* request)
{
-
+ XBT_DEBUG("Entering MPI_Win_Accumulate");
//get receiver pointer
MPI_Win recv_win = connected_wins_[target_rank];
if(opened_==0){//check that post/start has been done
// no fence or start .. lock ok ?
int locked=0;
//get receiver pointer
MPI_Win recv_win = connected_wins_[target_rank];
if(opened_==0){//check that post/start has been done
// no fence or start .. lock ok ?
int locked=0;
- for
(auto
it : recv_win->lockers_)
+ for
(auto const&
it : recv_win->lockers_)
if (it == comm_->rank())
locked = 1;
if(locked != 1)
if (it == comm_->rank())
locked = 1;
if(locked != 1)
@@
-331,11
+330,11
@@
int Win::accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_da
//prepare send_request
MPI_Request sreq = Request::rma_send_init(origin_addr, origin_count, origin_datatype,
//prepare send_request
MPI_Request sreq = Request::rma_send_init(origin_addr, origin_count, origin_datatype,
- smpi_process()->index(), comm_->group()->
index(target_rank)
, SMPI_RMA_TAG-3-count_, comm_, op);
+ smpi_process()->index(), comm_->group()->
actor(target_rank)->getPid()-1
, SMPI_RMA_TAG-3-count_, comm_, op);
//prepare receiver request
MPI_Request rreq = Request::rma_recv_init(recv_addr, target_count, target_datatype,
//prepare receiver request
MPI_Request rreq = Request::rma_recv_init(recv_addr, target_count, target_datatype,
- smpi_process()->index(), comm_->group()->
index(target_rank)
, SMPI_RMA_TAG-3-count_, recv_win->comm_, op);
+ smpi_process()->index(), comm_->group()->
actor(target_rank)->getPid()-1
, SMPI_RMA_TAG-3-count_, recv_win->comm_, op);
count_++;
count_++;
@@
-355,6
+354,7
@@
int Win::accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_da
xbt_mutex_release(mut_);
}
xbt_mutex_release(mut_);
}
+ XBT_DEBUG("Leaving MPI_Win_Accumulate");
return MPI_SUCCESS;
}
return MPI_SUCCESS;
}
@@
-368,7
+368,7
@@
int Win::get_accumulate( void *origin_addr, int origin_count, MPI_Datatype origi
if(opened_==0){//check that post/start has been done
// no fence or start .. lock ok ?
int locked=0;
if(opened_==0){//check that post/start has been done
// no fence or start .. lock ok ?
int locked=0;
- for
(auto
it : send_win->lockers_)
+ for
(auto const&
it : send_win->lockers_)
if (it == comm_->rank())
locked = 1;
if(locked != 1)
if (it == comm_->rank())
locked = 1;
if(locked != 1)
@@
-405,7
+405,7
@@
int Win::compare_and_swap(void *origin_addr, void *compare_addr,
if(opened_==0){//check that post/start has been done
// no fence or start .. lock ok ?
int locked=0;
if(opened_==0){//check that post/start has been done
// no fence or start .. lock ok ?
int locked=0;
- for
(auto
it : send_win->lockers_)
+ for
(auto const&
it : send_win->lockers_)
if (it == comm_->rank())
locked = 1;
if(locked != 1)
if (it == comm_->rank())
locked = 1;
if(locked != 1)
@@
-413,7
+413,7
@@
int Win::compare_and_swap(void *origin_addr, void *compare_addr,
}
XBT_DEBUG("Entering MPI_Compare_and_swap with %d", target_rank);
}
XBT_DEBUG("Entering MPI_Compare_and_swap with %d", target_rank);
- MPI_Request req;
+ MPI_Request req
= MPI_REQUEST_NULL
;
xbt_mutex_acquire(send_win->atomic_mut_);
get(result_addr, 1, datatype, target_rank,
target_disp, 1, datatype, &req);
xbt_mutex_acquire(send_win->atomic_mut_);
get(result_addr, 1, datatype, target_rank,
target_disp, 1, datatype, &req);
@@
-446,8
+446,9
@@
int Win::start(MPI_Group group, int assert){
int size = group->size();
MPI_Request* reqs = xbt_new0(MPI_Request, size);
int size = group->size();
MPI_Request* reqs = xbt_new0(MPI_Request, size);
+ XBT_DEBUG("Entering MPI_Win_Start");
while (j != size) {
while (j != size) {
- int src = group->
index(j)
;
+ int src = group->
actor(j)->getPid()-1
;
if (src != smpi_process()->index() && src != MPI_UNDEFINED) {
reqs[i] = Request::irecv_init(nullptr, 0, MPI_CHAR, src, SMPI_RMA_TAG + 4, MPI_COMM_WORLD);
i++;
if (src != smpi_process()->index() && src != MPI_UNDEFINED) {
reqs[i] = Request::irecv_init(nullptr, 0, MPI_CHAR, src, SMPI_RMA_TAG + 4, MPI_COMM_WORLD);
i++;
@@
-464,6
+465,7
@@
int Win::start(MPI_Group group, int assert){
opened_++; //we're open for business !
group_=group;
group->ref();
opened_++; //we're open for business !
group_=group;
group->ref();
+ XBT_DEBUG("Leaving MPI_Win_Start");
return MPI_SUCCESS;
}
return MPI_SUCCESS;
}
@@
-474,8
+476,9
@@
int Win::post(MPI_Group group, int assert){
int size = group->size();
MPI_Request* reqs = xbt_new0(MPI_Request, size);
int size = group->size();
MPI_Request* reqs = xbt_new0(MPI_Request, size);
+ XBT_DEBUG("Entering MPI_Win_Post");
while(j!=size){
while(j!=size){
- int dst=group->
index(j)
;
+ int dst=group->
actor(j)->getPid()-1
;
if(dst!=smpi_process()->index() && dst!=MPI_UNDEFINED){
reqs[i]=Request::send_init(nullptr, 0, MPI_CHAR, dst, SMPI_RMA_TAG+4, MPI_COMM_WORLD);
i++;
if(dst!=smpi_process()->index() && dst!=MPI_UNDEFINED){
reqs[i]=Request::send_init(nullptr, 0, MPI_CHAR, dst, SMPI_RMA_TAG+4, MPI_COMM_WORLD);
i++;
@@
-493,6
+496,7
@@
int Win::post(MPI_Group group, int assert){
opened_++; //we're open for business !
group_=group;
group->ref();
opened_++; //we're open for business !
group_=group;
group->ref();
+ XBT_DEBUG("Leaving MPI_Win_Post");
return MPI_SUCCESS;
}
return MPI_SUCCESS;
}
@@
-507,7
+511,7
@@
int Win::complete(){
MPI_Request* reqs = xbt_new0(MPI_Request, size);
while(j!=size){
MPI_Request* reqs = xbt_new0(MPI_Request, size);
while(j!=size){
- int dst=group_->
index(j)
;
+ int dst=group_->
actor(j)->getPid()-1
;
if(dst!=smpi_process()->index() && dst!=MPI_UNDEFINED){
reqs[i]=Request::send_init(nullptr, 0, MPI_CHAR, dst, SMPI_RMA_TAG+5, MPI_COMM_WORLD);
i++;
if(dst!=smpi_process()->index() && dst!=MPI_UNDEFINED){
reqs[i]=Request::send_init(nullptr, 0, MPI_CHAR, dst, SMPI_RMA_TAG+5, MPI_COMM_WORLD);
i++;
@@
-541,7
+545,7
@@
int Win::wait(){
MPI_Request* reqs = xbt_new0(MPI_Request, size);
while(j!=size){
MPI_Request* reqs = xbt_new0(MPI_Request, size);
while(j!=size){
- int src=group_->
index(j)
;
+ int src=group_->
actor(j)->getPid()-1
;
if(src!=smpi_process()->index() && src!=MPI_UNDEFINED){
reqs[i]=Request::irecv_init(nullptr, 0, MPI_CHAR, src,SMPI_RMA_TAG+5, MPI_COMM_WORLD);
i++;
if(src!=smpi_process()->index() && src!=MPI_UNDEFINED){
reqs[i]=Request::irecv_init(nullptr, 0, MPI_CHAR, src,SMPI_RMA_TAG+5, MPI_COMM_WORLD);
i++;