Skip to content

Commit fdc3213

Browse files
committed
coll/cuda: rename to accelerator component
The cuda component now uses the opal accelerator framework and no longer has a direct association with cuda. In the spirit of vendor agnosticism, we rename this component to accelerator. related to #11918 Signed-off-by: Howard Pritchard <howardp@lanl.gov>
1 parent 77d7617 commit fdc3213

13 files changed

+179
-163
lines changed

ompi/mca/coll/accelerator/Makefile.am

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#
2+
# Copyright (c) 2014 The University of Tennessee and The University
3+
# of Tennessee Research Foundation. All rights
4+
# reserved.
5+
# Copyright (c) 2014 NVIDIA Corporation. 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+
dist_ompidata_DATA = help-mpi-coll-accelerator.txt
14+
15+
sources = coll_accelerator_module.c coll_accelerator_reduce.c coll_accelerator_allreduce.c \
16+
coll_accelerator_reduce_scatter_block.c coll_accelerator_component.c \
17+
coll_accelerator_scan.c coll_accelerator_exscan.c coll_accelerator.h
18+
19+
# Make the output library in this directory, and name it either
20+
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
21+
# (for static builds).
22+
23+
if MCA_BUILD_ompi_coll_accelerator_DSO
24+
component_noinst =
25+
component_install = mca_coll_accelerator.la
26+
else
27+
component_noinst = libmca_coll_accelerator.la
28+
component_install =
29+
endif
30+
31+
mcacomponentdir = $(ompilibdir)
32+
mcacomponent_LTLIBRARIES = $(component_install)
33+
mca_coll_accelerator_la_SOURCES = $(sources)
34+
mca_coll_accelerator_la_LDFLAGS = -module -avoid-version
35+
mca_coll_accelerator_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la
36+
37+
noinst_LTLIBRARIES = $(component_noinst)
38+
libmca_coll_accelerator_la_SOURCES =$(sources)
39+
libmca_coll_accelerator_la_LDFLAGS = -module -avoid-version
40+

ompi/mca/coll/cuda/coll_cuda.h renamed to ompi/mca/coll/accelerator/coll_accelerator.h

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
* of Tennessee Research Foundation. All rights
44
* reserved.
55
* Copyright (c) 2014-2015 NVIDIA Corporation. All rights reserved.
6+
* Copyright (c) 2024 Triad National Security, LLC. All rights reserved.
67
* $COPYRIGHT$
78
*
89
* Additional copyrights may follow
910
*
1011
* $HEADER$
1112
*/
1213

13-
#ifndef MCA_COLL_CUDA_EXPORT_H
14-
#define MCA_COLL_CUDA_EXPORT_H
14+
#ifndef MCA_COLL_ACCELERATOR_EXPORT_H
15+
#define MCA_COLL_ACCELERATOR_EXPORT_H
1516

1617
#include "ompi_config.h"
1718

@@ -31,43 +32,43 @@ BEGIN_C_DECLS
3132

3233
/* API functions */
3334

