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
Update copyright lines for 2023.
[simgrid.git]
/
src
/
smpi
/
colls
/
allreduce
/
allreduce-rab2.cpp
diff --git
a/src/smpi/colls/allreduce/allreduce-rab2.cpp
b/src/smpi/colls/allreduce/allreduce-rab2.cpp
index
0a45358
..
a66a765
100644
(file)
--- a/
src/smpi/colls/allreduce/allreduce-rab2.cpp
+++ b/
src/smpi/colls/allreduce/allreduce-rab2.cpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2013-20
19
. The SimGrid Team.
+/* Copyright (c) 2013-20
23
. 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
@@
-7,17
+7,15
@@
#include "../colls_private.hpp"
//#include <star-reduction.c>
#include "../colls_private.hpp"
//#include <star-reduction.c>
-namespace simgrid{
-namespace smpi{
+namespace simgrid::smpi {
// this requires that count >= NP
// this requires that count >= NP
-int
Coll_allreduce_rab2::allreduce
(const void *sbuff, void *rbuff,
-
int count, MPI_Datatype dtype,
-
MPI_Op op, MPI_Comm comm)
+int
allreduce__rab2
(const void *sbuff, void *rbuff,
+ int count, MPI_Datatype dtype,
+ MPI_Op op, MPI_Comm comm)
{
MPI_Aint s_extent;
int i, rank, nprocs;
int nbytes, send_size, s_offset, r_offset;
{
MPI_Aint s_extent;
int i, rank, nprocs;
int nbytes, send_size, s_offset, r_offset;
- void *recv, *send, *tmp;
/*
#ifdef MPICH2_REDUCTION
MPI_User_function * uop = MPIR_Op_table[op % 16 - 1];
/*
#ifdef MPICH2_REDUCTION
MPI_User_function * uop = MPIR_Op_table[op % 16 - 1];
@@
-42,47
+40,46
@@
int Coll_allreduce_rab2::allreduce(const void *sbuff, void *rbuff,
send_size = (count + nprocs) / nprocs;
nbytes = send_size * s_extent;
send_size = (count + nprocs) / nprocs;
nbytes = send_size * s_extent;
-
send = (void *)
smpi_get_tmp_sendbuffer(s_extent * send_size * nprocs);
-
recv = (void *)
smpi_get_tmp_recvbuffer(s_extent * send_size * nprocs);
-
tmp = (void *)
smpi_get_tmp_sendbuffer(nbytes);
+
unsigned char* send =
smpi_get_tmp_sendbuffer(s_extent * send_size * nprocs);
+
unsigned char* recv =
smpi_get_tmp_recvbuffer(s_extent * send_size * nprocs);
+
unsigned char* tmp =
smpi_get_tmp_sendbuffer(nbytes);
memcpy(send, sbuff, s_extent * count);
memcpy(send, sbuff, s_extent * count);
-
C
olls::alltoall(send, send_size, dtype, recv, send_size, dtype, comm);
+
c
olls::alltoall(send, send_size, dtype, recv, send_size, dtype, comm);
memcpy(tmp, recv, nbytes);
for (i = 1, s_offset = nbytes; i < nprocs; i++, s_offset = i * nbytes)
memcpy(tmp, recv, nbytes);
for (i = 1, s_offset = nbytes; i < nprocs; i++, s_offset = i * nbytes)
- if(op!=MPI_OP_NULL) op->apply( (char *) recv + s_offset, tmp, &send_size, dtype);
+ if (op != MPI_OP_NULL)
+ op->apply(recv + s_offset, tmp, &send_size, dtype);
-
C
olls::allgather(tmp, send_size, dtype, recv, send_size, dtype, comm);
+
c
olls::allgather(tmp, send_size, dtype, recv, send_size, dtype, comm);
memcpy(rbuff, recv, count * s_extent);
smpi_free_tmp_buffer(recv);
smpi_free_tmp_buffer(tmp);
smpi_free_tmp_buffer(send);
} else {
memcpy(rbuff, recv, count * s_extent);
smpi_free_tmp_buffer(recv);
smpi_free_tmp_buffer(tmp);
smpi_free_tmp_buffer(send);
} else {
-
send = const_cast<void*>(sbuff)
;
+
const void* send = sbuff
;
send_size = count / nprocs;
nbytes = send_size * s_extent;
r_offset = rank * nbytes;
send_size = count / nprocs;
nbytes = send_size * s_extent;
r_offset = rank * nbytes;
-
recv = (void *)
smpi_get_tmp_recvbuffer(s_extent * send_size * nprocs);
+
unsigned char* recv =
smpi_get_tmp_recvbuffer(s_extent * send_size * nprocs);
-
C
olls::alltoall(send, send_size, dtype, recv, send_size, dtype, comm);
+
c
olls::alltoall(send, send_size, dtype, recv, send_size, dtype, comm);
memcpy((char *) rbuff + r_offset, recv, nbytes);
for (i = 1, s_offset = nbytes; i < nprocs; i++, s_offset = i * nbytes)
memcpy((char *) rbuff + r_offset, recv, nbytes);
for (i = 1, s_offset = nbytes; i < nprocs; i++, s_offset = i * nbytes)
- if
(op!=MPI_OP_NULL) op->apply( (char *) recv + s_offset, (char *) rbuff + r_offset,
-
&send_size, dtype);
+ if
(op != MPI_OP_NULL)
+
op->apply(recv + s_offset, static_cast<char*>(rbuff) + r_offset,
&send_size, dtype);
- Colls::allgather((char *) rbuff + r_offset, send_size, dtype, rbuff, send_size,
- dtype, comm);
+ colls::allgather((char*)rbuff + r_offset, send_size, dtype, rbuff, send_size, dtype, comm);
smpi_free_tmp_buffer(recv);
}
return MPI_SUCCESS;
}
smpi_free_tmp_buffer(recv);
}
return MPI_SUCCESS;
}
-}
-}
+} // namespace simgrid::smpi