1
1

Fix memory leak when releasing a communicator created by

MPI_Cart_Create/MPI_Graph_create/MPI_Dist_Graph

Fixes trac:4581

This commit was SVN r31716.

The following Trac tickets were found above:
  Ticket 4581 --> https://svn.open-mpi.org/trac/ompi/ticket/4581
Этот коммит содержится в:
Gilles Gouaillardet 2014-05-13 04:49:23 +00:00
родитель 0b8bb2339b
Коммит e3df77548d
23 изменённых файлов: 260 добавлений и 135 удалений

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

@ -4,6 +4,8 @@
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -363,22 +365,22 @@ int ompi_fill_in_type_info(mqs_image *image, char **message)
that field from the mca_topo_base_module_2_1_0_t type. */
/* Cart type */
missing_in_action = "mca_topo_base_comm_cart_2_1_0_t";
missing_in_action = "mca_topo_base_comm_cart_2_2_0_t";
cart_type = mqs_find_type(image, missing_in_action, mqs_lang_c);
if (!cart_type) {
goto type_missing;
}
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_cart.ndims,
cart_type, mca_topo_base_comm_cart_2_1_0_t,
cart_type, mca_topo_base_comm_cart_2_2_0_t,
ndims);
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_cart.dims,
cart_type, mca_topo_base_comm_cart_2_1_0_t,
cart_type, mca_topo_base_comm_cart_2_2_0_t,
dims);
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_cart.periods,
cart_type, mca_topo_base_comm_cart_2_1_0_t,
cart_type, mca_topo_base_comm_cart_2_2_0_t,
periods);
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_cart.coords,
cart_type, mca_topo_base_comm_cart_2_1_0_t,
cart_type, mca_topo_base_comm_cart_2_2_0_t,
coords);
i_info->mca_topo_base_module_t.offset.mtc_cart.ndims += offset;
i_info->mca_topo_base_module_t.offset.mtc_cart.dims += offset;
@ -386,50 +388,50 @@ int ompi_fill_in_type_info(mqs_image *image, char **message)
i_info->mca_topo_base_module_t.offset.mtc_cart.coords += offset;
/* Graph type */
missing_in_action = "mca_topo_base_comm_graph_2_1_0_t";
missing_in_action = "mca_topo_base_comm_graph_2_2_0_t";
graph_type = mqs_find_type(image, missing_in_action, mqs_lang_c);
if (!graph_type) {
goto type_missing;
}
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_graph.nnodes,
graph_type, mca_topo_base_comm_graph_2_1_0_t,
graph_type, mca_topo_base_comm_graph_2_2_0_t,
nnodes);
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_graph.index,
graph_type, mca_topo_base_comm_graph_2_1_0_t,
graph_type, mca_topo_base_comm_graph_2_2_0_t,
index);
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_graph.edges,
graph_type, mca_topo_base_comm_graph_2_1_0_t,
graph_type, mca_topo_base_comm_graph_2_2_0_t,
edges);
i_info->mca_topo_base_module_t.offset.mtc_graph.nnodes += offset;
i_info->mca_topo_base_module_t.offset.mtc_graph.index += offset;
i_info->mca_topo_base_module_t.offset.mtc_graph.edges += offset;
/* Distributed Graph type */
missing_in_action = "mca_topo_base_comm_dist_graph_2_1_0_t";
missing_in_action = "mca_topo_base_comm_dist_graph_2_2_0_t";
dist_graph_type = mqs_find_type(image, missing_in_action, mqs_lang_c);
if (!dist_graph_type) {
goto type_missing;
}
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.in,
dist_graph_type, mca_topo_base_comm_dist_graph_2_1_0_t,
dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
in);
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.inw,
dist_graph_type, mca_topo_base_comm_dist_graph_2_1_0_t,
dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
inw);
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.out,
dist_graph_type, mca_topo_base_comm_dist_graph_2_1_0_t,
dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
out);
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.outw,
dist_graph_type, mca_topo_base_comm_dist_graph_2_1_0_t,
dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
outw);
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.indegree,
dist_graph_type, mca_topo_base_comm_dist_graph_2_1_0_t,
dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
indegree);
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.outdegree,
dist_graph_type, mca_topo_base_comm_dist_graph_2_1_0_t,
dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
outdegree);
ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.weighted,
dist_graph_type, mca_topo_base_comm_dist_graph_2_1_0_t,
dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
weighted);
/* These fields are outside of the union */

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

