1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2014 The University of Tennessee and The University
4 * of Tennessee Research Foundation. All rights
5 * reserved.
6 * Copyright (c) 2014-2015 NVIDIA Corporation. All rights reserved.
7 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
8 * reserved.
9 * $COPYRIGHT$
10 *
11 * Additional copyrights may follow
12 *
13 * $HEADER$
14 */
15
16 #include "ompi_config.h"
17
18 #include <string.h>
19
20 #include "mpi.h"
21 #include "ompi/constants.h"
22 #include "coll_cuda.h"
23
24 /*
25 * Public string showing the coll ompi_cuda component version number
26 */
27 const char *mca_coll_cuda_component_version_string =
28 "Open MPI cuda collective MCA component version " OMPI_VERSION;
29
30 /*
31 * Local function
32 */
33 static int cuda_register(void);
34
35 /*
36 * Instantiate the public struct with all of our public information
37 * and pointers to our public functions in it
38 */
39
40 mca_coll_cuda_component_t mca_coll_cuda_component = {
41 {
42 /* First, the mca_component_t struct containing meta information
43 * about the component itself */
44
45 .collm_version = {
46 MCA_COLL_BASE_VERSION_2_0_0,
47
48 /* Component name and version */
49 .mca_component_name = "cuda",
50 MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
51 OMPI_RELEASE_VERSION),
52
53 /* Component open and close functions */
54 .mca_register_component_params = cuda_register,
55 },
56 .collm_data = {
57 /* The component is checkpoint ready */
58 MCA_BASE_METADATA_PARAM_CHECKPOINT
59 },
60
61 /* Initialization / querying functions */
62
63 .collm_init_query = mca_coll_cuda_init_query,
64 .collm_comm_query = mca_coll_cuda_comm_query,
65 },
66
67 /* cuda-specific component information */
68
69 /* Priority: make it above all point to point collectives including self */
70 78,
71 };
72
73
74 static int cuda_register(void)
75 {
76 (void) mca_base_component_var_register(&mca_coll_cuda_component.super.collm_version,
77 "priority", "Priority of the cuda coll component; only relevant if barrier_before or barrier_after is > 0",
78 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
79 OPAL_INFO_LVL_6,
80 MCA_BASE_VAR_SCOPE_READONLY,
81 &mca_coll_cuda_component.priority);
82
83 (void) mca_base_component_var_register(&mca_coll_cuda_component.super.collm_version,
84 "disable_cuda_coll", "Automatically handle the CUDA buffers for the MPI collective.",
85 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
86 OPAL_INFO_LVL_2,
87 MCA_BASE_VAR_SCOPE_READONLY,
88 &mca_coll_cuda_component.disable_cuda_coll);
89
90 return OMPI_SUCCESS;
91 }