Right file name
This commit was SVN r1042.
Этот коммит содержится в:
родитель
757d829971
Коммит
8947835c35
47
src/mca/topo/base/topo_base_graph_neighbors.c
Обычный файл
47
src/mca/topo/base/topo_base_graph_neighbors.c
Обычный файл
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "mca/topo/base/base.h"
|
||||
#include "communicator/communicator.h"
|
||||
#include "mca/topo/topo.h"
|
||||
|
||||
/*
|
||||
* function - returns the neighbors of a node associated
|
||||
* with a graph topology
|
||||
*
|
||||
* @param comm communicator with graph topology (handle)
|
||||
* @param rank rank of process in group of comm (integer)
|
||||
* @param maxneighbors size of array neighbors (integer)
|
||||
* @param neighbors ranks of processes that are neighbors to specified process
|
||||
* (array of integer)
|
||||
*
|
||||
* @retval MPI_SUCCESS
|
||||
*/
|
||||
|
||||
int topo_base_graph_neighbors (MPI_Comm comm,
|
||||
int rank,
|
||||
int maxneighbors,
|
||||
int *neighbors){
|
||||
int nnbrs;
|
||||
int i;
|
||||
int *p;
|
||||
|
||||
/*
|
||||
* Fill the neighbours.
|
||||
*/
|
||||
nnbrs = comm->c_topo_comm->mtc_index[rank];
|
||||
p = comm->c_topo_comm->mtc_edges;
|
||||
|
||||
if (rank > 0) {
|
||||
i = comm->c_topo_comm->mtc_index[rank - 1];
|
||||
nnbrs -= i;
|
||||
p += i;
|
||||
}
|
||||
|
||||
for (i = 0; (i < maxneighbors) && (i < nnbrs); ++i, ++p) {
|
||||
*neighbors++ = *p;
|
||||
}
|
||||
|
||||
return MPI_SUCCESS;
|
||||
}
|
Загрузка…
x
Ссылка в новой задаче
Block a user