1
1
openmpi/src/mca/topo/base/topo_base_graph_create.c

73 строки
2.0 KiB
C
Исходник Обычный вид История

/*
* $HEADER$
*/
#include "ompi_config.h"
#include "mca/topo/base/base.h"
#include "communicator/communicator.h"
#include "mca/topo/topo.h"
/*
*
* function - makes a new communicator to which topology information
* has been attached
*
* @param comm_old input communicator without topology (handle)
* @param nnodes number of nodes in graph (integer)
* @param index array of integers describing node degrees (see below)
* @param edges array of integers describing graph edges (see below)
* @param reorder ranking may be reordered (true) or not (false) (logical)
* @param comm_graph communicator with graph topology added (handle)
*
* @retval MPI_SUCCESS
* @retval MPI_ERR_OUT_OF_RESOURCE
*/
- massive change for module<-->component name fixes throughout the code base. - many (most) mca type names have "component" or "module" in them, as relevant, just to further distinguish the difference between component data/actions and module data/actions. All developers are encouraged to perpetuate this convention when you create types that are specific to a framework, component, or module - did very little to entire framework (just the basics to make it compile) because it's just about to be almost entirely replaced - ditto for io / romio - did not work on elan or ib components; have to commit and then convert those on a different machine with the right libraries and headers - renamed a bunch of *_module.c files to *_component.c and *module*c to *component*c (a few still remain, e.g., ptl/ib, ptl/elan, etc.) - modified autogen/configure/build process to match new filenames (e.g., output static-components.h instead of static-modules.h) - removed DOS-style cr/lf stuff in ns/ns.h - added newline to end of file src/util/numtostr.h - removed some redundant error checking in the top-level topo functions - added a few {} here and there where people "forgot" to put them in for 1 line blocks ;-) - removed a bunch of MPI_* types from mca header files (replaced with corresponding ompi_* types) - all the ptl components had version numbers in their structs; removed - converted a few more elements in the MCA base to use the OBJ interface -- removed some old manual reference counting kruft This commit was SVN r1830.
2004-08-02 04:24:22 +04:00
int mca_topo_base_graph_create (mca_topo_base_comm_t *topo_data,
int *proc_count,
ompi_proc_t **proc_pointers,
int *new_rank,
int nnodes,
int *index,
int *edges,
bool reorder)
{
int nedges;
int i;
int *p;
/* check if the number of nodes is more than the number of procs */
if (nnodes > *proc_count) {
return MPI_ERR_DIMS;
}
/* Create and error check the topology information */
nedges = topo_data->mtc_dims_or_index[nnodes-1];
/* Check if there are any negative values on the edges */
p = topo_data->mtc_periods_or_edges;
for (i = 0; i < nedges; ++i, ++p) {
if (*p < 0 || *p >= nnodes) {
return MPI_ERR_TOPOLOGY;
}
}
/* if the graph does not have to be trimmed, then nothing has to change */
if (nnodes < *proc_count) {
*proc_count = nnodes;
}
/* check if this rank makes the cut. if it does not return -1 */
if (*new_rank > (nnodes-1)) {
/* sorry but in our scheme, you are out */
*new_rank = MPI_UNDEFINED;
return MPI_SUCCESS;
}
return(MPI_SUCCESS);
}