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
minor changes to comm_split code.
[simgrid.git]
/
src
/
smpi
/
smpi_mpi.c
diff --git
a/src/smpi/smpi_mpi.c
b/src/smpi/smpi_mpi.c
index
7d7ccf4
..
c213d45
100644
(file)
--- a/
src/smpi/smpi_mpi.c
+++ b/
src/smpi/smpi_mpi.c
@@
-222,55
+222,50
@@
int SMPI_MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *comm_out)
rank = comm->index_to_rank_map[index];
if (0 == rank) {
rank = comm->index_to_rank_map[index];
if (0 == rank) {
- int *color
s
= xbt_new(int, comm->size);
- int *key
s
= xbt_new(int, comm->size);
+ int *color = xbt_new(int, comm->size);
+ int *key = xbt_new(int, comm->size);
int i, j, k;
smpi_mpi_communicator_t tempcomm = NULL;
int colortmp;
int keycount;
int i, j, k;
smpi_mpi_communicator_t tempcomm = NULL;
int colortmp;
int keycount;
- int *keystmp = xbt_new(int, comm->size);
- int *rankstmp = xbt_new(int, comm->size);
+ int *rankmap = xbt_new(int, comm->size);
int tmpval;
int indextmp;
int tmpval;
int indextmp;
- color
s
[0] = color;
- key
s
[0] = key;
+ color[0] = color;
+ key[0] = key;
- // FIXME:
not efficient
+ // FIXME:
use scatter/gather or similar instead of individual comms
for (i = 1; i < comm->size; i++) {
for (i = 1; i < comm->size; i++) {
- retval = smpi_create_request(colorkey, 2, MPI_INT, MPI_ANY_SOURCE, rank, MPI_ANY_TAG, comm, &request);
+ retval = smpi_create_request(colorkey, 2, MPI_INT, MPI_ANY_SOURCE,
+ rank, MPI_ANY_TAG, comm, &request);
smpi_mpi_irecv(request);
smpi_mpi_wait(request, &status);
smpi_mpi_irecv(request);
smpi_mpi_wait(request, &status);
- color
s
[status.MPI_SOURCE] = colorkey[0];
- key
s
[status.MPI_SOURCE] = colorkey[1];
+ color[status.MPI_SOURCE] = colorkey[0];
+ key[status.MPI_SOURCE] = colorkey[1];
xbt_mallocator_release(smpi_global->request_mallocator, request);
}
for (i = 0; i < comm->size; i++) {
xbt_mallocator_release(smpi_global->request_mallocator, request);
}
for (i = 0; i < comm->size; i++) {
- if (-1 == color
s
[i]) {
+ if (-1 == color[i]) {
continue;
}
continue;
}
- colortmp = color
s
[i];
+ colortmp = color[i];
keycount = 0;
for (j = i; j < comm->size; j++) {
keycount = 0;
for (j = i; j < comm->size; j++) {
- if(colortmp == colors[j]) {
- colors[j] = -1;
- keystmp[keycount] = keys[j];
- rankstmp[keycount] = j;
+ if(colortmp == color[j]) {
+ color[j] = -1;
+ rankmap[keycount] = j;
keycount++;
}
}
// FIXME: yes, mock me, bubble sort...
for (j = 0; j < keycount; j++) {
for (k = j; k < keycount - 1; k++) {
keycount++;
}
}
// FIXME: yes, mock me, bubble sort...
for (j = 0; j < keycount; j++) {
for (k = j; k < keycount - 1; k++) {
- if (keystmp[k] > keystmp[k + 1]) {
- tmpval = keystmp[k];
- keystmp[k] = keystmp[k + 1];
- keystmp[k + 1] = tmpval;
-
- tmpval = rankstmp[k];
- rankstmp[k] = rankstmp[k + 1];
- rankstmp[k + 1] = tmpval;
+ if (key[rankmap[k]] > key[rankmap[k + 1]]) {
+ tmpval = rankmap[k];
+ rankmap[k] = rankmap[k + 1];
+ rankmap[k + 1] = tmpval;
}
}
}
}
}
}
@@
-285,13
+280,13
@@
int SMPI_MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *comm_out)
tempcomm->index_to_rank_map[j] = -1;
}
for (j = 0; j < keycount; j++) {
tempcomm->index_to_rank_map[j] = -1;
}
for (j = 0; j < keycount; j++) {
- indextmp = comm->rank_to_index_map[rank
stm
p[j]];
+ indextmp = comm->rank_to_index_map[rank
ma
p[j]];
tempcomm->rank_to_index_map[j] = indextmp;
tempcomm->index_to_rank_map[indextmp] = j;
}
for (j = 0; j < keycount; j++) {
tempcomm->rank_to_index_map[j] = indextmp;
tempcomm->index_to_rank_map[indextmp] = j;
}
for (j = 0; j < keycount; j++) {
- if (rank
stm
p[j]) {
- retval = smpi_create_request(&j, 1, MPI_INT, 0, rank
stm
p[j], 0, comm, &request);
+ if (rank
ma
p[j]) {
+ retval = smpi_create_request(&j, 1, MPI_INT, 0, rank
ma
p[j], 0, comm, &request);
request->data = tempcomm;
smpi_mpi_isend(request);
smpi_mpi_wait(request, &status);
request->data = tempcomm;
smpi_mpi_isend(request);
smpi_mpi_wait(request, &status);