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]
/
teshsuite
/
smpi
/
allreduce_coll.c
diff --git
a/teshsuite/smpi/allreduce_coll.c
b/teshsuite/smpi/allreduce_coll.c
index
a2c9921
..
e2953f9
100644
(file)
--- a/
teshsuite/smpi/allreduce_coll.c
+++ b/
teshsuite/smpi/allreduce_coll.c
@@
-1,4
+1,4
@@
-/* Copyright (c) 2009
, 2010
. The SimGrid Team.
+/* Copyright (c) 2009
-2010, 2013-2014
. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
@@
-15,6
+15,8
@@
#define EXIT_FAILURE 1
#endif
#define EXIT_FAILURE 1
#endif
+//define MAXLEN 300000
+
int main(int argc, char *argv[])
{
int rank, size;
int main(int argc, char *argv[])
{
int rank, size;
@@
-22,28
+24,31
@@
int main(int argc, char *argv[])
int *sb;
int *rb;
int status;
int *sb;
int *rb;
int status;
+ int mult=1;
MPI_Init(&argc, &argv);
MPI_Init(&argc, &argv);
+ int maxlen = argc >= 2 ? atoi(argv[1]) : 1;
+
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
-
- sb = (int *) xbt_malloc(size * sizeof(int));
- rb = (int *) xbt_malloc(size * sizeof(int));
+ if (maxlen>1)mult=size;
+ sb = (int *) xbt_malloc(size *
maxlen *
sizeof(int));
+ rb = (int *) xbt_malloc(size *
maxlen *
sizeof(int));
- for (i = 0; i < size; ++i) {
+ for (i = 0; i < size
*maxlen
; ++i) {
sb[i] = rank*size + i;
rb[i] = 0;
}
printf("[%d] sndbuf=[", rank);
sb[i] = rank*size + i;
rb[i] = 0;
}
printf("[%d] sndbuf=[", rank);
- for (i = 0; i < size; i++)
+ for (i = 0; i < size
*mult
; i++)
printf("%d ", sb[i]);
printf("]\n");
printf("%d ", sb[i]);
printf("]\n");
- status = MPI_Allreduce(sb, rb, size, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+ status = MPI_Allreduce(sb, rb, size
*maxlen
, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
printf("[%d] rcvbuf=[", rank);
printf("[%d] rcvbuf=[", rank);
- for (i =
0; i < size; i++)
+ for (i =
0; i < size *mult; i++)//do not print everything
printf("%d ", rb[i]);
printf("]\n");
printf("%d ", rb[i]);
printf("]\n");