root/ompi/message/message.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. ompi_message_alloc
  2. ompi_message_return

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2011-2012 Sandia National Laboratories. All rights reserved.
   4  * Copyright (c) 2012-2017 Cisco Systems, Inc.  All rights reserved
   5  * Copyright (c) 2015      Los Alamos National Security, LLC.  All rights
   6  *                         reserved.
   7  * $COPYRIGHT$
   8  *
   9  * Additional copyrights may follow
  10  *
  11  * $HEADER$
  12  */
  13 
  14 #ifndef OMPI_MESSAGE_H
  15 #define OMPI_MESSAGE_H
  16 
  17 #include "mpi.h"
  18 #include "opal/class/opal_free_list.h"
  19 #include "opal/class/opal_pointer_array.h"
  20 
  21 BEGIN_C_DECLS
  22 
  23 struct ompi_communicator_t;
  24 
  25 struct ompi_message_t {
  26     opal_free_list_item_t super;        /**< Base type */
  27     int m_f_to_c_index;                 /**< Fortran handle for this message */
  28     struct ompi_communicator_t *comm;   /**< communicator used in probe */
  29     void* req_ptr;                      /**< PML data */
  30     int peer;                           /**< peer, same as status.MPI_SOURCE */
  31     size_t count;                       /**< same value as status._ucount */
  32 };
  33 typedef struct ompi_message_t ompi_message_t;
  34 OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_message_t);
  35 
  36 /**
  37  * Padded struct to maintain back compatibiltiy.
  38  * See ompi/communicator/communicator.h comments with struct ompi_communicator_t
  39  * for full explanation why we chose the following padding construct for predefines.
  40  */
  41 #define PREDEFINED_MESSAGE_PAD 256
  42 
  43 struct ompi_predefined_message_t {
  44     struct ompi_message_t message;
  45     char padding[PREDEFINED_MESSAGE_PAD - sizeof(ompi_message_t)];
  46 };
  47 
  48 typedef struct ompi_predefined_message_t ompi_predefined_message_t;
  49 
  50 int ompi_message_init(void);
  51 
  52 int ompi_message_finalize(void);
  53 
  54 OMPI_DECLSPEC extern opal_free_list_t ompi_message_free_list;
  55 OMPI_DECLSPEC extern opal_pointer_array_t  ompi_message_f_to_c_table;
  56 OMPI_DECLSPEC extern ompi_predefined_message_t  ompi_message_no_proc;
  57 
  58 static inline
  59 ompi_message_t*
  60 ompi_message_alloc(void)
  61 {
  62     return (ompi_message_t *) opal_free_list_get (&ompi_message_free_list);
  63 }
  64 
  65 static inline
  66 void
  67 ompi_message_return(ompi_message_t* msg)
  68 {
  69     if (MPI_UNDEFINED != msg->m_f_to_c_index) {
  70         opal_pointer_array_set_item(&ompi_message_f_to_c_table,
  71                                     msg->m_f_to_c_index, NULL);
  72         msg->m_f_to_c_index = MPI_UNDEFINED;
  73     }
  74 
  75     opal_free_list_return (&ompi_message_free_list,
  76                            &msg->super);
  77 }
  78 
  79 
  80 END_C_DECLS
  81 
  82 #endif

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