1
1

adding graph_map and cart_map. Also had to make some changes in header files. Pushed all teh required headers into topo_unity.h

This commit was SVN r837.
Этот коммит содержится в:
Prabhanjan Kambadur 2004-03-08 04:06:44 +00:00
родитель 848e690783
Коммит 7ec818d7d9
5 изменённых файлов: 111 добавлений и 8 удалений

Просмотреть файл

@ -10,6 +10,7 @@
#include "mpi.h"
#include "mca/mca.h"
#include "mca/mpi/base/base.h"
#include "mpi/communicator/communicator.h"
/*
* ******************************************************************

Просмотреть файл

@ -0,0 +1,68 @@
/*
* $HEADER$
*/
#include "mca/mpi/topo/unity/topo_unity.h"
/*
* function - mca_topo_unity_cart_map
*
* @param comm input communicator (handle)
* @param ndims number of dimensions of cartesian structure (integer)
* @param dims integer array of size 'ndims' specifying the number of
* processes in each coordinate direction
* @param periods logical array of size 'ndims' specifying the
* periodicity specification in each coordinate direction
* @param newrank reordered rank of the calling process; 'MPI_UNDEFINED'
* if calling process does not belong to grid (integer)
*
* @retval MPI_SUCCESS
* @retval MPI_ERR_DIMS
*/
int mca_topo_unity_cart_map (lam_communicator_t *comm,
int ndims,
int *dims,
int *periods,
int *newrank){
int nprocs;
int rank;
int size;
int errcode;
int i;
int *p;
/*
* Compute the # of processes in the grid.
*/
nprocs = 1;
for (i = 0, p = dims; i < ndims; ++i, ++p) {
if (*p <= 0) {
printf ("the dimensions are wrong\n");
return MPI_ERR_DIMS;
}
nprocs *= *p;
}
/*
* Check that number of processes <= size of communicator.
*/
errcode = lam_comm_size (comm, &size);
if (errcode != MPI_SUCCESS) {
return errcode;
}
if (nprocs > size) {
printf ("the dimensions are wrong\n");
return MPI_ERR_DIMS;
}
/*
* Compute my new rank.
*/
errcode = lam_comm_rank (comm, &rank);
if (errcode != MPI_SUCCESS) {
printf ("failed to get a comm rank\n");
return errcode;
}
*newrank = ((rank < 0) || (rank >= nprocs)) ? MPI_UNDEFINED : rank;
return MPI_SUCCESS;
}

Просмотреть файл

@ -0,0 +1,40 @@
/*
* $HEADER$
*/
#include "mca/mpi/topo/unity/topo_unity.h"
/*
* function - mca_topo_unity_graph_map
*
* @param comm input communicator (handle)
* @param nnodes number of graph nodes (integer)
* @param index integer array specifying the graph structure
* @param edges integer array specifying the graph structure
* @param newrank reordered rank of the calling process; 'MPI_UNDEFINED'
* if the calling process does not belong to
* graph (integer)
*
* @retval MPI_SUCCESS
* @retval MPI_UNDEFINED
*/
int mca_topo_unity_graph_map (lam_communicator_t *comm,
int nnodes,
int *index,
int *edges,
int *newrank){
int errcode;
int myrank;
errcode = lam_comm_rank (comm, &myrank);
if (MPI_SUCCESS != errcode) {
printf ("failed to get a comm rank\n");
return MPI_ERROR;
}
*newrank =
((0 > myrank) || (myrank >= nnodes)) ? MPI_UNDEFINED : myrank;
return MPI_SUCCESS;
}

Просмотреть файл

@ -1,10 +1,7 @@
/*
* $HEADER$
*/
#include "lam_config.h"
#include "mca/mpi/topo/topo.h"
#include "mca/mpi/topo/base/base.h"
#include "mca/mpi/topo/unity/topo_unity.h"
/*
* Init on the communicator. This function is called once the

Просмотреть файл

@ -8,10 +8,7 @@
* modules just to query their version and parameters
*/
#include "lam_config.h"
#include "mpi.h"
#include "mca/mpi/topo/topo.h"
#include "topo_unity,h"
#include "mca/mpi/topo/unity/topo_unity,h"
/*
* Public string showing the topo unity module version number