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] Move a map in smpi::Group from array to std::vector
[simgrid.git]
/
src
/
smpi
/
mpi
/
smpi_group.cpp
diff --git
a/src/smpi/mpi/smpi_group.cpp
b/src/smpi/mpi/smpi_group.cpp
index
d621068
..
23c4809
100644
(file)
--- a/
src/smpi/mpi/smpi_group.cpp
+++ b/
src/smpi/mpi/smpi_group.cpp
@@
-5,6
+5,7
@@
#include "smpi_group.hpp"
#include "smpi_comm.hpp"
#include "smpi_group.hpp"
#include "smpi_comm.hpp"
+#include <string>
#include <xbt/log.h>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_group, smpi, "Logging specific to SMPI (group)");
#include <xbt/log.h>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_group, smpi, "Logging specific to SMPI (group)");
@@
-18,13
+19,11
@@
namespace smpi{
Group::Group()
{
size_ = 0; /* size */
Group::Group()
{
size_ = 0; /* size */
- rank_to_index_map_ = nullptr; /* rank_to_index_map_ */
refcount_ = 1; /* refcount_: start > 0 so that this group never gets freed */
}
refcount_ = 1; /* refcount_: start > 0 so that this group never gets freed */
}
-Group::Group(int n) : size_(n)
+Group::Group(int n) : size_(n)
, rank_to_index_map_(size_)
{
{
- rank_to_index_map_ = new int[size_];
refcount_ = 1;
for (int i = 0; i < size_; i++)
rank_to_index_map_[i] = MPI_UNDEFINED;
refcount_ = 1;
for (int i = 0; i < size_; i++)
rank_to_index_map_[i] = MPI_UNDEFINED;
@@
-34,11
+33,8
@@
Group::Group(MPI_Group origin)
{
if (origin != MPI_GROUP_NULL && origin != MPI_GROUP_EMPTY) {
size_ = origin->size();
{
if (origin != MPI_GROUP_NULL && origin != MPI_GROUP_EMPTY) {
size_ = origin->size();
- rank_to_index_map_ = new int[size_];
refcount_ = 1;
refcount_ = 1;
- for (int i = 0; i < size_; i++) {
- rank_to_index_map_[i] = origin->rank_to_index_map_[i];
- }
+ rank_to_index_map_ = origin->rank_to_index_map_;
for (auto const& elm : origin->index_to_rank_map_) {
index_to_rank_map_.insert({elm.first, elm.second});
for (auto const& elm : origin->index_to_rank_map_) {
index_to_rank_map_.insert({elm.first, elm.second});
@@
-48,7
+44,7
@@
Group::Group(MPI_Group origin)
Group::~Group()
{
Group::~Group()
{
-
delete[] rank_to_index_map_
;
+
rank_to_index_map_.clear()
;
}
void Group::set_mapping(int index, int rank)
}
void Group::set_mapping(int index, int rank)