1 /*
2 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved.
13 * $COPYRIGHT$
14 *
15 * Additional copyrights may follow
16 *
17 * $HEADER$
18 */
19
20 #include "ompi_config.h"
21
22 #include <string.h>
23
24 #include "opal/util/output.h"
25
26 #include "mpi.h"
27 #include "ompi/constants.h"
28 #include "coll_sync.h"
29
30 /*
31 * Public string showing the coll ompi_sync component version number
32 */
33 const char *mca_coll_sync_component_version_string =
34 "Open MPI sync collective MCA component version " OMPI_VERSION;
35
36 /*
37 * Local function
38 */
39 static int sync_register(void);
40
41 /*
42 * Instantiate the public struct with all of our public information
43 * and pointers to our public functions in it
44 */
45
46 mca_coll_sync_component_t mca_coll_sync_component = {
47 {
48 /* First, the mca_component_t struct containing meta information
49 * about the component itself */
50
51 .collm_version = {
52 MCA_COLL_BASE_VERSION_2_0_0,
53
54 /* Component name and version */
55 .mca_component_name = "sync",
56 MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
57 OMPI_RELEASE_VERSION),
58
59 /* Component open and close functions */
60 .mca_register_component_params = sync_register
61 },
62 .collm_data = {
63 /* The component is checkpoint ready */
64 MCA_BASE_METADATA_PARAM_CHECKPOINT
65 },
66
67 /* Initialization / querying functions */
68
69 .collm_init_query = mca_coll_sync_init_query,
70 .collm_comm_query = mca_coll_sync_comm_query
71 },
72 };
73
74
75 static int sync_register(void)
76 {
77 mca_base_component_t *c = &mca_coll_sync_component.super.collm_version;
78
79 mca_coll_sync_component.priority = 50;
80 (void) mca_base_component_var_register(c, "priority",
81 "Priority of the sync coll component; only relevant if barrier_before or barrier_after is > 0",
82 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
83 OPAL_INFO_LVL_9,
84 MCA_BASE_VAR_SCOPE_READONLY,
85 &mca_coll_sync_component.priority);
86
87 mca_coll_sync_component.barrier_before_nops = 0;
88 (void) mca_base_component_var_register(c, "barrier_before",
89 "Do a synchronization before each Nth collective",
90 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
91 OPAL_INFO_LVL_9,
92 MCA_BASE_VAR_SCOPE_READONLY,
93 &mca_coll_sync_component.barrier_before_nops);
94
95 mca_coll_sync_component.barrier_after_nops = 0;
96 (void) mca_base_component_var_register(c, "barrier_after",
97 "Do a synchronization after each Nth collective",
98 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
99 OPAL_INFO_LVL_9,
100 MCA_BASE_VAR_SCOPE_READONLY,
101 &mca_coll_sync_component.barrier_after_nops);
102
103 return OMPI_SUCCESS;
104 }