34-
int mca_coll_cuda_init_query(bool enable_progress_threads,
35+
int mca_coll_accelerator_init_query(bool enable_progress_threads,
3536
bool enable_mpi_threads);
3637
mca_coll_base_module_t
37-
*mca_coll_cuda_comm_query(struct ompi_communicator_t *comm,
38+
*mca_coll_accelerator_comm_query(struct ompi_communicator_t *comm,
3839
int *priority);
3940

40-
int mca_coll_cuda_module_enable(mca_coll_base_module_t *module,
41+
int mca_coll_accelerator_module_enable(mca_coll_base_module_t *module,
4142
struct ompi_communicator_t *comm);
4243

4344
int
44-
mca_coll_cuda_allreduce(const void *sbuf, void *rbuf, int count,
45+
mca_coll_accelerator_allreduce(const void *sbuf, void *rbuf, int count,
4546
struct ompi_datatype_t *dtype,
4647
struct ompi_op_t *op,
4748
struct ompi_communicator_t *comm,
4849
mca_coll_base_module_t *module);
4950

50-
int mca_coll_cuda_reduce(const void *sbuf, void *rbuf, int count,
51+
int mca_coll_accelerator_reduce(const void *sbuf, void *rbuf, int count,
5152
struct ompi_datatype_t *dtype,
5253
struct ompi_op_t *op,
5354
int root,
5455
struct ompi_communicator_t *comm,
5556
mca_coll_base_module_t *module);
5657

57-
int mca_coll_cuda_exscan(const void *sbuf, void *rbuf, int count,
58+
int mca_coll_accelerator_exscan(const void *sbuf, void *rbuf, int count,
5859
struct ompi_datatype_t *dtype,
5960
struct ompi_op_t *op,
6061
struct ompi_communicator_t *comm,
6162
mca_coll_base_module_t *module);
6263

63-
int mca_coll_cuda_scan(const void *sbuf, void *rbuf, int count,
64+
int mca_coll_accelerator_scan(const void *sbuf, void *rbuf, int count,
6465
struct ompi_datatype_t *dtype,
6566
struct ompi_op_t *op,
6667
struct ompi_communicator_t *comm,
6768
mca_coll_base_module_t *module);
6869

6970
int
70-
mca_coll_cuda_reduce_scatter_block(const void *sbuf, void *rbuf, int rcount,
71+
mca_coll_accelerator_reduce_scatter_block(const void *sbuf, void *rbuf, int rcount,
7172
struct ompi_datatype_t *dtype,
7273
struct ompi_op_t *op,
7374
struct ompi_communicator_t *comm,
@@ -83,7 +84,7 @@ mca_coll_cuda_reduce_scatter_block(const void *sbuf, void *rbuf, int rcount,
8384
* @retval >0 The buffer belongs to a managed buffer in
8485
* device memory.
8586
*/
86-
static inline int mca_coll_cuda_check_buf(void *addr)
87+
static inline int mca_coll_accelerator_check_buf(void *addr)
8788
{
8889
uint64_t flags;
8990
int dev_id;
@@ -94,13 +95,13 @@ static inline int mca_coll_cuda_check_buf(void *addr)
9495
}
9596
}
9697

97-
static inline void *mca_coll_cuda_memcpy(void *dest, const void *src, size_t size)
98+
static inline void *mca_coll_accelerator_memcpy(void *dest, const void *src, size_t size)
9899
{
99100
int res;
100101
res = opal_accelerator.mem_copy(MCA_ACCELERATOR_NO_DEVICE_ID, MCA_ACCELERATOR_NO_DEVICE_ID,
101102
dest, src, size, MCA_ACCELERATOR_TRANSFER_UNSPEC);
102103
if (res != 0) {
103-
opal_output(0, "CUDA: Error in cuMemcpy: res=%d, dest=%p, src=%p, size=%d", res, dest, src,
104+
opal_output(0, "coll/accelerator: Error in mem_copy: res=%d, dest=%p, src=%p, size=%d", res, dest, src,
104105
(int) size);
105106
abort();
106107
} else {
@@ -111,28 +112,28 @@ static inline void *mca_coll_cuda_memcpy(void *dest, const void *src, size_t siz
111112
/* Types */
112113
/* Module */
113114

114-
typedef struct mca_coll_cuda_module_t {
115+
typedef struct mca_coll_accelerator_module_t {
115116
mca_coll_base_module_t super;
116117

117118
/* Pointers to all the "real" collective functions */
118119
mca_coll_base_comm_coll_t c_coll;
119-
} mca_coll_cuda_module_t;
120+
} mca_coll_accelerator_module_t;
120121

121-
OBJ_CLASS_DECLARATION(mca_coll_cuda_module_t);
122+
OBJ_CLASS_DECLARATION(mca_coll_accelerator_module_t);
122123

123124
/* Component */
124125

125-
typedef struct mca_coll_cuda_component_t {
126+
typedef struct mca_coll_accelerator_component_t {
126127
mca_coll_base_component_2_4_0_t super;
127128

128129
int priority; /* Priority of this component */
129-
int disable_cuda_coll; /* Force disable of the CUDA collective component */
130-
} mca_coll_cuda_component_t;
130+
int disable_accelerator_coll; /* Force disable of the accelerator collective component */
131+
} mca_coll_accelerator_component_t;
131132

132133
/* Globally exported variables */
133134

134-
OMPI_DECLSPEC extern mca_coll_cuda_component_t mca_coll_cuda_component;
135+
OMPI_DECLSPEC extern mca_coll_accelerator_component_t mca_coll_accelerator_component;
135136

136137
END_C_DECLS
137138

138-
#endif /* MCA_COLL_CUDA_EXPORT_H */
139+
#endif /* MCA_COLL_ACCELERATOR_EXPORT_H */

ompi/mca/coll/cuda/coll_cuda_allreduce.c renamed to ompi/mca/coll/accelerator/coll_accelerator_allreduce.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* reserved.
55
* Copyright (c) 2014-2015 NVIDIA Corporation. All rights reserved.
66
* Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
7+
* Copyright (c) 2024 Triad National Security, LLC. All rights reserved.
78
* $COPYRIGHT$
89
*
910
* Additional copyrights may follow
@@ -12,7 +13,7 @@
1213
*/
1314

1415
#include "ompi_config.h"
15-
#include "coll_cuda.h"
16+
#include "coll_accelerator.h"
1617

1718
#include <stdio.h>
1819

@@ -27,20 +28,20 @@
2728
* Returns: - MPI_SUCCESS or error code
2829
*/
2930
int
30-
mca_coll_cuda_allreduce(const void *sbuf, void *rbuf, int count,
31+
mca_coll_accelerator_allreduce(const void *sbuf, void *rbuf, int count,
3132
struct ompi_datatype_t *dtype,
3233
struct ompi_op_t *op,
3334
struct ompi_communicator_t *comm,
3435
mca_coll_base_module_t *module)
3536
{
36-
mca_coll_cuda_module_t *s = (mca_coll_cuda_module_t*) module;
37+
mca_coll_accelerator_module_t *s = (mca_coll_accelerator_module_t*) module;
3738
ptrdiff_t gap;
3839
char *rbuf1 = NULL, *sbuf1 = NULL, *rbuf2 = NULL;
3940
size_t bufsize;
4041
int rc;
4142

4243
bufsize = opal_datatype_span(&dtype->super, count, &gap);
43-
rc = mca_coll_cuda_check_buf((void *)sbuf);
44+
rc = mca_coll_accelerator_check_buf((void *)sbuf);
4445
if (rc < 0) {
4546
return rc;
4647
}
@@ -49,10 +50,10 @@ mca_coll_cuda_allreduce(const void *sbuf, void *rbuf, int count,
4950
if (NULL == sbuf1) {
5051
return OMPI_ERR_OUT_OF_RESOURCE;
5152
}
52-
mca_coll_cuda_memcpy(sbuf1, sbuf, bufsize);
53+
mca_coll_accelerator_memcpy(sbuf1, sbuf, bufsize);
5354
sbuf = sbuf1 - gap;
5455
}
55-
rc = mca_coll_cuda_check_buf(rbuf);
56+
rc = mca_coll_accelerator_check_buf(rbuf);
5657
if (rc < 0) {
5758
return rc;
5859
}
@@ -62,7 +63,7 @@ mca_coll_cuda_allreduce(const void *sbuf, void *rbuf, int count,
6263
if (NULL != sbuf1) free(sbuf1);
6364
return OMPI_ERR_OUT_OF_RESOURCE;
6465
}
65-
mca_coll_cuda_memcpy(rbuf1, rbuf, bufsize);
66+
mca_coll_accelerator_memcpy(rbuf1, rbuf, bufsize);
6667
rbuf2 = rbuf; /* save away original buffer */
6768
rbuf = rbuf1 - gap;
6869
}
@@ -72,7 +73,7 @@ mca_coll_cuda_allreduce(const void *sbuf, void *rbuf, int count,
7273
}
7374
if (NULL != rbuf1) {
7475
rbuf = rbuf2;
75-
mca_coll_cuda_memcpy(rbuf, rbuf1, bufsize);
76+
mca_coll_accelerator_memcpy(rbuf, rbuf1, bufsize);
7677
free(rbuf1);
7778
}
7879
return rc;

ompi/mca/coll/cuda/coll_cuda_component.c renamed to ompi/mca/coll/accelerator/coll_accelerator_component.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Copyright (c) 2014-2015 NVIDIA Corporation. All rights reserved.
77
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
88
* reserved.
9+
* Copyright (c) 2024 Triad National Security, LLC. All rights reserved.
910
* $COPYRIGHT$
1011
*
1112
* Additional copyrights may follow
@@ -19,25 +20,25 @@
1920

2021
#include "mpi.h"
2122
#include "ompi/constants.h"
22-
#include "coll_cuda.h"
23+
#include "coll_accelerator.h"
2324

2425
/*
25-
* Public string showing the coll ompi_cuda component version number
26+
* Public string showing the coll ompi_accelerator component version number
2627
*/
27-
const char *mca_coll_cuda_component_version_string =
28-
"Open MPI cuda collective MCA component version " OMPI_VERSION;
28+
const char *mca_coll_accelerator_component_version_string =
29+
"Open MPI accelerator collective MCA component version " OMPI_VERSION;
2930

3031
/*
3132
* Local function
3233
*/
33-
static int cuda_register(void);
34+
static int accelerator_register(void);
3435

3536
/*
3637
* Instantiate the public struct with all of our public information
3738
* and pointers to our public functions in it
3839
*/
3940

40-
mca_coll_cuda_component_t mca_coll_cuda_component = {
41+
mca_coll_accelerator_component_t mca_coll_accelerator_component = {
4142
{
4243
/* First, the mca_component_t struct containing meta information
4344
* about the component itself */
@@ -46,12 +47,12 @@ mca_coll_cuda_component_t mca_coll_cuda_component = {
4647
MCA_COLL_BASE_VERSION_2_4_0,
4748

4849
/* Component name and version */
49-
.mca_component_name = "cuda",
50+
.mca_component_name = "accelerator",
5051
MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
5152
OMPI_RELEASE_VERSION),
5253

5354
/* Component open and close functions */
54-
.mca_register_component_params = cuda_register,
55+
.mca_register_component_params = accelerator_register,
5556
},
5657
.collm_data = {
5758
/* The component is checkpoint ready */
@@ -60,32 +61,32 @@ mca_coll_cuda_component_t mca_coll_cuda_component = {
6061

6162
/* Initialization / querying functions */
6263

63-
.collm_init_query = mca_coll_cuda_init_query,
64-
.collm_comm_query = mca_coll_cuda_comm_query,
64+
.collm_init_query = mca_coll_accelerator_init_query,
65+
.collm_comm_query = mca_coll_accelerator_comm_query,
6566
},
6667

67-
/* cuda-specific component information */
68+
/* accelerator-specific component information */
6869

6970
/* Priority: make it above all point to point collectives including self */
7071
.priority = 78,
7172
};
7273

7374

74-
static int cuda_register(void)
75+
static int accelerator_register(void)
7576
{
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",
77+
(void) mca_base_component_var_register(&mca_coll_accelerator_component.super.collm_version,
78+
"priority", "Priority of the accelerator coll component; only relevant if barrier_before or barrier_after is > 0",
7879
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
7980
OPAL_INFO_LVL_6,
8081
MCA_BASE_VAR_SCOPE_READONLY,
81-
&mca_coll_cuda_component.priority);
82+
&mca_coll_accelerator_component.priority);
8283

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.",
84+
(void) mca_base_component_var_register(&mca_coll_accelerator_component.super.collm_version,
85+
"disable_accelerator_coll", "Automatically handle the accelerator buffers for the MPI collective.",
8586
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
8687
OPAL_INFO_LVL_2,
8788
MCA_BASE_VAR_SCOPE_READONLY,
88-
&mca_coll_cuda_component.disable_cuda_coll);
89+
&mca_coll_accelerator_component.disable_accelerator_coll);
8990

9091
return OMPI_SUCCESS;
9192
}

0 commit comments

Comments
 (0)