-: 0:Source:/home/MPI/testing/mpich2/mpich2/src/mpi/topo/graph_map.c
-: 0:Graph:graph_map.gcno
-: 0:Data:graph_map.gcda
-: 0:Runs:615
-: 0:Programs:166
-: 1:/* -*- Mode: C; c-basic-offset:4 ; -*- */
-: 2:/*
-: 3: *
-: 4: * (C) 2001 by Argonne National Laboratory.
-: 5: * See COPYRIGHT in top-level directory.
-: 6: */
-: 7:
-: 8:#include "mpiimpl.h"
-: 9:#include "topo.h"
-: 10:
-: 11:/* -- Begin Profiling Symbol Block for routine MPI_Graph_map */
-: 12:#if defined(HAVE_PRAGMA_WEAK)
-: 13:#pragma weak MPI_Graph_map = PMPI_Graph_map
-: 14:#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
-: 15:#pragma _HP_SECONDARY_DEF PMPI_Graph_map MPI_Graph_map
-: 16:#elif defined(HAVE_PRAGMA_CRI_DUP)
-: 17:#pragma _CRI duplicate MPI_Graph_map as PMPI_Graph_map
-: 18:#endif
-: 19:/* -- End Profiling Symbol Block */
-: 20:
-: 21:/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
-: 22: the MPI routines */
-: 23:#ifndef MPICH_MPI_FROM_PMPI
-: 24:#undef MPI_Graph_map
-: 25:#define MPI_Graph_map PMPI_Graph_map
-: 26:int MPIR_Graph_map( const MPID_Comm *comm_ptr, int nnodes,
-: 27: const int indx[] ATTRIBUTE((unused)),
-: 28: const int edges[] ATTRIBUTE((unused)), int *newrank )
80: 29:{
-: 30: MPIU_UNREFERENCED_ARG(indx);
-: 31: MPIU_UNREFERENCED_ARG(edges);
-: 32:
-: 33: /* This is the trivial version that does not remap any processes. */
80: 34: if (comm_ptr->rank < nnodes) {
76: 35: *newrank = comm_ptr->rank;
-: 36: }
-: 37: else {
4: 38: *newrank = MPI_UNDEFINED;
-: 39: }
80: 40: return MPI_SUCCESS;
-: 41:}
-: 42:#endif
-: 43:
-: 44:#undef FUNCNAME
-: 45:#define FUNCNAME MPI_Graph_map
-: 46:
-: 47:/*@
-: 48:MPI_Graph_map - Maps process to graph topology information
-: 49:
-: 50:Input Parameters:
-: 51:+ comm - input communicator (handle)
-: 52:. nnodes - number of graph nodes (integer)
-: 53:. indx - integer array specifying the graph structure, see 'MPI_GRAPH_CREATE'
-: 54:- edges - integer array specifying the graph structure
-: 55:
-: 56:Output Parameter:
-: 57:. newrank - reordered rank of the calling process; 'MPI_UNDEFINED' if the
-: 58:calling process does not belong to graph (integer)
-: 59:
-: 60:.N SignalSafe
-: 61:
-: 62:.N Fortran
-: 63:
-: 64:.N Errors
-: 65:.N MPI_SUCCESS
-: 66:.N MPI_ERR_TOPOLOGY
-: 67:.N MPI_ERR_COMM
-: 68:.N MPI_ERR_ARG
-: 69:@*/
-: 70:int MPI_Graph_map(MPI_Comm comm_old, int nnodes, int *indx, int *edges,
-: 71: int *newrank)
83: 72:{
-: 73: static const char FCNAME[] = "MPI_Graph_map";
83: 74: int mpi_errno = MPI_SUCCESS;
83: 75: MPID_Comm *comm_ptr = NULL;
-: 76: MPID_MPI_STATE_DECL(MPID_STATE_MPI_GRAPH_MAP);
-: 77:
83: 78: MPIR_ERRTEST_INITIALIZED_ORDIE();
-: 79:
-: 80: MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GRAPH_MAP);
-: 81:
-: 82: /* Validate parameters, especially handles needing to be converted */
|
-: 83:# ifdef HAVE_ERROR_CHECKING
-: 84: {
-: 85: MPID_BEGIN_ERROR_CHECKS;
-: 86: {
83: 87: MPIR_ERRTEST_COMM(comm_old, mpi_errno);
83: 88: if (mpi_errno != MPI_SUCCESS) goto fn_fail;
-: 89: }
-: 90: MPID_END_ERROR_CHECKS;
-: 91: }
-: 92:# endif
-: 93:
-: 94: /* Convert MPI object handles to object pointers */
|
82: 95: MPID_Comm_get_ptr( comm_old, comm_ptr );
-: 96:
-: 97: /* Validate parameters and objects (post conversion) */
|
-: 98:# ifdef HAVE_ERROR_CHECKING
-: 99: {
-: 100: MPID_BEGIN_ERROR_CHECKS;
-: 101: {
-: 102: /* Validate comm_ptr */
82: 103: MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
-: 104: /* If comm_ptr is not valid, it will be reset to null */
82: 105: MPIR_ERRTEST_ARGNULL(newrank,"newrank",mpi_errno);
82: 106: MPIR_ERRTEST_ARGNULL(indx,"indx",mpi_errno);
82: 107: MPIR_ERRTEST_ARGNULL(edges,"edges",mpi_errno);
82: 108: MPIR_ERRTEST_ARGNONPOS(nnodes,"nnodes",mpi_errno);
82: 109: if (mpi_errno) goto fn_fail;
-: 110: }
-: 111: MPID_END_ERROR_CHECKS;
-: 112: }
-: 113:# endif /* HAVE_ERROR_CHECKING */
-: 114:
-: 115: /* ... body of routine ... */
-: 116:
|
81: 117: MPIU_ERR_CHKANDJUMP(comm_ptr->local_size < nnodes,mpi_errno,MPI_ERR_ARG,
-: 118: "**graphnnodes");
-: 119:
80: 120: if (comm_ptr->topo_fns != NULL && comm_ptr->topo_fns->graphMap != NULL) {
|
#####: 121: mpi_errno = comm_ptr->topo_fns->graphMap( comm_ptr, nnodes,
-: 122: (const int*) indx,
-: 123: (const int*) edges,
-: 124: newrank );
-: 125: }
-: 126: else {
|
80: 127: mpi_errno = MPIR_Graph_map( comm_ptr, nnodes,
-: 128: (const int*) indx,
-: 129: (const int*) edges, newrank );
-: 130: }
-: 131: /* ... end of body of routine ... */
-: 132:
83: 133: fn_exit:
|
-: 134: MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GRAPH_MAP);
|
83: 135: return mpi_errno;
-: 136:
|
3: 137: fn_fail:
-: 138: /* --BEGIN ERROR HANDLING-- */
-: 139:# ifdef HAVE_ERROR_CHECKING
-: 140: {
3: 141: mpi_errno = MPIR_Err_create_code(
-: 142: mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
-: 143: "**mpi_graph_map",
-: 144: "**mpi_graph_map %C %d %p %p %p", comm_old, nnodes, indx, edges,
-: 145: newrank);
-: 146: }
-: 147:# endif
3: 148: mpi_errno = MPIR_Err_return_comm( comm_ptr, FCNAME, mpi_errno );
3: 149: goto fn_exit;
-: 150: /* --END ERROR HANDLING-- */
-: 151:}
|