From 0fabb12fc92ad7f1d47ec977e2d7e4eb36f16977 Mon Sep 17 00:00:00 2001 From: degomme Date: Sun, 5 Mar 2017 23:28:14 +0100 Subject: [PATCH 1/1] rename method --- src/smpi/smpi_comm.cpp | 1 + src/smpi/smpi_group.cpp | 16 ++++++++-------- src/smpi/smpi_group.hpp | 2 +- src/smpi/smpi_pmpi.cpp | 20 ++++++++++---------- src/smpi/smpi_rma.cpp | 8 ++++---- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/smpi/smpi_comm.cpp b/src/smpi/smpi_comm.cpp index 1ab9eaed21..8c6cb3ed2c 100644 --- a/src/smpi/smpi_comm.cpp +++ b/src/smpi/smpi_comm.cpp @@ -141,6 +141,7 @@ int smpi_comm_size(MPI_Comm comm) if (comm == MPI_COMM_UNINITIALIZED) comm = smpi_process_comm_world(); return smpi_comm_group(comm)->getsize(); + return smpi_comm_group(this)->size(); } int smpi_comm_rank(MPI_Comm comm) diff --git a/src/smpi/smpi_group.cpp b/src/smpi/smpi_group.cpp index b45e31b1b8..6fc5084bc9 100644 --- a/src/smpi/smpi_group.cpp +++ b/src/smpi/smpi_group.cpp @@ -45,7 +45,7 @@ Group::Group(MPI_Group origin) if(origin != MPI_GROUP_NULL && origin != MPI_GROUP_EMPTY) { - m_size = origin->getsize(); + m_size = origin->size(); m_rank_to_index_map = xbt_new(int, m_size); m_index_to_rank_map = xbt_dict_new_homogeneous(xbt_free_f); m_refcount = 1; @@ -132,7 +132,7 @@ int Group::unuse() return m_refcount; } -int Group::getsize() +int Group::size() { return m_size; } @@ -143,10 +143,10 @@ int Group::compare(MPI_Group group2) int i, index, rank, sz; result = MPI_IDENT; - if (m_size != group2->getsize()) { + if (m_size != group2->size()) { result = MPI_UNEQUAL; } else { - sz = group2->getsize(); + sz = group2->size(); for (i = 0; i < sz; i++) { index = this->index(i); rank = group2->rank(index); @@ -187,7 +187,7 @@ int Group::incl(int n, int* ranks, MPI_Group* newgroup) int Group::group_union(MPI_Group group2, MPI_Group* newgroup) { int size1 = m_size; - int size2 = group2->getsize(); + int size2 = group2->size(); for (int i = 0; i < size2; i++) { int proc2 = group2->index(i); int proc1 = this->rank(proc2); @@ -199,7 +199,7 @@ int Group::group_union(MPI_Group group2, MPI_Group* newgroup) *newgroup = MPI_GROUP_EMPTY; } else { *newgroup = new simgrid::SMPI::Group(size1); - size2 = this->getsize(); + size2 = this->size(); for (int i = 0; i < size2; i++) { int proc1 = this->index(i); (*newgroup)->set_mapping(proc1, i); @@ -214,7 +214,7 @@ int Group::group_union(MPI_Group group2, MPI_Group* newgroup) int Group::intersection(MPI_Group group2, MPI_Group* newgroup) { - int size2 = group2->getsize(); + int size2 = group2->size(); for (int i = 0; i < size2; i++) { int proc2 = group2->index(i); int proc1 = this->rank(proc2); @@ -227,7 +227,7 @@ int Group::intersection(MPI_Group group2, MPI_Group* newgroup) } else { *newgroup = new simgrid::SMPI::Group(size2); int j=0; - for (int i = 0; i < group2->getsize(); i++) { + for (int i = 0; i < group2->size(); i++) { int proc2 = group2->index(i); int proc1 = this->rank(proc2); if (proc1 != MPI_UNDEFINED) { diff --git a/src/smpi/smpi_group.hpp b/src/smpi/smpi_group.hpp index ea9af8af11..466d7c2f47 100644 --- a/src/smpi/smpi_group.hpp +++ b/src/smpi/smpi_group.hpp @@ -31,7 +31,7 @@ class Group { int rank(int index); int use(); int unuse(); - int getsize(); + int size(); int compare(MPI_Group group2); int incl(int n, int* ranks, MPI_Group* newgroup); int excl(int n, int *ranks, MPI_Group * newgroup); diff --git a/src/smpi/smpi_pmpi.cpp b/src/smpi/smpi_pmpi.cpp index 0b59547c10..15bb7391f1 100644 --- a/src/smpi/smpi_pmpi.cpp +++ b/src/smpi/smpi_pmpi.cpp @@ -284,7 +284,7 @@ int PMPI_Group_size(MPI_Group group, int *size) } else if (size == nullptr) { return MPI_ERR_ARG; } else { - *size = group->getsize(); + *size = group->size(); return MPI_SUCCESS; } } @@ -389,7 +389,7 @@ int PMPI_Group_excl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup) && group != smpi_comm_group(MPI_COMM_SELF) && group != MPI_GROUP_EMPTY) group->use(); return MPI_SUCCESS; - } else if (n == group->getsize()) { + } else if (n == group->size()) { *newgroup = MPI_GROUP_EMPTY; return MPI_SUCCESS; } else { @@ -726,7 +726,7 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MP } else if (src == MPI_PROC_NULL) { *request = MPI_REQUEST_NULL; retval = MPI_SUCCESS; - } else if (src!=MPI_ANY_SOURCE && (src >= smpi_comm_group(comm)->getsize() || src <0)){ + } else if (src!=MPI_ANY_SOURCE && (src >= smpi_comm_group(comm)->size() || src <0)){ retval = MPI_ERR_RANK; } else if ((count < 0) || (buf==nullptr && count > 0)) { retval = MPI_ERR_COUNT; @@ -777,7 +777,7 @@ int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MP } else if (dst == MPI_PROC_NULL) { *request = MPI_REQUEST_NULL; retval = MPI_SUCCESS; - } else if (dst >= smpi_comm_group(comm)->getsize() || dst <0){ + } else if (dst >= smpi_comm_group(comm)->size() || dst <0){ retval = MPI_ERR_RANK; } else if ((count < 0) || (buf==nullptr && count > 0)) { retval = MPI_ERR_COUNT; @@ -826,7 +826,7 @@ int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, M } else if (dst == MPI_PROC_NULL) { *request = MPI_REQUEST_NULL; retval = MPI_SUCCESS; - } else if (dst >= smpi_comm_group(comm)->getsize() || dst <0){ + } else if (dst >= smpi_comm_group(comm)->size() || dst <0){ retval = MPI_ERR_RANK; } else if ((count < 0)|| (buf==nullptr && count > 0)) { retval = MPI_ERR_COUNT; @@ -874,7 +874,7 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI smpi_empty_status(status); status->MPI_SOURCE = MPI_PROC_NULL; retval = MPI_SUCCESS; - } else if (src!=MPI_ANY_SOURCE && (src >= smpi_comm_group(comm)->getsize() || src <0)){ + } else if (src!=MPI_ANY_SOURCE && (src >= smpi_comm_group(comm)->size() || src <0)){ retval = MPI_ERR_RANK; } else if ((count < 0) || (buf==nullptr && count > 0)) { retval = MPI_ERR_COUNT; @@ -924,7 +924,7 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI retval = MPI_ERR_COMM; } else if (dst == MPI_PROC_NULL) { retval = MPI_SUCCESS; - } else if (dst >= smpi_comm_group(comm)->getsize() || dst <0){ + } else if (dst >= smpi_comm_group(comm)->size() || dst <0){ retval = MPI_ERR_RANK; } else if ((count < 0) || (buf == nullptr && count > 0)) { retval = MPI_ERR_COUNT; @@ -970,7 +970,7 @@ int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MP retval = MPI_ERR_COMM; } else if (dst == MPI_PROC_NULL) { retval = MPI_SUCCESS; - } else if (dst >= smpi_comm_group(comm)->getsize() || dst <0){ + } else if (dst >= smpi_comm_group(comm)->size() || dst <0){ retval = MPI_ERR_RANK; } else if ((count < 0) || (buf==nullptr && count > 0)) { retval = MPI_ERR_COUNT; @@ -1020,8 +1020,8 @@ int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dst, smpi_empty_status(status); status->MPI_SOURCE = MPI_PROC_NULL; retval = MPI_SUCCESS; - }else if (dst >= smpi_comm_group(comm)->getsize() || dst <0 || - (src!=MPI_ANY_SOURCE && (src >= smpi_comm_group(comm)->getsize() || src <0))){ + }else if (dst >= smpi_comm_group(comm)->size() || dst <0 || + (src!=MPI_ANY_SOURCE && (src >= smpi_comm_group(comm)->size() || src <0))){ retval = MPI_ERR_RANK; } else if ((sendcount < 0 || recvcount<0) || (sendbuf==nullptr && sendcount > 0) || (recvbuf==nullptr && recvcount>0)) { diff --git a/src/smpi/smpi_rma.cpp b/src/smpi/smpi_rma.cpp index b91fd0f8b2..42de98449f 100644 --- a/src/smpi/smpi_rma.cpp +++ b/src/smpi/smpi_rma.cpp @@ -279,7 +279,7 @@ int smpi_mpi_win_start(MPI_Group group, int assert, MPI_Win win){ //naive, blocking implementation. int i = 0; int j = 0; - int size = group->getsize(); + int size = group->size(); MPI_Request* reqs = xbt_new0(MPI_Request, size); while (j != size) { @@ -307,7 +307,7 @@ int smpi_mpi_win_post(MPI_Group group, int assert, MPI_Win win){ //let's make a synchronous send here int i = 0; int j = 0; - int size = group->getsize(); + int size = group->size(); MPI_Request* reqs = xbt_new0(MPI_Request, size); while(j!=size){ @@ -339,7 +339,7 @@ int smpi_mpi_win_complete(MPI_Win win){ XBT_DEBUG("Entering MPI_Win_Complete"); int i = 0; int j = 0; - int size = win->group->getsize(); + int size = win->group->size(); MPI_Request* reqs = xbt_new0(MPI_Request, size); while(j!=size){ @@ -388,7 +388,7 @@ int smpi_mpi_win_wait(MPI_Win win){ //naive, blocking implementation. XBT_DEBUG("Entering MPI_Win_Wait"); int i=0,j=0; - int size = win->group->getsize(); + int size = win->group->size(); MPI_Request* reqs = xbt_new0(MPI_Request, size); while(j!=size){ -- 2.20.1