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
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git]
/
src
/
smpi
/
smpi_group.cpp
diff --git
a/src/smpi/smpi_group.cpp
b/src/smpi/smpi_group.cpp
index
247c68b
..
41eb245
100644
(file)
--- a/
src/smpi/smpi_group.cpp
+++ b/
src/smpi/smpi_group.cpp
@@
-17,8
+17,8
@@
typedef struct s_smpi_mpi_group {
static s_smpi_mpi_group_t mpi_MPI_GROUP_EMPTY = {
0, /* size */
static s_smpi_mpi_group_t mpi_MPI_GROUP_EMPTY = {
0, /* size */
-
NULL
, /* rank_to_index_map */
-
NULL
, /* index_to_rank_map */
+
nullptr
, /* rank_to_index_map */
+
nullptr
, /* index_to_rank_map */
1, /* refcount: start > 0 so that this group never gets freed */
};
1, /* refcount: start > 0 so that this group never gets freed */
};
@@
-46,11
+46,11
@@
MPI_Group smpi_group_copy(MPI_Group origin)
MPI_Group group=origin;
char *key;
char *ptr_rank;
MPI_Group group=origin;
char *key;
char *ptr_rank;
- xbt_dict_cursor_t cursor =
NULL
;
+ xbt_dict_cursor_t cursor =
nullptr
;
int i;
int i;
- if(origin
!= smpi_comm_group(MPI_COMM_WORLD) && origin
!= MPI_GROUP_NULL
- && origin !=
smpi_comm_group(MPI_COMM_SELF) && origin !=
MPI_GROUP_EMPTY)
+ if(origin != MPI_GROUP_NULL
+ && origin != MPI_GROUP_EMPTY)
{
group = xbt_new(s_smpi_mpi_group_t, 1);
group->size = origin->size;
{
group = xbt_new(s_smpi_mpi_group_t, 1);
group->size = origin->size;
@@
-62,7
+62,9
@@
MPI_Group smpi_group_copy(MPI_Group origin)
}
xbt_dict_foreach(origin->index_to_rank_map, cursor, key, ptr_rank) {
}
xbt_dict_foreach(origin->index_to_rank_map, cursor, key, ptr_rank) {
- xbt_dict_set(group->index_to_rank_map, key, ptr_rank, NULL);
+ int * cp = static_cast<int*>(xbt_malloc(sizeof(int)));
+ *cp=*reinterpret_cast<int*>(ptr_rank);
+ xbt_dict_set(group->index_to_rank_map, key, cp, nullptr);
}
}
}
}
@@
-73,7
+75,6
@@
void smpi_group_destroy(MPI_Group group)
{
if(group!= smpi_comm_group(MPI_COMM_WORLD)
&& group != MPI_GROUP_NULL
{
if(group!= smpi_comm_group(MPI_COMM_WORLD)
&& group != MPI_GROUP_NULL
- && group != smpi_comm_group(MPI_COMM_SELF)
&& group != MPI_GROUP_EMPTY)
smpi_group_unuse(group);
}
&& group != MPI_GROUP_EMPTY)
smpi_group_unuse(group);
}
@@
-85,12
+86,12
@@
void smpi_group_set_mapping(MPI_Group group, int index, int rank)
if (rank < group->size) {
group->rank_to_index_map[rank] = index;
if (index!=MPI_UNDEFINED ) {
if (rank < group->size) {
group->rank_to_index_map[rank] = index;
if (index!=MPI_UNDEFINED ) {
- val_rank =
(int *) malloc(sizeof(int
));
+ val_rank =
static_cast<int *>(xbt_malloc(sizeof(int)
));
*val_rank = rank;
char * key = bprintf("%d", index);
*val_rank = rank;
char * key = bprintf("%d", index);
- xbt_dict_set(group->index_to_rank_map, key, val_rank,
NULL
);
- free(key);
+ xbt_dict_set(group->index_to_rank_map, key, val_rank,
nullptr
);
+
xbt_
free(key);
}
}
}
}
}
}
@@
-107,12
+108,14
@@
int smpi_group_index(MPI_Group group, int rank)
int smpi_group_rank(MPI_Group group, int index)
{
int smpi_group_rank(MPI_Group group, int index)
{
- int * ptr_rank = NULL;
+ int * ptr_rank = nullptr;
+ if (group==MPI_GROUP_EMPTY)
+ return MPI_UNDEFINED;
char * key = bprintf("%d", index);
ptr_rank = static_cast<int*>(xbt_dict_get_or_null(group->index_to_rank_map, key));
xbt_free(key);
char * key = bprintf("%d", index);
ptr_rank = static_cast<int*>(xbt_dict_get_or_null(group->index_to_rank_map, key));
xbt_free(key);
- if (
!ptr_rank
)
+ if (
ptr_rank==nullptr
)
return MPI_UNDEFINED;
return *ptr_rank;
}
return MPI_UNDEFINED;
return *ptr_rank;
}