root/ompi/mpi/c/group_incl.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MPI_Group_incl

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2005 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2006      University of Houston. All rights reserved.
  14  * Copyright (c) 2006-2009 Cisco Systems, Inc.  All rights reserved.
  15  * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
  16  *                         reserved.
  17  * Copyright (c) 2015      Research Organization for Information Science
  18  *                         and Technology (RIST). All rights reserved.
  19  * $COPYRIGHT$
  20  *
  21  * Additional copyrights may follow
  22  *
  23  * $HEADER$
  24  */
  25 #include "ompi_config.h"
  26 #include <stdio.h>
  27 
  28 #include "ompi/mpi/c/bindings.h"
  29 #include "ompi/runtime/params.h"
  30 #include "ompi/group/group.h"
  31 #include "ompi/errhandler/errhandler.h"
  32 #include "ompi/communicator/communicator.h"
  33 
  34 #if OMPI_BUILD_MPI_PROFILING
  35 #if OPAL_HAVE_WEAK_SYMBOLS
  36 #pragma weak MPI_Group_incl = PMPI_Group_incl
  37 #endif
  38 #define MPI_Group_incl PMPI_Group_incl
  39 #endif
  40 
  41 static const char FUNC_NAME[] = "MPI_Group_incl";
  42 
  43 
  44 int MPI_Group_incl(MPI_Group group, int n, const int ranks[], MPI_Group *new_group)
  45 {
  46   int i, group_size, err;
  47   ompi_group_t *group_pointer;
  48 
  49   group_pointer = (ompi_group_t *)group;
  50   group_size = ompi_group_size ( group_pointer );
  51 
  52   if( MPI_PARAM_CHECK ) {
  53       OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  54 
  55       /* verify that group is valid group */
  56       if ( (MPI_GROUP_NULL == group) || ( NULL == group) ||
  57            (NULL == new_group) ) {
  58           return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
  59                                         FUNC_NAME);
  60       } else if (NULL == ranks && n > 0) {
  61           return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
  62                                         FUNC_NAME);
  63       }
  64 
  65       /* check that new group is no larger than old group */
  66       if ( n > group_size ) {
  67           return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
  68                                         FUNC_NAME);
  69       }
  70 
  71       for (i = 0; i < n; i++) {
  72           if ((ranks[i] < 0) || (ranks[i] >= group_size)){
  73               return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_RANK,
  74                                              FUNC_NAME);
  75           }
  76       }
  77   }  /* end if( MPI_PARAM_CHECK ) */
  78 
  79   if ( 0 == n ) {
  80       *new_group = MPI_GROUP_EMPTY;
  81       OBJ_RETAIN(MPI_GROUP_EMPTY);
  82       return MPI_SUCCESS;
  83   }
  84 
  85   OPAL_CR_ENTER_LIBRARY();
  86 
  87   err = ompi_group_incl(group,n,ranks,new_group);
  88   OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD,err,FUNC_NAME);
  89 }

/* [<][>][^][v][top][bottom][index][help] */