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-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) 2012-2013 Los Alamos National Security, LLC. All rights
15 * reserved.
16 * Copyright (c) 2015 Research Organization for Information Science
17 * and Technology (RIST). All rights reserved.
18 * $COPYRIGHT$
19 *
20 * Additional copyrights may follow
21 *
22 * $HEADER$
23 */
24
25 #include "ompi_config.h"
26
27 #include <string.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/totalview.h"
34 #include "ompi/memchecker.h"
35
36 #if OMPI_BUILD_MPI_PROFILING
37 #if OPAL_HAVE_WEAK_SYMBOLS
38 #pragma weak MPI_Comm_set_name = PMPI_Comm_set_name
39 #endif
40 #define MPI_Comm_set_name PMPI_Comm_set_name
41 #endif
42
43 static const char FUNC_NAME[] = "MPI_Comm_set_name";
44
45
46 int MPI_Comm_set_name(MPI_Comm comm, const char *name)
47 {
48 int rc;
49
50 MEMCHECKER(
51 memchecker_comm(comm);
52 );
53
54 if ( MPI_PARAM_CHECK ) {
55 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
56
57 if ( ompi_comm_invalid ( comm ) ) {
58 return OMPI_ERRHANDLER_INVOKE ( MPI_COMM_WORLD, MPI_ERR_COMM,
59 FUNC_NAME);
60 }
61
62 if ( NULL == name ) {
63 return OMPI_ERRHANDLER_INVOKE ( comm, MPI_ERR_ARG,
64 FUNC_NAME);
65 }
66 }
67
68 OPAL_CR_ENTER_LIBRARY();
69
70 rc = ompi_comm_set_name (comm, name );
71 /* -- Tracing information for new communicator name -- */
72 #if 0
73 /* Force TotalView DLL to take note of this name setting */
74
75 ++ompi_tv_comm_sequence_number;
76 #endif
77 OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
78 }