coll libnbc: Remove dead code
Remove dead code that was causing warnings about unused static functions. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
Этот коммит содержится в:
родитель
19e16d5fd0
Коммит
2e24e6ec08
@ -181,157 +181,6 @@ int ompi_coll_libnbc_ineighbor_allgather(const void *sbuf, int scount, MPI_Datat
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
/* better binomial bcast
|
||||
* working principle:
|
||||
* - each node gets a virtual rank vrank
|
||||
* - the 'root' node get vrank 0
|
||||
* - node 0 gets the vrank of the 'root'
|
||||
* - all other ranks stay identical (they do not matter)
|
||||
*
|
||||
* Algorithm:
|
||||
* - each node with vrank > 2^r and vrank < 2^r+1 receives from node
|
||||
* vrank - 2^r (vrank=1 receives from 0, vrank 0 receives never)
|
||||
* - each node sends each round r to node vrank + 2^r
|
||||
* - a node stops to send if 2^r > commsize
|
||||
*/
|
||||
#define RANK2VRANK(rank, vrank, root) \
|
||||
{ \
|
||||
vrank = rank; \
|
||||
if (rank == 0) vrank = root; \
|
||||
if (rank == root) vrank = 0; \
|
||||
}
|
||||
#define VRANK2RANK(rank, vrank, root) \
|
||||
{ \
|
||||
rank = vrank; \
|
||||
if (vrank == 0) rank = root; \
|
||||
if (vrank == root) rank = 0; \
|
||||
}
|
||||
static inline int bcast_sched_binomial(int rank, int p, int root, NBC_Schedule *schedule, void *buffer, int count, MPI_Datatype datatype) {
|
||||
int maxr, vrank, peer, res;
|
||||
|
||||
maxr = (int)ceil((log((double)p)/LOG2));
|
||||
|
||||
RANK2VRANK(rank, vrank, root);
|
||||
|
||||
/* receive from the right hosts */
|
||||
if (vrank != 0) {
|
||||
for (int r = 0 ; r < maxr ; ++r) {
|
||||
if ((vrank >= (1 << r)) && (vrank < (1 << (r + 1)))) {
|
||||
VRANK2RANK(peer, vrank - (1 << r), root);
|
||||
res = NBC_Sched_recv (buffer, false, count, datatype, peer, schedule, false);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
res = NBC_Sched_barrier (schedule);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
/* now send to the right hosts */
|
||||
for (int r = 0 ; r < maxr ; ++r) {
|
||||
if (((vrank + (1 << r) < p) && (vrank < (1 << r))) || (vrank == 0)) {
|
||||
VRANK2RANK(peer, vrank + (1 << r), root);
|
||||
res = NBC_Sched_send (buffer, false, count, datatype, peer, schedule, false);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
/* simple linear MPI_Ibcast */
|
||||
static inline int bcast_sched_linear(int rank, int p, int root, NBC_Schedule *schedule, void *buffer, int count, MPI_Datatype datatype) {
|
||||
int res;
|
||||
|
||||
/* send to all others */
|
||||
if(rank == root) {
|
||||
for (int peer = 0 ; peer < p ; ++peer) {
|
||||
if (peer != root) {
|
||||
/* send msg to peer */
|
||||
res = NBC_Sched_send (buffer, false, count, datatype, peer, schedule, false);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* recv msg from root */
|
||||
res = NBC_Sched_recv (buffer, false, count, datatype, root, schedule, false);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
/* simple chained MPI_Ibcast */
|
||||
static inline int bcast_sched_chain(int rank, int p, int root, NBC_Schedule *schedule, void *buffer, int count, MPI_Datatype datatype, int fragsize, size_t size) {
|
||||
int res, vrank, rpeer, speer, numfrag, fragcount, thiscount;
|
||||
MPI_Aint ext;
|
||||
char *buf;
|
||||
|
||||
RANK2VRANK(rank, vrank, root);
|
||||
VRANK2RANK(rpeer, vrank-1, root);
|
||||
VRANK2RANK(speer, vrank+1, root);
|
||||
res = ompi_datatype_type_extent(datatype, &ext);
|
||||
if (MPI_SUCCESS != res) {
|
||||
NBC_Error("MPI Error in ompi_datatype_type_extent() (%i)", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
numfrag = count * size/fragsize;
|
||||
if ((count * size) % fragsize != 0) {
|
||||
numfrag++;
|
||||
}
|
||||
|
||||
fragcount = count/numfrag;
|
||||
|
||||
for (int fragnum = 0 ; fragnum < numfrag ; ++fragnum) {
|
||||
buf = (char *) buffer + fragnum * fragcount * ext;
|
||||
thiscount = fragcount;
|
||||
if (fragnum == numfrag-1) {
|
||||
/* last fragment may not be full */
|
||||
thiscount = count - fragcount * fragnum;
|
||||
}
|
||||
|
||||
/* root does not receive */
|
||||
if (vrank != 0) {
|
||||
res = NBC_Sched_recv (buf, false, thiscount, datatype, rpeer, schedule, true);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
/* last rank does not send */
|
||||
if (vrank != p-1) {
|
||||
res = NBC_Sched_send (buf, false, thiscount, datatype, speer, schedule, false);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
/* this barrier here seems awaward but isn't!!!! */
|
||||
if (vrank == 0) {
|
||||
res = NBC_Sched_barrier (schedule);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
int ompi_coll_libnbc_neighbor_allgather_init(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf,
|
||||
int rcount, MPI_Datatype rtype, struct ompi_communicator_t *comm,
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user