@ -12,6 +12,8 @@
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -41,7 +43,7 @@ mca_coll_basic_neighbor_allgather_cart(const void *sbuf, int scount,
mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_cart_2_1_0_t *cart = comm->c_topo->mtc.cart;
const mca_topo_base_comm_cart_2_2_0_t *cart = comm->c_topo->mtc.cart;
const int rank = ompi_comm_rank (comm);
ompi_request_t **reqs;
ptrdiff_t lb, extent;
@ -114,7 +116,7 @@ mca_coll_basic_neighbor_allgather_graph(const void *sbuf, int scount,
mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_graph_2_1_0_t *graph = comm->c_topo->mtc.graph;
const mca_topo_base_comm_graph_2_2_0_t *graph = comm->c_topo->mtc.graph;
const int rank = ompi_comm_rank (comm);
const int *edges;
int degree;
@ -161,7 +163,7 @@ mca_coll_basic_neighbor_allgather_dist_graph(const void *sbuf, int scount,
mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_dist_graph_2_1_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
const mca_topo_base_comm_dist_graph_2_2_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
const int *inedges, *outedges;
int indegree, outdegree;
ompi_request_t **reqs;

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

@ -12,6 +12,8 @@
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -40,7 +42,7 @@ mca_coll_basic_neighbor_allgatherv_cart(const void *sbuf, int scount, struct omp
mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_cart_2_1_0_t *cart = comm->c_topo->mtc.cart;
const mca_topo_base_comm_cart_2_2_0_t *cart = comm->c_topo->mtc.cart;
const int rank = ompi_comm_rank (comm);
ompi_request_t **reqs;
ptrdiff_t lb, extent;
@ -101,7 +103,7 @@ mca_coll_basic_neighbor_allgatherv_graph(const void *sbuf, int scount, struct om
mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_graph_2_1_0_t *graph = comm->c_topo->mtc.graph;
const mca_topo_base_comm_graph_2_2_0_t *graph = comm->c_topo->mtc.graph;
const int rank = ompi_comm_rank (comm);
const int *edges;
int degree;
@ -146,7 +148,7 @@ mca_coll_basic_neighbor_allgatherv_dist_graph(const void *sbuf, int scount, stru
mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_dist_graph_2_1_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
const mca_topo_base_comm_dist_graph_2_2_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
const int *inedges, *outedges;
int indegree, outdegree;
ompi_request_t **reqs;

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

@ -12,6 +12,8 @@
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -39,7 +41,7 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_
mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_cart_2_1_0_t *cart = comm->c_topo->mtc.cart;
const mca_topo_base_comm_cart_2_2_0_t *cart = comm->c_topo->mtc.cart;
const int rank = ompi_comm_rank (comm);
ompi_request_t **reqs;
ptrdiff_t lb, rdextent, sdextent;
@ -132,7 +134,7 @@ mca_coll_basic_neighbor_alltoall_graph(const void *sbuf, int scount, struct ompi
mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_graph_2_1_0_t *graph = comm->c_topo->mtc.graph;
const mca_topo_base_comm_graph_2_2_0_t *graph = comm->c_topo->mtc.graph;
const int rank = ompi_comm_rank (comm);
int rc = MPI_SUCCESS, neighbor, degree;
ptrdiff_t lb, rdextent, sdextent;
@ -181,7 +183,7 @@ mca_coll_basic_neighbor_alltoall_dist_graph(const void *sbuf, int scount,struct
mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_dist_graph_2_1_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
const mca_topo_base_comm_dist_graph_2_2_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
ptrdiff_t lb, rdextent, sdextent;
int rc = MPI_SUCCESS, neighbor;
const int *inedges, *outedges;

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

@ -12,6 +12,8 @@
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -40,7 +42,7 @@ mca_coll_basic_neighbor_alltoallv_cart(const void *sbuf, const int scounts[], co
struct ompi_communicator_t *comm, mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_cart_2_1_0_t *cart = comm->c_topo->mtc.cart;
const mca_topo_base_comm_cart_2_2_0_t *cart = comm->c_topo->mtc.cart;
const int rank = ompi_comm_rank (comm);
int rc = MPI_SUCCESS, dim, i, nreqs;
ptrdiff_t lb, rdextent, sdextent;
@ -119,7 +121,7 @@ mca_coll_basic_neighbor_alltoallv_graph(const void *sbuf, const int scounts[], c
struct ompi_communicator_t *comm, mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_graph_2_1_0_t *graph = comm->c_topo->mtc.graph;
const mca_topo_base_comm_graph_2_2_0_t *graph = comm->c_topo->mtc.graph;
int rc = MPI_SUCCESS, neighbor, degree;
const int rank = ompi_comm_rank (comm);
ptrdiff_t lb, rdextent, sdextent;
@ -171,7 +173,7 @@ mca_coll_basic_neighbor_alltoallv_dist_graph(const void *sbuf, const int scounts
struct ompi_communicator_t *comm, mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_dist_graph_2_1_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
const mca_topo_base_comm_dist_graph_2_2_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
ptrdiff_t lb, rdextent, sdextent;
int rc = MPI_SUCCESS, neighbor;
const int *inedges, *outedges;

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

@ -12,6 +12,8 @@
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -40,7 +42,7 @@ mca_coll_basic_neighbor_alltoallw_cart(const void *sbuf, const int scounts[], co
struct ompi_communicator_t *comm, mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_cart_2_1_0_t *cart = comm->c_topo->mtc.cart;
const mca_topo_base_comm_cart_2_2_0_t *cart = comm->c_topo->mtc.cart;
const int rank = ompi_comm_rank (comm);
int rc = MPI_SUCCESS, dim, i, nreqs;
ompi_request_t **reqs;
@ -116,7 +118,7 @@ mca_coll_basic_neighbor_alltoallw_graph(const void *sbuf, const int scounts[], c
struct ompi_communicator_t *comm, mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_graph_2_1_0_t *graph = comm->c_topo->mtc.graph;
const mca_topo_base_comm_graph_2_2_0_t *graph = comm->c_topo->mtc.graph;
int rc = MPI_SUCCESS, neighbor, degree;
const int rank = ompi_comm_rank (comm);
ompi_request_t **reqs;
@ -164,7 +166,7 @@ mca_coll_basic_neighbor_alltoallw_dist_graph(const void *sbuf, const int scounts
struct ompi_communicator_t *comm, mca_coll_base_module_t *module)
{
mca_coll_basic_module_t *basic_module = (mca_coll_basic_module_t *) module;
const mca_topo_base_comm_dist_graph_2_1_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
const mca_topo_base_comm_dist_graph_2_2_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
int rc = MPI_SUCCESS, neighbor;
const int *inedges, *outedges;
int indegree, outdegree;

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

@ -12,6 +12,8 @@
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -161,7 +163,7 @@ mca_topo_base_dist_graph_distribute(mca_topo_base_module_t* module,
int n, int nodes[],
int degrees[], int targets[],
int weights[],
mca_topo_base_comm_dist_graph_2_1_0_t** ptopo);
mca_topo_base_comm_dist_graph_2_2_0_t** ptopo);
OMPI_DECLSPEC int
mca_topo_base_dist_graph_create(mca_topo_base_module_t* module,

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

@ -13,6 +13,8 @@
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All right
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -55,7 +57,7 @@ int mca_topo_base_cart_create(mca_topo_base_module_t *topo,
int nprocs = 1, i, *p, new_rank, num_procs, ret;
ompi_communicator_t *new_comm;
ompi_proc_t **topo_procs = NULL;
mca_topo_base_comm_cart_2_1_0_t* cart;
mca_topo_base_comm_cart_2_2_0_t* cart;
num_procs = old_comm->c_local_group->grp_proc_count;
new_rank = old_comm->c_local_group->grp_my_rank;
@ -86,7 +88,7 @@ int mca_topo_base_cart_create(mca_topo_base_module_t *topo,
num_procs = 0;
}
cart = (mca_topo_base_comm_cart_2_1_0_t*)calloc(1, sizeof(mca_topo_base_comm_cart_2_1_0_t));
cart = OBJ_NEW(mca_topo_base_comm_cart_2_2_0_t);
if( NULL == cart ) {
ompi_comm_free(&new_comm);
return OMPI_ERR_OUT_OF_RESOURCE;
@ -98,7 +100,7 @@ int mca_topo_base_cart_create(mca_topo_base_module_t *topo,
if( ndims > 0 ) {
cart->dims = (int*)malloc(sizeof(int) * ndims);
if (NULL == cart->dims) {
free(cart);
OBJ_RELEASE(cart);
return OMPI_ERROR;
}
memcpy(cart->dims, dims, ndims * sizeof(int));
@ -106,17 +108,14 @@ int mca_topo_base_cart_create(mca_topo_base_module_t *topo,
/* Cartesian communicator; copy the right data to the common information */
cart->periods = (int*)malloc(sizeof(int) * ndims);
if (NULL == cart->periods) {
if(NULL != cart->dims) free(cart->dims);
free(cart);
OBJ_RELEASE(cart);
return OMPI_ERR_OUT_OF_RESOURCE;
}
memcpy(cart->periods, periods, ndims * sizeof(int));
cart->coords = (int*)malloc(sizeof(int) * ndims);
if (NULL == cart->coords) {
free(cart->periods);
if(NULL != cart->dims) free(cart->dims);
free(cart);
OBJ_RELEASE(cart);
return OMPI_ERR_OUT_OF_RESOURCE;
}
{ /* setup the cartesian topology */
@ -139,6 +138,10 @@ int mca_topo_base_cart_create(mca_topo_base_module_t *topo,
the new one. The topology module is then able to work on this
copy and rearrange it as it deems fit. */
topo_procs = (ompi_proc_t**)malloc(num_procs * sizeof(ompi_proc_t *));
if (NULL == topo_procs) {
OBJ_RELEASE(cart);
return OMPI_ERR_OUT_OF_RESOURCE;
}
if(OMPI_GROUP_IS_DENSE(old_comm->c_local_group)) {
memcpy(topo_procs,
old_comm->c_local_group->grp_proc_pointers,
@ -154,10 +157,7 @@ int mca_topo_base_cart_create(mca_topo_base_module_t *topo,
new_comm = ompi_comm_allocate(num_procs, 0);
if (NULL == new_comm) {
free(topo_procs);
if(NULL != cart->periods) free(cart->periods);
if(NULL != cart->coords) free(cart->coords);
if(NULL != cart->dims) free(cart->dims);
free(cart);
OBJ_RELEASE(cart);
return MPI_ERR_INTERN;
}
@ -165,11 +165,9 @@ int mca_topo_base_cart_create(mca_topo_base_module_t *topo,
new_rank, num_procs, topo_procs);
if (OMPI_SUCCESS != ret) {
/* something wrong happened during setting the communicator */
free(topo_procs);
OBJ_RELEASE(cart);
ompi_comm_free (&new_comm);
if(NULL != cart->periods) free(cart->periods);
if(NULL != cart->coords) free(cart->coords);
if(NULL != cart->dims) free(cart->dims);
free(cart);
return ret;
}
@ -187,3 +185,26 @@ int mca_topo_base_cart_create(mca_topo_base_module_t *topo,
/* end here */
return OMPI_SUCCESS;
}
static void mca_topo_base_comm_cart_2_2_0_construct(mca_topo_base_comm_cart_2_2_0_t * cart) {
cart->ndims = 0;
cart->dims = NULL;
cart->periods = NULL;
cart->coords = NULL;
}
static void mca_topo_base_comm_cart_2_2_0_destruct(mca_topo_base_comm_cart_2_2_0_t * cart) {
if (NULL != cart->dims) {
free(cart->dims);
}
if (NULL != cart->periods) {
free(cart->periods);
}
if (NULL != cart->coords) {
free(cart->coords);
}
}
OBJ_CLASS_INSTANCE(mca_topo_base_comm_cart_2_2_0_t, opal_object_t,
mca_topo_base_comm_cart_2_2_0_construct,
mca_topo_base_comm_cart_2_2_0_destruct);

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

@ -13,6 +13,8 @@
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -44,12 +46,12 @@ int mca_topo_base_cart_sub (ompi_communicator_t* comm,
ompi_communicator_t** new_comm)
{
struct ompi_communicator_t *temp_comm;
mca_topo_base_comm_cart_2_1_0_t *old_cart;
mca_topo_base_comm_cart_2_2_0_t *old_cart;
int errcode, colour, key, colfactor, keyfactor;
int ndim, dim, i;
int *d, *dorig = NULL, *dold, *c, *r, *p, *porig = NULL, *pold;
mca_topo_base_module_t* topo;
mca_topo_base_comm_cart_2_1_0_t* cart;
mca_topo_base_comm_cart_2_2_0_t* cart;
*new_comm = MPI_COMM_NULL;
old_cart = comm->c_topo->mtc.cart;
@ -115,7 +117,7 @@ int mca_topo_base_cart_sub (ompi_communicator_t* comm,
}
}
}
cart = (mca_topo_base_comm_cart_2_1_0_t*)calloc(1, sizeof(mca_topo_base_comm_cart_2_1_0_t));
cart = (mca_topo_base_comm_cart_2_2_0_t*)calloc(1, sizeof(mca_topo_base_comm_cart_2_2_0_t));
if( NULL == cart ) {
ompi_comm_free(&temp_comm);
return OMPI_ERR_OUT_OF_RESOURCE;

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

@ -8,6 +8,8 @@
* reserved.
* Copyright (c) 2011-2013 INRIA. All rights reserved.
* Copyright (c) 2011-2013 Université Bordeaux 1
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*/
#include "ompi_config.h"
@ -34,7 +36,7 @@ int mca_topo_base_dist_graph_distribute(mca_topo_base_module_t* module,
int n, int nodes[],
int degrees[], int targets[],
int weights[],
mca_topo_base_comm_dist_graph_2_1_0_t** ptopo)
mca_topo_base_comm_dist_graph_2_2_0_t** ptopo)
{
int i, j, err, count, left_over, pending_reqs, current_pos, index, csize;
int *rin = NULL, *rout, *temp = NULL;
@ -42,7 +44,7 @@ int mca_topo_base_dist_graph_distribute(mca_topo_base_module_t* module,
size_t int_size, how_much;
ompi_status_public_t status;
ompi_request_t **reqs = NULL;
mca_topo_base_comm_dist_graph_2_1_0_t* topo=NULL;
mca_topo_base_comm_dist_graph_2_2_0_t* topo=NULL;
ompi_datatype_type_size( (ompi_datatype_t*)&ompi_mpi_int, &int_size);
@ -119,13 +121,11 @@ int mca_topo_base_dist_graph_distribute(mca_topo_base_module_t* module,
* - indexes[0] total number of in edges
* - indexes[1] total number of out edges
*/
topo = (mca_topo_base_comm_dist_graph_2_1_0_t*)malloc(sizeof(mca_topo_base_comm_dist_graph_2_1_0_t));
topo = OBJ_NEW(mca_topo_base_comm_dist_graph_2_2_0_t);
if( NULL == topo ) {
err = OMPI_ERR_OUT_OF_RESOURCE;
goto bail_out;
}
topo->in = topo->inw = NULL;
topo->out = topo->outw = NULL;
topo->indegree = idx[0].in;
topo->outdegree = idx[0].out;
topo->weighted = (weights != MPI_UNWEIGHTED);
@ -273,19 +273,7 @@ int mca_topo_base_dist_graph_distribute(mca_topo_base_module_t* module,
free(cnt);
}
if( NULL != topo ) {
if ( NULL != topo->in ) {
free(topo->in);
}
if ( NULL != topo->out ) {
free(topo->out);
}
if ( NULL != topo->inw ) {
free(topo->inw);
}
if ( NULL != topo->outw ) {
free(topo->outw);
}
free(topo);
OBJ_RELEASE(topo);
}
return err;
}
@ -323,3 +311,32 @@ int mca_topo_base_dist_graph_create(mca_topo_base_module_t* module,
}
return err;
}
static void mca_topo_base_comm_dist_graph_2_2_0_construct(mca_topo_base_comm_dist_graph_2_2_0_t * dist_graph) {
dist_graph->in = NULL;
dist_graph->inw = NULL;
dist_graph->out = NULL;
dist_graph->outw = NULL;
dist_graph->indegree = 0;
dist_graph->outdegree = 0;
dist_graph->weighted = false;
}
static void mca_topo_base_comm_dist_graph_2_2_0_destruct(mca_topo_base_comm_dist_graph_2_2_0_t * dist_graph) {
if (NULL != dist_graph->in) {
free(dist_graph->in);
}
if (NULL != dist_graph->inw) {
free(dist_graph->inw);
}
if (NULL != dist_graph->out) {
free(dist_graph->out);
}
if (NULL != dist_graph->outw) {
free(dist_graph->outw);
}
}
OBJ_CLASS_INSTANCE(mca_topo_base_comm_dist_graph_2_2_0_t, opal_object_t,
mca_topo_base_comm_dist_graph_2_2_0_construct,
mca_topo_base_comm_dist_graph_2_2_0_destruct);

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

@ -8,6 +8,8 @@
* reserved.
* Copyright (c) 2011-2012 INRIA. All rights reserved.
* Copyright (c) 2011-2012 Université Bordeaux 1
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*/
#include "ompi_config.h"
@ -27,7 +29,7 @@ int mca_topo_base_dist_graph_create_adjacent(mca_topo_base_module_t* module,
ompi_info_t *info, int reorder,
ompi_communicator_t **newcomm)
{
mca_topo_base_comm_dist_graph_2_1_0_t *topo = NULL;
mca_topo_base_comm_dist_graph_2_2_0_t *topo = NULL;
int err;
if( OMPI_SUCCESS != (err = ompi_comm_create(comm_old,
@ -39,7 +41,7 @@ int mca_topo_base_dist_graph_create_adjacent(mca_topo_base_module_t* module,
assert( NULL == (*newcomm)->c_topo );
topo = (mca_topo_base_comm_dist_graph_2_1_0_t*)malloc(sizeof(mca_topo_base_comm_dist_graph_2_1_0_t));
topo = (mca_topo_base_comm_dist_graph_2_2_0_t*)malloc(sizeof(mca_topo_base_comm_dist_graph_2_2_0_t));
if( NULL == topo ) {
goto bail_out;
}

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

@ -8,6 +8,8 @@
* reserved.
* Copyright (c) 2011-2012 INRIA. All rights reserved.
* Copyright (c) 2011-2012 Universite Bordeaux 1
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*/
#include "ompi_config.h"
@ -23,7 +25,7 @@ int mca_topo_base_dist_graph_neighbors(ompi_communicator_t *comm,
int maxoutdegree,
int destinations[], int destweights[])
{
mca_topo_base_comm_dist_graph_2_1_0_t *dg = comm->c_topo->mtc.dist_graph;
mca_topo_base_comm_dist_graph_2_2_0_t *dg = comm->c_topo->mtc.dist_graph;
int i;
if (!OMPI_COMM_IS_DIST_GRAPH(comm)) {

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

@ -3,6 +3,8 @@
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*/
#include "ompi_config.h"
@ -16,7 +18,7 @@ int mca_topo_base_dist_graph_neighbors_count(ompi_communicator_t *comm,
int *inneighbors,
int *outneighbors, int *weighted)
{
mca_topo_base_comm_dist_graph_2_1_0_t* dist_graph = comm->c_topo->mtc.dist_graph;
mca_topo_base_comm_dist_graph_2_2_0_t* dist_graph = comm->c_topo->mtc.dist_graph;
if (!OMPI_COMM_IS_DIST_GRAPH(comm)) {
return OMPI_ERR_NOT_FOUND;

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

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -34,7 +36,7 @@ static int init_query(const mca_base_component_t *m,
mca_base_component_list_item_t *entry,
bool enable_progress_threads,
bool enable_mpi_threads);
static int init_query_2_1_0(const mca_base_component_t *component,
static int init_query_2_2_0(const mca_base_component_t *component,
mca_base_component_list_item_t *entry,
bool enable_progress_threads,
bool enable_mpi_threads);
@ -95,12 +97,12 @@ static int init_query(const mca_base_component_t *m,
/* This component has been successfully opened, now try to query
it and see if it wants to run in this job. Nothing interesting
happened in the topo framework before v2.1.0, so don't bother
happened in the topo framework before v2.2.0, so don't bother
supporting anything before then. */
if (2 == m->mca_type_major_version &&
1 == m->mca_type_minor_version &&
2 == m->mca_type_minor_version &&
0 == m->mca_type_release_version) {
ret = init_query_2_1_0(m, entry, enable_progress_threads,
ret = init_query_2_2_0(m, entry, enable_progress_threads,
enable_mpi_threads);
} else {
/* unrecognised API version */
@ -132,13 +134,13 @@ static int init_query(const mca_base_component_t *m,
}
static int init_query_2_1_0(const mca_base_component_t *component,
static int init_query_2_2_0(const mca_base_component_t *component,
mca_base_component_list_item_t *entry,
bool enable_progress_threads,
bool enable_mpi_threads)
{
mca_topo_base_component_2_1_0_t *topo =
(mca_topo_base_component_2_1_0_t *) component;
mca_topo_base_component_2_2_0_t *topo =
(mca_topo_base_component_2_2_0_t *) component;
return topo->topoc_init_query(enable_progress_threads,
enable_mpi_threads);

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

@ -10,6 +10,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -37,8 +39,22 @@
*/
#include "ompi/mca/topo/base/static-components.h"
static void mca_topo_base_module_construct(mca_topo_base_module_t * topo) {
memset(&(topo->mtc), 0, sizeof(topo->mtc));
}
static void mca_topo_base_module_destruct(mca_topo_base_module_t * topo) {
/* topo->mtc is an union of pointers to opal_object_t.
In order to release it, we just have to call OBJ_RELEASE on any of the member,
(cart in this case) and the appropriate object destructor will be called */
if (NULL != topo->mtc.cart) {
OBJ_RELEASE(topo->mtc.cart);
}
}
OBJ_CLASS_INSTANCE(mca_topo_base_module_t, opal_object_t,
NULL, NULL);
mca_topo_base_module_construct,
mca_topo_base_module_destruct);
static int mca_topo_base_close(void)
{

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

@ -10,6 +10,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -48,7 +50,7 @@ int mca_topo_base_graph_create(mca_topo_base_module_t *topo,
ompi_communicator_t *new_comm;
int new_rank, num_procs, ret, i;
ompi_proc_t **topo_procs = NULL;
mca_topo_base_comm_graph_2_1_0_t* graph;
mca_topo_base_comm_graph_2_2_0_t* graph;
num_procs = old_comm->c_local_group->grp_proc_count;
new_rank = old_comm->c_local_group->grp_my_rank;
@ -66,13 +68,11 @@ int mca_topo_base_graph_create(mca_topo_base_module_t *topo,
nnodes = 0;
}
graph = (mca_topo_base_comm_graph_2_1_0_t*)malloc(sizeof(mca_topo_base_comm_graph_2_1_0_t));
graph = OBJ_NEW(mca_topo_base_comm_graph_2_2_0_t);
if( NULL == graph ) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
graph->nnodes = nnodes;
graph->index = NULL;
graph->edges = NULL;
/* Don't do any of the other initialization if we're not supposed
to be part of the new communicator (because nnodes has been
@ -85,7 +85,7 @@ int mca_topo_base_graph_create(mca_topo_base_module_t *topo,
if (MPI_UNDEFINED != new_rank) {
graph->index = (int*)malloc(sizeof(int) * nnodes);
if (NULL == graph->index) {
free(graph);
OBJ_RELEASE(graph);
return OMPI_ERR_OUT_OF_RESOURCE;
}
memcpy(graph->index, index, nnodes * sizeof(int));
@ -93,13 +93,16 @@ int mca_topo_base_graph_create(mca_topo_base_module_t *topo,
/* Graph communicator; copy the right data to the common information */
graph->edges = (int*)malloc(sizeof(int) * index[nnodes-1]);
if (NULL == graph->edges) {
free(graph->index);
free(graph);
OBJ_RELEASE(graph);
return OMPI_ERR_OUT_OF_RESOURCE;
}
memcpy(graph->edges, edges, index[nnodes-1] * sizeof(int));
topo_procs = (ompi_proc_t**)malloc(num_procs * sizeof(ompi_proc_t *));
if (NULL == topo_procs) {
OBJ_RELEASE(graph);
return OMPI_ERR_OUT_OF_RESOURCE;
}
if(OMPI_GROUP_IS_DENSE(old_comm->c_local_group)) {
memcpy(topo_procs,
old_comm->c_local_group->grp_proc_pointers,
@ -115,9 +118,7 @@ int mca_topo_base_graph_create(mca_topo_base_module_t *topo,
new_comm = ompi_comm_allocate(nnodes, 0);
if (NULL == new_comm) {
free(topo_procs);
free(graph->edges);
free(graph->index);
free(graph);
OBJ_RELEASE(graph);
return OMPI_ERR_OUT_OF_RESOURCE;
}
@ -125,9 +126,7 @@ int mca_topo_base_graph_create(mca_topo_base_module_t *topo,
new_rank, num_procs, topo_procs);
if (OMPI_SUCCESS != ret) {
free(topo_procs);
free(graph->edges);
free(graph->index);
free(graph);
OBJ_RELEASE(graph);
ompi_comm_free (&new_comm);
return ret;
}
@ -145,3 +144,22 @@ int mca_topo_base_graph_create(mca_topo_base_module_t *topo,
return OMPI_SUCCESS;
}
static void mca_topo_base_comm_graph_2_2_0_construct(mca_topo_base_comm_graph_2_2_0_t * graph) {
graph->nnodes = 0;
graph->index = NULL;
graph->edges = NULL;
}
static void mca_topo_base_comm_graph_2_2_0_destruct(mca_topo_base_comm_graph_2_2_0_t * graph) {
if (NULL != graph->index) {
free(graph->index);
}
if (NULL != graph->edges) {
free(graph->edges);
}
}
OBJ_CLASS_INSTANCE(mca_topo_base_comm_graph_2_2_0_t, opal_object_t,
mca_topo_base_comm_graph_2_2_0_construct,
mca_topo_base_comm_graph_2_2_0_destruct);

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

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -38,7 +40,7 @@ int mca_topo_base_graph_neighbors (ompi_communicator_t* comm,
int maxneighbors,
int *neighbors)
{
mca_topo_base_comm_graph_2_1_0_t* graph = comm->c_topo->mtc.graph;
mca_topo_base_comm_graph_2_2_0_t* graph = comm->c_topo->mtc.graph;
int nnbrs, i, *p;
/*

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

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -35,7 +37,7 @@ int mca_topo_base_graph_neighbors_count (ompi_communicator_t* comm,
int rank,
int *nneighbors)
{
mca_topo_base_comm_graph_2_1_0_t* graph = comm->c_topo->mtc.graph;
mca_topo_base_comm_graph_2_2_0_t* graph = comm->c_topo->mtc.graph;
*nneighbors = graph->index[rank];
if (rank > 0) {
*nneighbors -= graph->index[rank - 1];

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

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -37,7 +39,7 @@ int mca_topo_base_graphdims_get (ompi_communicator_t* comm,
int *nodes,
int *nedges)
{
mca_topo_base_comm_graph_2_1_0_t* graph = comm->c_topo->mtc.graph;
mca_topo_base_comm_graph_2_2_0_t* graph = comm->c_topo->mtc.graph;
*nodes = ompi_comm_size(comm);
*nedges = graph->index[*nodes -1];

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

@ -4,6 +4,8 @@
* Copyright (c) 2011-2013 INRIA. All rights reserved.
* Copyright (c) 2011-2013 Université Bordeaux 1
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -19,7 +21,7 @@
BEGIN_C_DECLS
typedef mca_topo_base_component_2_1_0_t mca_topo_basic_component_t;
typedef mca_topo_base_component_2_2_0_t mca_topo_basic_component_t;
/* Public component instance */
OMPI_MODULE_DECLSPEC extern mca_topo_basic_component_t
mca_topo_basic_component;

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

@ -4,6 +4,8 @@
* reserved.
* Copyright (c) 2011-2013 INRIA. All rights reserved.
* Copyright (c) 2011-2013 Université Bordeaux 1
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -33,7 +35,7 @@ comm_query(const ompi_communicator_t *comm, int *priority, uint32_t type);
mca_topo_basic_component_t mca_topo_basic_component =
{
{
MCA_TOPO_BASE_VERSION_2_1_0,
MCA_TOPO_BASE_VERSION_2_2_0,
"basic",
OMPI_MAJOR_VERSION,

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

@ -10,6 +10,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -33,7 +35,7 @@ typedef struct mca_topo_base_module_t mca_topo_base_module_t;
/*
* Initial component query, called during mca_topo_base_open.
*/
typedef int (*mca_topo_base_component_init_query_2_1_0_fn_t)
typedef int (*mca_topo_base_component_init_query_2_2_0_fn_t)
(bool enable_progress_threads,
bool enable_mpi_threads);
@ -42,54 +44,69 @@ typedef int (*mca_topo_base_component_init_query_2_1_0_fn_t)
* creation.
*/
typedef struct mca_topo_base_module_t*
(*mca_topo_base_component_comm_query_2_1_0_fn_t)
(*mca_topo_base_component_comm_query_2_2_0_fn_t)
(const ompi_communicator_t *comm, int *priority, uint32_t type);
/*
* Structure for topo v2.1.0 components.This is chained to MCA v2.0.0
*/
typedef struct mca_topo_base_component_2_1_0_t {
typedef struct mca_topo_base_component_2_2_0_t {
mca_base_component_t topoc_version;
mca_base_component_data_t topoc_data;
mca_topo_base_component_init_query_2_1_0_fn_t topoc_init_query;
mca_topo_base_component_comm_query_2_1_0_fn_t topoc_comm_query;
} mca_topo_base_component_2_1_0_t;
typedef mca_topo_base_component_2_1_0_t mca_topo_base_component_t;
mca_topo_base_component_init_query_2_2_0_fn_t topoc_init_query;
mca_topo_base_component_comm_query_2_2_0_fn_t topoc_comm_query;
} mca_topo_base_component_2_2_0_t;
typedef mca_topo_base_component_2_2_0_t mca_topo_base_component_t;
/*
* Struct for holding graph communicator information
*/
typedef struct mca_topo_base_comm_graph_2_1_0_t {
typedef struct mca_topo_base_comm_graph_2_2_0_t {
/* Make this structure be an object so that it has a constructor
and destructor. */
opal_object_t super;
int nnodes;
int *index;
int *edges;
} mca_topo_base_comm_graph_2_1_0_t;
typedef mca_topo_base_comm_graph_2_1_0_t mca_topo_base_comm_graph_t;
} mca_topo_base_comm_graph_2_2_0_t;
typedef mca_topo_base_comm_graph_2_2_0_t mca_topo_base_comm_graph_t;
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_topo_base_comm_graph_2_2_0_t);
/*
* Struct for holding cartesian communicator information
*/
typedef struct mca_topo_base_comm_cart_2_1_0_t {
typedef struct mca_topo_base_comm_cart_2_2_0_t {
/* Make this structure be an object so that it has a constructor
and destructor. */
opal_object_t super;
int ndims;
int *dims;
int *periods;
int *coords;
} mca_topo_base_comm_cart_2_1_0_t;
typedef mca_topo_base_comm_cart_2_1_0_t mca_topo_base_comm_cart_t;
} mca_topo_base_comm_cart_2_2_0_t;
typedef mca_topo_base_comm_cart_2_2_0_t mca_topo_base_comm_cart_t;
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_topo_base_comm_cart_2_2_0_t);
/*
* Struct for holding distributed graph information
*/
typedef struct mca_topo_base_comm_dist_graph_2_1_0_t {
typedef struct mca_topo_base_comm_dist_graph_2_2_0_t {
/* Make this structure be an object so that it has a constructor
and destructor. */
opal_object_t super;
int *in;
int *inw;
int *out;
int *outw;
int indegree, outdegree;
bool weighted;
} mca_topo_base_comm_dist_graph_2_1_0_t;
typedef mca_topo_base_comm_dist_graph_2_1_0_t mca_topo_base_comm_dist_graph_t;
} mca_topo_base_comm_dist_graph_2_2_0_t;
typedef mca_topo_base_comm_dist_graph_2_2_0_t mca_topo_base_comm_dist_graph_t;
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_topo_base_comm_dist_graph_2_2_0_t);
/*
* This union must be declared (can't be anonymous in the struct where
@ -97,12 +114,12 @@ typedef mca_topo_base_comm_dist_graph_2_1_0_t mca_topo_base_comm_dist_graph_t;
* offsets in the ompi/debuggers/ stuff (i.e., so that debuggers can
* parse/understand the individual fields on communicators).
*/
typedef union mca_topo_base_comm_cgd_union_2_1_0_t {
mca_topo_base_comm_graph_2_1_0_t* graph;
mca_topo_base_comm_cart_2_1_0_t* cart;
mca_topo_base_comm_dist_graph_2_1_0_t* dist_graph;
} mca_topo_base_comm_cgd_union_2_1_0_t;
typedef mca_topo_base_comm_cgd_union_2_1_0_t mca_topo_base_comm_cgd_union_t;
typedef union mca_topo_base_comm_cgd_union_2_2_0_t {
mca_topo_base_comm_graph_2_2_0_t* graph;
mca_topo_base_comm_cart_2_2_0_t* cart;
mca_topo_base_comm_dist_graph_2_2_0_t* dist_graph;
} mca_topo_base_comm_cgd_union_2_2_0_t;
typedef mca_topo_base_comm_cgd_union_2_2_0_t mca_topo_base_comm_cgd_union_t;
/**
* The logic for creating communicators with attached topologies is
@ -269,7 +286,7 @@ typedef int (*mca_topo_base_module_dist_graph_neighbors_count_fn_t)
* automatically replaced by their default version. They will return the answers
* based on the base information stored in the associated module extra data.
*/
typedef struct mca_topo_base_cart_module_2_1_0_t {
typedef struct mca_topo_base_cart_module_2_2_0_t {
mca_topo_base_module_cart_coords_fn_t cart_coords;
mca_topo_base_module_cart_create_fn_t cart_create;
mca_topo_base_module_cart_get_fn_t cart_get;
@ -278,23 +295,23 @@ typedef struct mca_topo_base_cart_module_2_1_0_t {
mca_topo_base_module_cart_rank_fn_t cart_rank;
mca_topo_base_module_cart_shift_fn_t cart_shift;
mca_topo_base_module_cart_sub_fn_t cart_sub;
} mca_topo_base_cart_module_2_1_0_t;
} mca_topo_base_cart_module_2_2_0_t;
typedef struct mca_topo_base_graph_module_2_1_0_t {
typedef struct mca_topo_base_graph_module_2_2_0_t {
mca_topo_base_module_graph_create_fn_t graph_create;
mca_topo_base_module_graph_get_fn_t graph_get;
mca_topo_base_module_graph_map_fn_t graph_map;
mca_topo_base_module_graphdims_get_fn_t graphdims_get;
mca_topo_base_module_graph_neighbors_fn_t graph_neighbors;
mca_topo_base_module_graph_neighbors_count_fn_t graph_neighbors_count;
} mca_topo_base_graph_module_2_1_0_t;
} mca_topo_base_graph_module_2_2_0_t;
typedef struct mca_topo_base_dist_graph_module_2_1_0_t {
typedef struct mca_topo_base_dist_graph_module_2_2_0_t {
mca_topo_base_module_dist_graph_create_fn_t dist_graph_create;
mca_topo_base_module_dist_graph_create_adjacent_fn_t dist_graph_create_adjacent;
mca_topo_base_module_dist_graph_neighbors_fn_t dist_graph_neighbors;
mca_topo_base_module_dist_graph_neighbors_count_fn_t dist_graph_neighbors_count;
} mca_topo_base_dist_graph_module_2_1_0_t;
} mca_topo_base_dist_graph_module_2_2_0_t;
struct mca_topo_base_module_t {
/* Make this structure be an object so that it has a constructor
@ -307,9 +324,9 @@ struct mca_topo_base_module_t {
/* Cart, graph or dist graph related functions */
union {
mca_topo_base_cart_module_2_1_0_t cart;
mca_topo_base_graph_module_2_1_0_t graph;
mca_topo_base_dist_graph_module_2_1_0_t dist_graph;
mca_topo_base_cart_module_2_2_0_t cart;
mca_topo_base_graph_module_2_2_0_t graph;
mca_topo_base_dist_graph_module_2_2_0_t dist_graph;
} topo;
/* This union caches the parameters passed when the communicator
@ -322,11 +339,11 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_topo_base_module_t);
/*
* ******************************************************************
* ********** Use in components that are of type topo v2.1.0 ********
* ********** Use in components that are of type topo v2.2.0 ********
* ******************************************************************
*/
#define MCA_TOPO_BASE_VERSION_2_1_0 \
#define MCA_TOPO_BASE_VERSION_2_2_0 \
MCA_BASE_VERSION_2_0_0, \
"topo", 2, 1, 0
"topo", 2, 2, 0
#endif /* MCA_TOPO_H */

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

@ -13,6 +13,8 @@
* Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -49,7 +51,7 @@ int MPI_Cart_rank(MPI_Comm comm, const int coords[], int *rank)
/* check the arguments */
if (MPI_PARAM_CHECK) {
mca_topo_base_comm_cart_2_1_0_t* cart;
mca_topo_base_comm_cart_2_2_0_t* cart;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (ompi_comm_invalid(comm)) {
return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM,