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-2008 The University of Tennessee and The University
7  *                         of Tennessee Research Foundation.  All rights
8  *                         reserved.
9  * Copyright (c) 2004-2008 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      Cisco Systems, Inc.  All rights reserved.
14  * Copyright (c) 2006-2008 University of Houston.  All rights reserved.
15  * Copyright (c) 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 (c) 2016-2017 IBM Corporation. All rights reserved.
20  * $COPYRIGHT$
21  *
22  * Additional copyrights may follow
23  *
24  * $HEADER$
25  */
26 #include "ompi_config.h"
27 #include <stdio.h>
28 
29 #include "ompi/mpi/c/bindings.h"
30 #include "ompi/runtime/params.h"
31 #include "ompi/communicator/communicator.h"
32 #include "ompi/errhandler/errhandler.h"
33 #include "ompi/memchecker.h"
34 
35 #if OMPI_BUILD_MPI_PROFILING
36 #if OPAL_HAVE_WEAK_SYMBOLS
37 #pragma weak MPI_Comm_dup_with_info = PMPI_Comm_dup_with_info
38 #endif
39 #define MPI_Comm_dup_with_info PMPI_Comm_dup_with_info
40 #endif
41 
42 static const char FUNC_NAME[] = "MPI_Comm_dup_with_info";
43 
MPI_Comm_dup_with_info(MPI_Comm comm,MPI_Info info,MPI_Comm * newcomm)44 int MPI_Comm_dup_with_info(MPI_Comm comm, MPI_Info info, MPI_Comm *newcomm)
45 {
46     int rc;
47 
48     MEMCHECKER(
49         memchecker_comm(comm);
50     );
51 
52     /* argument checking */
53     if ( MPI_PARAM_CHECK ) {
54         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
55 
56         if (ompi_comm_invalid (comm))
57             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
58                                           FUNC_NAME);
59         if (NULL == info || ompi_info_is_freed(info)) {
60             return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_INFO,
61                                           FUNC_NAME);
62         }
63 
64         if ( NULL == newcomm )
65             return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
66                                           FUNC_NAME);
67     }
68 
69     OPAL_CR_ENTER_LIBRARY();
70 
71     rc = ompi_comm_dup_with_info (comm, &info->super, newcomm);
72     OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
73 }
74 
75