/* * Copyright (c) 2008 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. * Copyright (c) 2008 NEC Laboratories Europe * * Author(s): Torsten Hoefler * Jesper Larsson Traff */ #include #include #include int MPI_Virtual_graph_create(MPI_Comm comm_old, int n, int nodes[], int degrees[], int targets[], int reorder, MPI_Comm *newcomm) { int rank, p; int *predegree, *index, *edges; int ind, total; int i, j, k; int mpi_err = MPI_SUCCESS; MPI_Comm_rank(comm_old, &rank); MPI_Comm_size(comm_old, &p); /* check arguments locally (only consistency requirement is on reorder) */ for (i=0; i=p) return MPI_ERR_TOPOLOGY; k = 0; for (j=0; j=p) return MPI_ERR_TOPOLOGY; } } index = (int*)malloc(p*sizeof(int)); predegree = (int*)malloc(p*sizeof(int)); /* set degrees locally */ for (i=0; i