root/ompi/mpi/tool/cvar_write.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_T_cvar_write

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
   4  *                         reserved.
   5  * Copyright (c) 2014 Cisco Systems, Inc.  All rights reserved.
   6  * Copyright (c) 2017      IBM Corporation. All rights reserved.
   7  * $COPYRIGHT$
   8  *
   9  * Additional copyrights may follow
  10  *
  11  * $HEADER$
  12  */
  13 
  14 #include "ompi/mpi/tool/mpit-internal.h"
  15 
  16 #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
  17 #pragma weak MPI_T_cvar_write = PMPI_T_cvar_write
  18 #endif
  19 
  20 #if OMPI_PROFILING_DEFINES
  21 #include "ompi/mpi/tool/profile/defines.h"
  22 #endif
  23 
  24 
  25 int MPI_T_cvar_write (MPI_T_cvar_handle handle, const void *buf)
  26 {
  27     int rc = MPI_SUCCESS;
  28 
  29     if (!mpit_is_initialized ()) {
  30         return MPI_T_ERR_NOT_INITIALIZED;
  31     }
  32 
  33     if (MPI_PARAM_CHECK && NULL == buf) {
  34         return MPI_ERR_ARG;
  35     }
  36 
  37     ompi_mpit_lock ();
  38 
  39     do {
  40         if (MCA_BASE_VAR_SCOPE_CONSTANT == handle->var->mbv_scope ||
  41             MCA_BASE_VAR_SCOPE_READONLY == handle->var->mbv_scope) {
  42             rc = MPI_T_ERR_CVAR_SET_NEVER;
  43             break;
  44         }
  45 
  46         if (!(MCA_BASE_VAR_FLAG_SETTABLE & handle->var->mbv_flags)) {
  47             rc = MPI_T_ERR_CVAR_SET_NOT_NOW;
  48             break;
  49         }
  50 
  51         rc = mca_base_var_set_value(handle->var->mbv_index, buf, sizeof(unsigned long long), MCA_BASE_VAR_SOURCE_SET, NULL);
  52         if (OPAL_SUCCESS != rc) {
  53             rc = MPI_T_ERR_CVAR_SET_NOT_NOW;
  54         }
  55     } while (0);
  56 
  57     ompi_mpit_unlock ();
  58 
  59     return rc;
  60 }

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