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
Add Reduce SMP collective from MVAPICH2
[simgrid.git]
/
src
/
smpi
/
colls
/
reduce-scatter-gather.c
diff --git
a/src/smpi/colls/reduce-scatter-gather.c
b/src/smpi/colls/reduce-scatter-gather.c
index
2c61d48
..
30d5e6e
100644
(file)
--- a/
src/smpi/colls/reduce-scatter-gather.c
+++ b/
src/smpi/colls/reduce-scatter-gather.c
@@
-1,3
+1,9
@@
+/* Copyright (c) 2013-2014. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
#include "colls_private.h"
/*
#include "colls_private.h"
/*
@@
-15,7
+21,7
@@
int smpi_coll_tuned_reduce_scatter_gather(void *sendbuf, void *recvbuf,
int recv_idx, last_idx = 0, newdst;
int dst, send_cnt, recv_cnt, newroot, newdst_tree_root;
int newroot_tree_root, new_count;
int recv_idx, last_idx = 0, newdst;
int dst, send_cnt, recv_cnt, newroot, newdst_tree_root;
int newroot_tree_root, new_count;
- int tag =
4321
;
+ int tag =
COLL_TAG_REDUCE
;
void *send_ptr, *recv_ptr, *tmp_buf;
cnts = NULL;
void *send_ptr, *recv_ptr, *tmp_buf;
cnts = NULL;
@@
-27,9
+33,15
@@
int smpi_coll_tuned_reduce_scatter_gather(void *sendbuf, void *recvbuf,
return 0;
rank = smpi_comm_rank(comm);
comm_size = smpi_comm_size(comm);
return 0;
rank = smpi_comm_rank(comm);
comm_size = smpi_comm_size(comm);
+
- extent = smpi_datatype_get_extent(datatype);
+ extent = smpi_datatype_get_extent(datatype);
+ /* If I'm not the root, then my recvbuf may not be valid, therefore
+ I have to allocate a temporary one */
+ if (rank != root && !recvbuf) {
+ recvbuf = (void *)xbt_malloc(count * extent);
+ }
/* find nearest power-of-two less than or equal to comm_size */
pof2 = 1;
while (pof2 <= comm_size)
/* find nearest power-of-two less than or equal to comm_size */
pof2 = 1;
while (pof2 <= comm_size)
@@
-216,7
+228,7
@@
int smpi_coll_tuned_reduce_scatter_gather(void *sendbuf, void *recvbuf,
}
}
- else
if (count >= comm_size)
{
+ else
/* (count >= comm_size) */
{
tmp_buf = (void *) xbt_malloc(count * extent);
//if ((rank != root))
tmp_buf = (void *) xbt_malloc(count * extent);
//if ((rank != root))
@@
-387,6
+399,8
@@
int smpi_coll_tuned_reduce_scatter_gather(void *sendbuf, void *recvbuf,
}
}
}
}
}
}
+ if (tmp_buf)
+ free(tmp_buf);
if (cnts)
free(cnts);
if (disps)
if (cnts)
free(cnts);
if (disps)