root/ompi/mpi/cxx/win_inln.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. Get_errhandler
  2. Set_errhandler
  3. Accumulate
  4. Complete
  5. Create
  6. Fence
  7. Get
  8. Get_group
  9. Lock
  10. Post
  11. Put
  12. Start
  13. Test
  14. Unlock
  15. Wait
  16. Call_errhandler
  17. Create_keyval
  18. Create_keyval
  19. Create_keyval
  20. Create_keyval
  21. Delete_attr
  22. Free_keyval
  23. Get_attr
  24. Get_attr
  25. Get_name
  26. Set_attr
  27. Set_name

   1 // -*- c++ -*-
   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-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) 2007      Sun Microsystems, Inc.  All rights reserved.
  14 // Copyright (c) 2007-2008 Cisco Systems, Inc.  All rights reserved.
  15 // $COPYRIGHT$
  16 //
  17 // Additional copyrights may follow
  18 //
  19 // $HEADER$
  20 //
  21 
  22 
  23 
  24 //
  25 // Miscellany
  26 //
  27 
  28 
  29 inline MPI::Errhandler
  30 MPI::Win:: Get_errhandler() const
  31 {
  32     MPI_Errhandler errhandler;
  33     MPI_Win_get_errhandler(mpi_win, &errhandler);
  34     return errhandler;
  35 }
  36 
  37 
  38 inline void
  39 MPI::Win::Set_errhandler(const MPI::Errhandler& errhandler) const
  40 {
  41     (void)MPI_Win_set_errhandler(mpi_win, errhandler);
  42 }
  43 
  44 
  45 //
  46 // One sided communication
  47 //
  48 
  49 
  50 inline void
  51 MPI::Win::Accumulate(const void* origin_addr, int origin_count,
  52                 const MPI::Datatype& origin_datatype, int target_rank,
  53                 MPI::Aint target_disp, int target_count,
  54                 const MPI::Datatype& target_datatype,
  55                 const MPI::Op& op) const
  56 {
  57   (void) MPI_Accumulate(const_cast<void *>(origin_addr), origin_count, origin_datatype,
  58                         target_rank, target_disp, target_count,
  59                         target_datatype, op, mpi_win);
  60 
  61 }
  62 
  63 
  64 inline void
  65 MPI::Win::Complete() const
  66 {
  67   (void) MPI_Win_complete(mpi_win);
  68 }
  69 
  70 
  71 inline  MPI::Win
  72 MPI::Win::Create(const void* base, MPI::Aint size,
  73                         int disp_unit, const MPI::Info& info,
  74                         const MPI::Intracomm& comm)
  75 {
  76   MPI_Win newwin;
  77   (void) MPI_Win_create(const_cast<void *>(base), size, disp_unit, info, comm, &newwin);
  78   return newwin;
  79 }
  80 
  81 
  82 inline void
  83 MPI::Win::Fence(int assert) const
  84 {
  85   (void) MPI_Win_fence(assert, mpi_win);
  86 }
  87 
  88 
  89 inline void
  90 MPI::Win::Get(const void *origin_addr, int origin_count,
  91                      const MPI::Datatype& origin_datatype,
  92                      int target_rank, MPI::Aint target_disp,
  93                      int target_count,
  94                      const MPI::Datatype& target_datatype) const
  95 {
  96   (void) MPI_Get(const_cast<void *>(origin_addr), origin_count, origin_datatype,
  97                      target_rank, target_disp,
  98                      target_count, target_datatype, mpi_win);
  99 
 100 }
 101 
 102 
 103 inline MPI::Group
 104 MPI::Win::Get_group() const
 105 {
 106   MPI_Group mpi_group;
 107   (void) MPI_Win_get_group(mpi_win, &mpi_group);
 108   return mpi_group;
 109 }
 110 
 111 
 112 inline void
 113 MPI::Win::Lock(int lock_type, int rank, int assert) const
 114 {
 115   (void) MPI_Win_lock(lock_type, rank, assert, mpi_win);
 116 }
 117 
 118 
 119 inline void
 120 MPI::Win::Post(const MPI::Group& group, int assert) const
 121 {
 122   (void) MPI_Win_post(group, assert, mpi_win);
 123 }
 124 
 125 
 126 inline void
 127 MPI::Win::Put(const void* origin_addr, int origin_count,
 128                      const MPI::Datatype& origin_datatype,
 129                      int target_rank, MPI::Aint target_disp,
 130                      int target_count,
 131                      const MPI::Datatype& target_datatype) const
 132 {
 133   (void) MPI_Put(const_cast<void *>(origin_addr), origin_count, origin_datatype,
 134                  target_rank, target_disp, target_count,
 135                  target_datatype, mpi_win);
 136 
 137 }
 138 
 139 
 140 inline void
 141 MPI::Win::Start(const MPI::Group& group, int assert) const
 142 {
 143   (void) MPI_Win_start(group, assert, mpi_win);
 144 }
 145 
 146 
 147 inline bool
 148 MPI::Win::Test() const
 149 {
 150   int flag;
 151   MPI_Win_test(mpi_win, &flag);
 152   return OPAL_INT_TO_BOOL(flag);
 153 
 154 }
 155 
 156 
 157 inline void
 158 MPI::Win::Unlock(int rank) const
 159 {
 160   (void) MPI_Win_unlock(rank, mpi_win);
 161 }
 162 
 163 
 164 inline void
 165 MPI::Win::Wait() const
 166 {
 167   (void) MPI_Win_wait(mpi_win);
 168 }
 169 
 170 
 171 //
 172 // External Interfaces
 173 //
 174 
 175 inline void
 176 MPI::Win::Call_errhandler(int errorcode) const
 177 {
 178   (void) MPI_Win_call_errhandler(mpi_win, errorcode);
 179 }
 180 
 181 // 1) original Create_keyval that takes the first 2 arguments as C++
 182 //    functions
 183 inline int
 184 MPI::Win::Create_keyval(MPI::Win::Copy_attr_function* win_copy_attr_fn,
 185                              MPI::Win::Delete_attr_function* win_delete_attr_fn,
 186                              void* extra_state)
 187 {
 188     // Back-end function does the heavy lifting
 189     int ret, keyval;
 190     ret = do_create_keyval(NULL, NULL,
 191                            win_copy_attr_fn, win_delete_attr_fn,
 192                            extra_state, keyval);
 193     return (MPI_SUCCESS == ret) ? keyval : ret;
 194 }
 195 
 196 // 2) overload Create_keyval to take the first 2 arguments as C
 197 //    functions
 198 inline int
 199 MPI::Win::Create_keyval(MPI_Win_copy_attr_function* win_copy_attr_fn,
 200                              MPI_Win_delete_attr_function* win_delete_attr_fn,
 201                              void* extra_state)
 202 {
 203     // Back-end function does the heavy lifting
 204     int ret, keyval;
 205     ret = do_create_keyval(win_copy_attr_fn, win_delete_attr_fn,
 206                            NULL, NULL,
 207                            extra_state, keyval);
 208     return (MPI_SUCCESS == ret) ? keyval : ret;
 209 }
 210 
 211 // 3) overload Create_keyval to take the first 2 arguments as C++ & C
 212 //    functions
 213 inline int
 214 MPI::Win::Create_keyval(MPI::Win::Copy_attr_function* win_copy_attr_fn,
 215                              MPI_Win_delete_attr_function* win_delete_attr_fn,
 216                              void* extra_state)
 217 {
 218     // Back-end function does the heavy lifting
 219     int ret, keyval;
 220     ret = do_create_keyval(NULL, win_delete_attr_fn,
 221                            win_copy_attr_fn, NULL,
 222                            extra_state, keyval);
 223     return (MPI_SUCCESS == ret) ? keyval : ret;
 224 }
 225 
 226 // 4) overload Create_keyval to take the first 2 arguments as C & C++
 227 //    functions
 228 inline int
 229 MPI::Win::Create_keyval(MPI_Win_copy_attr_function* win_copy_attr_fn,
 230                              MPI::Win::Delete_attr_function* win_delete_attr_fn,
 231                              void* extra_state)
 232 {
 233     // Back-end function does the heavy lifting
 234     int ret, keyval;
 235     ret = do_create_keyval(win_copy_attr_fn, NULL,
 236                            NULL, win_delete_attr_fn,
 237                            extra_state, keyval);
 238     return (MPI_SUCCESS == ret) ? keyval : ret;
 239 }
 240 
 241 inline void
 242 MPI::Win::Delete_attr(int win_keyval)
 243 {
 244   (void) MPI_Win_delete_attr(mpi_win, win_keyval);
 245 }
 246 
 247 
 248 inline void
 249 MPI::Win::Free_keyval(int& win_keyval)
 250 {
 251   (void) MPI_Win_free_keyval(&win_keyval);
 252 }
 253 
 254 
 255 // version 1: pre-errata Get_attr (not correct, but probably nice to support
 256 inline bool
 257 MPI::Win::Get_attr(const Win& win, int win_keyval,
 258                          void* attribute_val) const
 259 {
 260   int ret;
 261   (void) MPI_Win_get_attr(win, win_keyval, attribute_val, &ret);
 262   return OPAL_INT_TO_BOOL(ret);
 263 }
 264 
 265 
 266 // version 2: post-errata Get_attr (correct, but no one seems to know about it)
 267 inline bool
 268 MPI::Win::Get_attr(int win_keyval, void* attribute_val) const
 269 {
 270   int ret;
 271   (void) MPI_Win_get_attr(mpi_win, win_keyval, attribute_val, &ret);
 272   return OPAL_INT_TO_BOOL(ret);
 273 }
 274 
 275 
 276 inline void
 277 MPI::Win::Get_name(char* win_name, int& resultlen) const
 278 {
 279   (void) MPI_Win_get_name(mpi_win, win_name, &resultlen);
 280 }
 281 
 282 
 283 inline void
 284 MPI::Win::Set_attr(int win_keyval, const void* attribute_val)
 285 {
 286   (void) MPI_Win_set_attr(mpi_win, win_keyval, const_cast<void *>(attribute_val));
 287 }
 288 
 289 
 290 inline void
 291 MPI::Win::Set_name(const char* win_name)
 292 {
 293   (void) MPI_Win_set_name(mpi_win, const_cast<char *>(win_name));
 294 }
 295 

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