root/ompi/mpiext/cr/c/quiesce_start.c

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

DEFINITIONS

This source file includes following definitions.
  1. OMPI_CR_Quiesce_start
  2. extract_info_into_datum

   1 /*
   2  * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2011      The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2012 Cisco Systems, Inc.  All rights reserved.
   9  * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
  10  * $COPYRIGHT$
  11  *
  12  * Additional copyrights may follow
  13  *
  14  * $HEADER$
  15  */
  16 #include "ompi_config.h"
  17 #include <stdio.h>
  18 
  19 #include "ompi/mpi/c/bindings.h"
  20 #include "ompi/info/info.h"
  21 #include "ompi/runtime/params.h"
  22 #include "ompi/communicator/communicator.h"
  23 #include "orte/mca/snapc/snapc.h"
  24 
  25 #include "ompi/mpiext/cr/c/mpiext_cr_c.h"
  26 
  27 static const char FUNC_NAME[] = "OMPI_CR_Quiesce_start";
  28 
  29 int OMPI_CR_Quiesce_start(MPI_Comm commP, MPI_Info *info)
  30 {
  31     int ret = MPI_SUCCESS;
  32     MPI_Comm comm = MPI_COMM_WORLD; /* Currently ignore provided comm */
  33     orte_snapc_base_request_op_t *datum = NULL;
  34     int my_rank;
  35 
  36     /* argument checking */
  37     if (MPI_PARAM_CHECK) {
  38         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  39     }
  40 
  41     /*
  42      * Setup the data structure for the operation
  43      */
  44     datum = OBJ_NEW(orte_snapc_base_request_op_t);
  45     datum->event = ORTE_SNAPC_OP_QUIESCE_START;
  46     datum->is_active = true;
  47 
  48     MPI_Comm_rank(comm, &my_rank);
  49     if( 0 == my_rank ) {
  50         datum->leader = OMPI_PROC_MY_NAME->vpid;
  51     } else {
  52         datum->leader = -1; /* Unknown from non-root ranks */
  53     }
  54 
  55     /*
  56      * All processes must make this call before it can start
  57      */
  58     MPI_Barrier(comm);
  59 
  60     /*
  61      * Leader sends the request
  62      */
  63     OPAL_CR_ENTER_LIBRARY();
  64     ret = orte_snapc.request_op(datum);
  65     /*ret = ompi_crcp_base_quiesce_start(info);*/
  66     if( OMPI_SUCCESS != ret ) {
  67         OBJ_RELEASE(datum);
  68         OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_OTHER,
  69                                FUNC_NAME);
  70     }
  71 
  72     OPAL_CR_EXIT_LIBRARY();
  73 
  74     datum->is_active = false;
  75     OBJ_RELEASE(datum);
  76 
  77     /*
  78      * (Old) info logic
  79      */
  80     /*opal_info_set((opal_info_t*)*info, "target", cur_datum.target_dir);*/
  81 
  82     return ret;
  83 }
  84 
  85 /*****************
  86  * Local Functions
  87  ******************/
  88 #if 0
  89 /* Info keys:
  90  *
  91  * - crs:
  92  *   none    = (Default) No CRS Service
  93  *   default = Whatever CRS service MPI chooses
  94  *   blcr    = BLCR
  95  *   self    = app level callbacks
  96  *
  97  * - cmdline:
  98  *   Command line to restart the process with.
  99  *   If empty, the user must manually enter it
 100  *
 101  * - target:
 102  *   Absolute path to the target directory.
 103  *
 104  * - handle:
 105  *   first   = Earliest checkpoint directory available
 106  *   last    = Most recent checkpoint directory available
 107  *   [global:local] = handle provided by the MPI library
 108  *
 109  * - restarting:
 110  *   0 = not restarting
 111  *   1 = restarting
 112  *
 113  * - checkpointing:
 114  *   0 = No need to prepare for checkpointing
 115  *   1 = MPI should prepare for checkpointing
 116  *
 117  * - inflight:
 118  *   default  = message
 119  *   message  = Drain inflight messages at the message level
 120  *   network  = Drain inflight messages at the network level (if possible)
 121  *
 122  * - user_space_mem:
 123  *   0 = Memory does not need to be managed
 124  *   1 = Memory must be in user space (i.e., not on network card
 125  *
 126  */
 127 static int extract_info_into_datum(opal_info_t *info, orte_snapc_base_quiesce_t *datum)
 128 {
 129     int info_flag = false;
 130     int max_crs_len = 32;
 131     bool info_bool = false;
 132     char *info_char = NULL;
 133 
 134     info_char = (char *) malloc(sizeof(char) * (OPAL_PATH_MAX+1));
 135 
 136     /*
 137      * Key: crs
 138      */
 139     opal_info_get(info, "crs", max_crs_len, info_char, &info_flag);
 140     if( info_flag) {
 141         datum->crs_name = strdup(info_char);
 142     }
 143 
 144     /*
 145      * Key: cmdline
 146      */
 147     opal_info_get(info, "cmdline", OPAL_PATH_MAX, info_char, &info_flag);
 148     if( info_flag) {
 149         datum->cmdline = strdup(info_char);
 150     }
 151 
 152     /*
 153      * Key: handle
 154      */
 155     opal_info_get(info, "handle", OPAL_PATH_MAX, info_char, &info_flag);
 156     if( info_flag) {
 157         datum->handle = strdup(info_char);
 158     }
 159 
 160     /*
 161      * Key: target
 162      */
 163     opal_info_get(info, "target", OPAL_PATH_MAX, info_char, &info_flag);
 164     if( info_flag) {
 165         datum->target_dir = strdup(info_char);
 166     }
 167 
 168     /*
 169      * Key: restarting
 170      */
 171     opal_info_get_bool(info, "restarting", &info_bool, &info_flag);
 172     if( info_flag ) {
 173         datum->restarting = info_bool;
 174     } else {
 175         datum->restarting = false;
 176     }
 177 
 178     /*
 179      * Key: checkpointing
 180      */
 181     opal_info_get_bool(info, "checkpointing", &info_bool, &info_flag);
 182     if( info_flag ) {
 183         datum->checkpointing = info_bool;
 184     } else {
 185         datum->checkpointing = false;
 186     }
 187 
 188     /*
 189      * Display all values
 190      */
 191     OPAL_OUTPUT_VERBOSE((3, mca_crcp_bkmrk_component.super.output_handle,
 192                          "crcp:bkmrk: %s extract_info: Info('crs' = '%s')",
 193                          OMPI_NAME_PRINT(OMPI_PROC_MY_NAME),
 194                          (NULL == datum->crs_name ? "Default (none)" : datum->crs_name)));
 195     OPAL_OUTPUT_VERBOSE((3, mca_crcp_bkmrk_component.super.output_handle,
 196                          "crcp:bkmrk: %s extract_info: Info('cmdline' = '%s')",
 197                          OMPI_NAME_PRINT(OMPI_PROC_MY_NAME),
 198                          (NULL == datum->cmdline ? "Default ()" : datum->cmdline)));
 199     OPAL_OUTPUT_VERBOSE((3, mca_crcp_bkmrk_component.super.output_handle,
 200                          "crcp:bkmrk: %s extract_info: Info('checkpointing' = '%c')",
 201                          OMPI_NAME_PRINT(OMPI_PROC_MY_NAME),
 202                          (datum->checkpointing ? 'T' : 'F')));
 203     OPAL_OUTPUT_VERBOSE((3, mca_crcp_bkmrk_component.super.output_handle,
 204                          "crcp:bkmrk: %s extract_info: Info('restarting' = '%c')",
 205                          OMPI_NAME_PRINT(OMPI_PROC_MY_NAME),
 206                          (datum->restarting ? 'T' : 'F')));
 207 
 208     if( NULL != info_char ) {
 209         free(info_char);
 210         info_char = NULL;
 211     }
 212 
 213     return OMPI_SUCCESS;
 214 }
 215 #endif

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