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 'xbt_random' into 'master'
[simgrid.git]
/
src
/
smpi
/
colls
/
reduce_scatter
/
reduce_scatter-ompi.cpp
diff --git
a/src/smpi/colls/reduce_scatter/reduce_scatter-ompi.cpp
b/src/smpi/colls/reduce_scatter/reduce_scatter-ompi.cpp
index
4b3a479
..
79f77d7
100644
(file)
--- a/
src/smpi/colls/reduce_scatter/reduce_scatter-ompi.cpp
+++ b/
src/smpi/colls/reduce_scatter/reduce_scatter-ompi.cpp
@@
-41,22
+41,20
@@
* Returns: - MPI_SUCCESS or error code
* Limitation: - Works only for commutative operations.
*/
* Returns: - MPI_SUCCESS or error code
* Limitation: - Works only for commutative operations.
*/
-namespace simgrid{
-namespace smpi{
-int
-Coll_reduce_scatter_ompi_basic_recursivehalving::reduce_scatter(const void *sbuf,
- void *rbuf,
- const int *rcounts,
- MPI_Datatype dtype,
- MPI_Op op,
- MPI_Comm comm
- )
+namespace simgrid {
+namespace smpi {
+int reduce_scatter__ompi_basic_recursivehalving(const void *sbuf,
+ void *rbuf,
+ const int *rcounts,
+ MPI_Datatype dtype,
+ MPI_Op op,
+ MPI_Comm comm
+ )
{
int i, rank, size, count, err = MPI_SUCCESS;
int tmp_size = 1, remain = 0, tmp_rank;
ptrdiff_t true_lb, true_extent, lb, extent, buf_size;
{
int i, rank, size, count, err = MPI_SUCCESS;
int tmp_size = 1, remain = 0, tmp_rank;
ptrdiff_t true_lb, true_extent, lb, extent, buf_size;
- char *recv_buf = NULL, *recv_buf_free = NULL;
- char *result_buf = NULL, *result_buf_free = NULL;
+ unsigned char *result_buf = nullptr, *result_buf_free = nullptr;
/* Initialize */
rank = comm->rank();
/* Initialize */
rank = comm->rank();
@@
-64,7
+62,8
@@
Coll_reduce_scatter_ompi_basic_recursivehalving::reduce_scatter(const void *sbuf
XBT_DEBUG("coll:tuned:reduce_scatter_ompi_basic_recursivehalving, rank %d", rank);
if ((op != MPI_OP_NULL && not op->is_commutative()))
XBT_DEBUG("coll:tuned:reduce_scatter_ompi_basic_recursivehalving, rank %d", rank);
if ((op != MPI_OP_NULL && not op->is_commutative()))
- THROWF(arg_error,0, " reduce_scatter ompi_basic_recursivehalving can only be used for commutative operations! ");
+ throw std::invalid_argument(
+ "reduce_scatter ompi_basic_recursivehalving can only be used for commutative operations!");
/* Find displacements and the like */
int* disps = new int[size];
/* Find displacements and the like */
int* disps = new int[size];
@@
-92,17
+91,15
@@
Coll_reduce_scatter_ompi_basic_recursivehalving::reduce_scatter(const void *sbuf
}
/* Allocate temporary receive buffer. */
}
/* Allocate temporary receive buffer. */
- recv_buf_free = (char*) smpi_get_tmp_recvbuffer(buf_size);
-
- recv_buf = recv_buf_free - lb;
+ unsigned char* recv_buf_free = smpi_get_tmp_recvbuffer(buf_size);
+ unsigned char* recv_buf = recv_buf_free - lb;
if (NULL == recv_buf_free) {
err = MPI_ERR_OTHER;
goto cleanup;
}
/* allocate temporary buffer for results */
if (NULL == recv_buf_free) {
err = MPI_ERR_OTHER;
goto cleanup;
}
/* allocate temporary buffer for results */
- result_buf_free = (char*) smpi_get_tmp_sendbuffer(buf_size);
-
+ result_buf_free = smpi_get_tmp_sendbuffer(buf_size);
result_buf = result_buf_free - lb;
/* copy local buffer into the temporary results */
result_buf = result_buf_free - lb;
/* copy local buffer into the temporary results */
@@
-350,17
+347,16
@@
Coll_reduce_scatter_ompi_basic_recursivehalving::reduce_scatter(const void *sbuf
* DONE :)
*
*/
* DONE :)
*
*/
-int
-Coll_reduce_scatter_ompi_ring::reduce_scatter(const void *sbuf, void *rbuf, const int *rcounts,
- MPI_Datatype dtype,
- MPI_Op op,
- MPI_Comm comm
- )
+int reduce_scatter__ompi_ring(const void *sbuf, void *rbuf, const int *rcounts,
+ MPI_Datatype dtype,
+ MPI_Op op,
+ MPI_Comm comm
+ )
{
int ret, line, rank, size, i, k, recv_from, send_to, total_count, max_block_count;
int inbi;
{
int ret, line, rank, size, i, k, recv_from, send_to, total_count, max_block_count;
int inbi;
- char *tmpsend = NULL, *tmprecv = NULL, *accumbuf = NULL, *accumbuf_free = NULL;
- char *inbuf_free[2] = {NULL, NULL}, *inbuf[2] = {NULL, NULL};
+
unsigned
char *tmpsend = NULL, *tmprecv = NULL, *accumbuf = NULL, *accumbuf_free = NULL;
+
unsigned
char *inbuf_free[2] = {NULL, NULL}, *inbuf[2] = {NULL, NULL};
ptrdiff_t true_lb, true_extent, lb, extent, max_real_segsize;
MPI_Request reqs[2] = {NULL, NULL};
ptrdiff_t true_lb, true_extent, lb, extent, max_real_segsize;
MPI_Request reqs[2] = {NULL, NULL};
@@
-404,17
+400,21
@@
Coll_reduce_scatter_ompi_ring::reduce_scatter(const void *sbuf, void *rbuf, cons
max_real_segsize = true_extent + (ptrdiff_t)(max_block_count - 1) * extent;
max_real_segsize = true_extent + (ptrdiff_t)(max_block_count - 1) * extent;
- accumbuf_free =
(char*)
smpi_get_tmp_recvbuffer(true_extent + (ptrdiff_t)(total_count - 1) * extent);
+ accumbuf_free = smpi_get_tmp_recvbuffer(true_extent + (ptrdiff_t)(total_count - 1) * extent);
if (NULL == accumbuf_free) { ret = -1; line = __LINE__; goto error_hndl; }
accumbuf = accumbuf_free - lb;
if (NULL == accumbuf_free) { ret = -1; line = __LINE__; goto error_hndl; }
accumbuf = accumbuf_free - lb;
- inbuf_free[0] =
(char*)
smpi_get_tmp_sendbuffer(max_real_segsize);
+ inbuf_free[0] = smpi_get_tmp_sendbuffer(max_real_segsize);
if (NULL == inbuf_free[0]) { ret = -1; line = __LINE__; goto error_hndl; }
inbuf[0] = inbuf_free[0] - lb;
if (size > 2) {
if (NULL == inbuf_free[0]) { ret = -1; line = __LINE__; goto error_hndl; }
inbuf[0] = inbuf_free[0] - lb;
if (size > 2) {
- inbuf_free[1] = (char*)smpi_get_tmp_sendbuffer(max_real_segsize);
- if (NULL == inbuf_free[1]) { ret = -1; line = __LINE__; goto error_hndl; }
- inbuf[1] = inbuf_free[1] - lb;
+ inbuf_free[1] = smpi_get_tmp_sendbuffer(max_real_segsize);
+ if (NULL == inbuf_free[1]) {
+ ret = -1;
+ line = __LINE__;
+ goto error_hndl;
+ }
+ inbuf[1] = inbuf_free[1] - lb;
}
/* Handle MPI_IN_PLACE for size > 1 */
}
/* Handle MPI_IN_PLACE for size > 1 */
@@
-439,7
+439,7
@@
Coll_reduce_scatter_ompi_ring::reduce_scatter(const void *sbuf, void *rbuf, cons
- wait on block (r)
- compute on block (r)
- copy block (r) to rbuf
- wait on block (r)
- compute on block (r)
- copy block (r) to rbuf
- Note that we must be careful when computing the begining of buffers and
+ Note that we must be careful when computing the begin
n
ing of buffers and
for send operations and computation we must compute the exact block size.
*/
send_to = (rank + 1) % size;
for send operations and computation we must compute the exact block size.
*/
send_to = (rank + 1) % size;