root/ompi/win/win.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. ompi_win_invalid
  2. ompi_win_peer_invalid
  3. ompi_win_rank
  4. ompi_win_allow_locks

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2007 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) 2006-2017 Cisco Systems, Inc.  All rights reserved
  14  * Copyright (c) 2009      Sun Microsystems, Inc.  All rights reserved.
  15  * Copyright (c) 2013-2015 Los Alamos National Security, LLC.  All rights
  16  *                         reserved.
  17  * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
  18  * $COPYRIGHT$
  19  *
  20  * Additional copyrights may follow
  21  *
  22  * $HEADER$
  23  */
  24 
  25 #ifndef OMPI_WIN_H
  26 #define OMPI_WIN_H
  27 
  28 #include "ompi_config.h"
  29 #include "mpi.h"
  30 
  31 #include "opal/class/opal_object.h"
  32 #include "opal/class/opal_hash_table.h"
  33 #include "opal/util/info_subscriber.h"
  34 #include "ompi/errhandler/errhandler.h"
  35 #include "ompi/info/info.h"
  36 #include "ompi/communicator/communicator.h"
  37 #include "ompi/group/group.h"
  38 #include "ompi/mca/osc/osc.h"
  39 
  40 BEGIN_C_DECLS
  41 
  42 /* flags */
  43 #define OMPI_WIN_FREED        0x00000001
  44 #define OMPI_WIN_INVALID      0x00000002
  45 #define OMPI_WIN_NO_LOCKS     0x00000004
  46 #define OMPI_WIN_SAME_DISP    0x00000008
  47 #define OMPI_WIN_SAME_SIZE    0x00000010
  48 
  49 enum ompi_win_accumulate_ops_t {
  50     OMPI_WIN_ACCUMULATE_OPS_SAME_OP_NO_OP,
  51     OMPI_WIN_ACCUMULATE_OPS_SAME_OP,
  52 };
  53 typedef enum ompi_win_accumulate_ops_t ompi_win_accumulate_ops_t;
  54 
  55 /**
  56  * Accumulate ordering flags. The default accumulate ordering in
  57  * MPI-3.1 is rar,war,raw,waw.
  58  */
  59 enum ompi_win_accumulate_order_flags_t {
  60     /** no accumulate ordering (may valid with any other flag) */
  61     OMPI_WIN_ACC_ORDER_NONE = 0x01,
  62     /** read-after-read ordering */
  63     OMPI_WIN_ACC_ORDER_RAR  = 0x02,
  64     /** write-after-read ordering */
  65     OMPI_WIN_ACC_ORDER_WAR  = 0x04,
  66     /** read-after-write ordering */
  67     OMPI_WIN_ACC_ORDER_RAW  = 0x08,
  68     /** write-after-write ordering */
  69     OMPI_WIN_ACC_ORDER_WAW  = 0x10,
  70 };
  71 
  72 OMPI_DECLSPEC extern mca_base_var_enum_t *ompi_win_accumulate_ops;
  73 OMPI_DECLSPEC extern mca_base_var_enum_flag_t *ompi_win_accumulate_order;
  74 
  75 OMPI_DECLSPEC extern opal_pointer_array_t ompi_mpi_windows;
  76 
  77 struct ompi_win_t {
  78     opal_infosubscriber_t super;
  79 
  80     opal_mutex_t  w_lock;
  81 
  82     char w_name[MPI_MAX_OBJECT_NAME];
  83   
  84     /* Group associated with this window. */
  85     ompi_group_t *w_group;
  86 
  87     /* Information about the state of the window.  */
  88     uint16_t w_flags;
  89 
  90     /** Window flavor */
  91     uint16_t w_flavor;
  92 
  93     /** Accumulate ops */
  94     ompi_win_accumulate_ops_t w_acc_ops;
  95 
  96     /* Attributes */
  97     opal_hash_table_t *w_keyhash;
  98 
  99     /* index in Fortran <-> C translation array */
 100     int w_f_to_c_index;
 101 
 102     /* Error handling.  This field does not have the "w_" prefix so
 103        that the OMPI_ERRHDL_* macros can find it, regardless of
 104        whether it's a comm, window, or file. */
 105     ompi_errhandler_t                    *error_handler;
 106     ompi_errhandler_type_t               errhandler_type;
 107 
 108     /* one sided interface */
 109     ompi_osc_base_module_t *w_osc_module;
 110 
 111     /** Accumulate ordering (see ompi_win_accumulate_order_flags_t above) */
 112     int32_t w_acc_order;
 113 };
 114 typedef struct ompi_win_t ompi_win_t;
 115 OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_win_t);
 116 
 117 /**
 118  * Padded struct to maintain back compatibiltiy.
 119  * See ompi/communicator/communicator.h comments with struct ompi_communicator_t
 120  * for full explanation why we chose the following padding construct for predefines.
 121  */
 122 #define PREDEFINED_WIN_PAD 512
 123 
 124 struct ompi_predefined_win_t {
 125     struct ompi_win_t win;
 126     char padding[PREDEFINED_WIN_PAD - sizeof(ompi_win_t)];
 127 };
 128 typedef struct ompi_predefined_win_t ompi_predefined_win_t;
 129 
 130 OMPI_DECLSPEC extern ompi_predefined_win_t ompi_mpi_win_null;
 131 OMPI_DECLSPEC extern ompi_predefined_win_t *ompi_mpi_win_null_addr;
 132 
 133 int ompi_win_init(void);
 134 int ompi_win_finalize(void);
 135 
 136 int ompi_win_create(void *base, size_t size, int disp_unit,
 137                     ompi_communicator_t *comm, opal_info_t *info,
 138                     ompi_win_t **newwin);
 139 int ompi_win_allocate(size_t size, int disp_unit, opal_info_t *info,
 140                       ompi_communicator_t *comm, void *baseptr, ompi_win_t **newwin);
 141 int ompi_win_allocate_shared(size_t size, int disp_unit, opal_info_t *info,
 142                       ompi_communicator_t *comm, void *baseptr, ompi_win_t **newwin);
 143 int ompi_win_create_dynamic(opal_info_t *info, ompi_communicator_t *comm, ompi_win_t **newwin);
 144 
 145 int ompi_win_free(ompi_win_t *win);
 146 
 147 OMPI_DECLSPEC int ompi_win_set_name(ompi_win_t *win, const char *win_name);
 148 OMPI_DECLSPEC int ompi_win_get_name(ompi_win_t *win, char *win_name, int *length);
 149 
 150 OMPI_DECLSPEC int ompi_win_group(ompi_win_t *win, ompi_group_t **group);
 151 
 152 /* Note that the defintion of an "invalid" window is closely related
 153    to the defintion of an "invalid" communicator.  See a big comment
 154    in ompi/communicator/communicator.h about this. */
 155 static inline int ompi_win_invalid(ompi_win_t *win) {
 156     if (NULL == win ||
 157         MPI_WIN_NULL == win ||
 158         (OMPI_WIN_INVALID & win->w_flags) ||
 159         (OMPI_WIN_FREED & win->w_flags)) {
 160         return true;
 161     } else {
 162         return false;
 163     }
 164 }
 165 
 166 static inline int ompi_win_peer_invalid(ompi_win_t *win, int peer) {
 167     if (win->w_group->grp_proc_count <= peer || peer < 0) return true;
 168     return false;
 169 }
 170 
 171 static inline int ompi_win_rank(ompi_win_t *win) {
 172     return win->w_group->grp_my_rank;
 173 }
 174 
 175 static inline bool ompi_win_allow_locks(ompi_win_t *win) {
 176     return (0 == (win->w_flags & OMPI_WIN_NO_LOCKS));
 177 }
 178 
 179 END_C_DECLS
 180 #endif

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