root/ompi/mpi/c/win_allocate_shared.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Win_allocate_shared

   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) 2014      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 (c) 2017      IBM Corporation. All rights reserved.
  19  * $COPYRIGHT$
  20  *
  21  * Additional copyrights may follow
  22  *
  23  * $HEADER$
  24  */
  25 #include "ompi_config.h"
  26 
  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/info/info.h"
  34 #include "ompi/win/win.h"
  35 #include "ompi/memchecker.h"
  36 
  37 #if OMPI_BUILD_MPI_PROFILING
  38 #if OPAL_HAVE_WEAK_SYMBOLS
  39 #pragma weak MPI_Win_allocate_shared = PMPI_Win_allocate_shared
  40 #endif
  41 #define MPI_Win_allocate_shared PMPI_Win_allocate_shared
  42 #endif
  43 
  44 static const char FUNC_NAME[] = "MPI_Win_allocate_shared";
  45 
  46 
  47 int MPI_Win_allocate_shared(MPI_Aint size, int disp_unit, MPI_Info info,
  48                             MPI_Comm comm, void *baseptr, MPI_Win *win)
  49 {
  50     int ret = MPI_SUCCESS;
  51 
  52     MEMCHECKER(
  53         memchecker_comm(comm);
  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_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
  61                                           FUNC_NAME);
  62 
  63         } else if (NULL == info || ompi_info_is_freed(info)) {
  64             return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_INFO,
  65                                           FUNC_NAME);
  66 
  67         } else if (NULL == win) {
  68             return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_WIN, FUNC_NAME);
  69         } else if ( size < 0 ) {
  70             return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_SIZE, FUNC_NAME);
  71         }
  72     }
  73 
  74     /* communicator must be an intracommunicator */
  75     if (OMPI_COMM_IS_INTER(comm)) {
  76         return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COMM, FUNC_NAME);
  77     }
  78 
  79     OPAL_CR_ENTER_LIBRARY();
  80 
  81     /* create window and return */
  82     ret = ompi_win_allocate_shared((size_t)size, disp_unit, &(info->super),
  83                                    comm, baseptr, win);
  84     if (OMPI_SUCCESS != ret) {
  85         *win = MPI_WIN_NULL;
  86         OPAL_CR_EXIT_LIBRARY();
  87         OMPI_ERRHANDLER_RETURN (ret, comm, ret, FUNC_NAME);
  88     }
  89 
  90     OPAL_CR_EXIT_LIBRARY();
  91     return MPI_SUCCESS;
  92 }

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