root/ompi/mpi/c/win_lock.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Win_lock

   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) 2014      Los Alamos National Security, LLC. All rights
  14  *                         reserved.
  15  * Copyright (c) 2015-2017 Research Organization for Information Science
  16  *                         and Technology (RIST). All rights reserved.
  17  * $COPYRIGHT$
  18  *
  19  * Additional copyrights may follow
  20  *
  21  * $HEADER$
  22  */
  23 #include "ompi_config.h"
  24 #include <stdio.h>
  25 
  26 #include "ompi/mpi/c/bindings.h"
  27 #include "ompi/runtime/params.h"
  28 #include "ompi/communicator/communicator.h"
  29 #include "ompi/errhandler/errhandler.h"
  30 #include "ompi/win/win.h"
  31 #include "ompi/mca/osc/osc.h"
  32 
  33 #if OMPI_BUILD_MPI_PROFILING
  34 #if OPAL_HAVE_WEAK_SYMBOLS
  35 #pragma weak MPI_Win_lock = PMPI_Win_lock
  36 #endif
  37 #define MPI_Win_lock PMPI_Win_lock
  38 #endif
  39 
  40 static const char FUNC_NAME[] = "MPI_Win_lock";
  41 
  42 
  43 int MPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win)
  44 {
  45     int rc;
  46 
  47     if (MPI_PARAM_CHECK) {
  48         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  49 
  50         if (ompi_win_invalid(win)) {
  51             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_WIN, FUNC_NAME);
  52         } else if (lock_type != MPI_LOCK_EXCLUSIVE &&
  53                    lock_type != MPI_LOCK_SHARED) {
  54             return OMPI_ERRHANDLER_INVOKE(win, MPI_ERR_LOCKTYPE, FUNC_NAME);
  55         } else if (ompi_win_peer_invalid(win, rank)) {
  56             return OMPI_ERRHANDLER_INVOKE(win, MPI_ERR_RANK, FUNC_NAME);
  57         } else if (0 != (assert & ~(MPI_MODE_NOCHECK))) {
  58             return OMPI_ERRHANDLER_INVOKE(win, MPI_ERR_ASSERT, FUNC_NAME);
  59         } else if (! ompi_win_allow_locks(win)) {
  60             return OMPI_ERRHANDLER_INVOKE(win, MPI_ERR_RMA_SYNC, FUNC_NAME);
  61         }
  62     }
  63 
  64     OPAL_CR_ENTER_LIBRARY();
  65 
  66     rc = win->w_osc_module->osc_lock(lock_type, rank, assert, win);
  67     OMPI_ERRHANDLER_RETURN(rc, win, rc, FUNC_NAME);
  68 }

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