|
| 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-2020 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 (c) 2021 Triad National Security, LLC. All rights |
| 21 | + * reserved. |
| 22 | + * |
| 23 | + * $COPYRIGHT$ |
| 24 | + * |
| 25 | + * Additional copyrights may follow |
| 26 | + * |
| 27 | + * $HEADER$ |
| 28 | + */ |
| 29 | +#include "ompi_config.h" |
| 30 | +#include <stdio.h> |
| 31 | + |
| 32 | +#include "ompi/mpi/c/bindings.h" |
| 33 | +#include "ompi/runtime/params.h" |
| 34 | +#include "ompi/communicator/communicator.h" |
| 35 | +#include "ompi/errhandler/errhandler.h" |
| 36 | +#include "ompi/memchecker.h" |
| 37 | + |
| 38 | +#if OMPI_BUILD_MPI_PROFILING |
| 39 | +#if OPAL_HAVE_WEAK_SYMBOLS |
| 40 | +#pragma weak MPI_Comm_idup_with_info = PMPI_Comm_idup_with_info |
| 41 | +#endif |
| 42 | +#define MPI_Comm_idup_with_info PMPI_Comm_idup_with_info |
| 43 | +#endif |
| 44 | + |
| 45 | +static const char FUNC_NAME[] = "MPI_Comm_idup_with_info"; |
| 46 | + |
| 47 | +int MPI_Comm_idup_with_info(MPI_Comm comm, MPI_Info info, MPI_Comm *newcomm, MPI_Request *request) |
| 48 | +{ |
| 49 | + int rc; |
| 50 | + |
| 51 | + MEMCHECKER( |
| 52 | + memchecker_comm(comm); |
| 53 | + ); |
| 54 | + |
| 55 | + /* argument checking */ |
| 56 | + if ( MPI_PARAM_CHECK ) { |
| 57 | + OMPI_ERR_INIT_FINALIZE(FUNC_NAME); |
| 58 | + |
| 59 | + if (ompi_comm_invalid (comm)) |
| 60 | + return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_COMM, |
| 61 | + FUNC_NAME); |
| 62 | + if (NULL == info || ompi_info_is_freed(info)) { |
| 63 | + return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_INFO, |
| 64 | + FUNC_NAME); |
| 65 | + } |
| 66 | + |
| 67 | + if ( NULL == newcomm ) |
| 68 | + return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, |
| 69 | + FUNC_NAME); |
| 70 | + } |
| 71 | + |
| 72 | +#if OPAL_ENABLE_FT_MPI |
| 73 | + /* |
| 74 | + * An early check, so as to return early if we are using a broken |
| 75 | + * communicator. This is not absolutely necessary since we will |
| 76 | + * check for this, and other, error conditions during the operation. |
| 77 | + */ |
| 78 | + if( OPAL_UNLIKELY(!ompi_comm_iface_create_check(comm, &rc)) ) { |
| 79 | + OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); |
| 80 | + } |
| 81 | +#endif |
| 82 | + |
| 83 | + rc = ompi_comm_idup_with_info (comm, &info->super, newcomm, request); |
| 84 | + OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); |
| 85 | +} |
| 86 | + |
0 commit comments