1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2004-2010 The Trustees of Indiana University.
4 * All rights reserved.
5 * Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
6 * All rights reserved.
7 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
8 * University of Stuttgart. All rights reserved.
9 * Copyright (c) 2004-2005 The Regents of the University of California.
10 * All rights reserved.
11 * Copyright (c) 2007 Evergrid, Inc. All rights reserved.
12 * Copyright (c) 2011-2013 Los Alamos National Security, LLC.
13 * All rights reserved.
14 * Copyright (c) 2015 Research Organization for Information Science
15 * and Technology (RIST). All rights reserved.
16 *
17 * $COPYRIGHT$
18 *
19 * Additional copyrights may follow
20 *
21 * $HEADER$
22 */
23
24 #include "opal_config.h"
25
26 #include "opal/mca/base/base.h"
27 #include "opal/mca/crs/base/base.h"
28
29 #include "opal/mca/crs/base/static-components.h"
30
31 /*
32 * Globals
33 */
34 opal_crs_base_module_t opal_crs = {
35 NULL, /* crs_init */
36 NULL, /* crs_finalize */
37 NULL, /* crs_checkpoint */
38 NULL, /* crs_restart_cmd */
39 NULL, /* crs_disable_checkpoint */
40 NULL, /* crs_enable_checkpoint */
41 NULL, /* crs_prelaunch */
42 NULL /* crs_reg_thread */
43 };
44
45 opal_crs_base_component_t opal_crs_base_selected_component = {{0}};
46
47 extern bool opal_crs_base_do_not_select;
48 static int opal_crs_base_register(mca_base_register_flag_t flags);
49
50 /* Use default select */
51 MCA_BASE_FRAMEWORK_DECLARE(opal, crs, "Checkpoint and Restart Service (CRS)",
52 opal_crs_base_register, opal_crs_base_open,
53 opal_crs_base_close, mca_crs_base_static_components, 0);
54
55 static int opal_crs_base_register(mca_base_register_flag_t flags)
56 {
57 int ret;
58 /*
59 * Note: If we are a tool, then we will manually run the selection routine
60 * for the checkpointer. The tool will set the MCA parameter
61 * 'crs_base_do_not_select' before opal_init and then reset it after to
62 * disable the selection logic.
63 * This is useful for opal_restart because it reads the metadata file
64 * that indicates the checkpointer to be used after calling opal_init.
65 * Therefore it would need to select a specific module, but it doesn't
66 * know which one until later. It will set the MCA parameter 'crs'
67 * before calling select.
68 */
69 ret = mca_base_framework_var_register(&opal_crs_base_framework, "do_not_select",
70 "Do not do the selection of the CRS component",
71 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE |
72 MCA_BASE_VAR_FLAG_INTERNAL, OPAL_INFO_LVL_9,
73 MCA_BASE_VAR_SCOPE_ALL_EQ, &opal_crs_base_do_not_select);
74
75 return (0 > ret) ? ret : OPAL_SUCCESS;
76 }
77
78 /**
79 * Function for finding and opening either all MCA components,
80 * or the one that was specifically requested via a MCA parameter.
81 */
82 int opal_crs_base_open(mca_base_open_flag_t flags)
83 {
84 if(!opal_cr_is_enabled) {
85 opal_output_verbose(10, opal_crs_base_framework.framework_output,
86 "crs:open: FT is not enabled, skipping!");
87 return OPAL_SUCCESS;
88 }
89
90 return mca_base_framework_components_open(&opal_crs_base_framework, flags);
91 }