root/ompi/mpi/tool/mpit-internal.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. mpit_is_initialized
  2. mpit_copy_string

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
   4  *                         reserved.
   5  * Copyright (c) 2011      UT-Battelle, LLC. All rights reserved.
   6  * Copyright (c) 2017      IBM Corporation. All rights reserved.
   7  * Copyright (c) 2018      Cisco Systems, Inc.  All rights reserved
   8  * $COPYRIGHT$
   9  *
  10  * Additional copyrights may follow
  11  *
  12  * $HEADER$
  13  */
  14 
  15 #if !defined(MPIT_INTERNAL_H)
  16 #define MPIT_INTERNAL_H
  17 
  18 #include "opal/util/string_copy.h"
  19 #include "opal/mca/base/mca_base_var.h"
  20 #include "opal/mca/base/mca_base_pvar.h"
  21 
  22 #include "ompi/include/ompi_config.h"
  23 #include "ompi/runtime/params.h"
  24 #include "ompi/communicator/communicator.h"
  25 #include "ompi/constants.h"
  26 #include "ompi/datatype/ompi_datatype.h"
  27 
  28 #include "mpi.h"
  29 
  30 #include <string.h>
  31 
  32 typedef struct ompi_mpit_cvar_handle_t {
  33     const mca_base_var_t *var;
  34     /* XXX -- TODO -- allow binding objects */
  35     void           *bound_object;
  36 } ompi_mpit_cvar_handle_t;
  37 
  38 void ompi_mpit_lock (void);
  39 void ompi_mpit_unlock (void);
  40 
  41 extern volatile uint32_t ompi_mpit_init_count;
  42 
  43 int ompit_var_type_to_datatype (mca_base_var_type_t type, MPI_Datatype *datatype);
  44 int ompit_opal_to_mpit_error (int rc);
  45 
  46 static inline int mpit_is_initialized (void)
  47 {
  48     return !!ompi_mpit_init_count;
  49 }
  50 
  51 static inline void mpit_copy_string (char *dest, int *len, const char *source)
  52 {
  53     if (NULL == len)
  54         return;
  55 
  56     if (NULL == source) {
  57         *len = 0;
  58         if (NULL != dest) {
  59             dest[0] = '\0';
  60         }
  61 
  62         return;
  63     }
  64 
  65     if (0 != *len && NULL != dest) {
  66         if ((int) strlen (source) < *len) {
  67             *len = strlen (source) + 1;
  68         }
  69 
  70         opal_string_copy (dest, source, *len);
  71     } else {
  72         *len = strlen (source) + 1;
  73     }
  74 }
  75 
  76 #endif /* !defined(MPIT_INTERNAL_H) */

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