Skip to content

Commit 7879d1c

Browse files
committed
Rename comm_error to error_msg in gpucontext
- Lint
1 parent 8129df3 commit 7879d1c

5 files changed

Lines changed: 180 additions & 198 deletions

File tree

src/gpuarray/buffer_collectives.h

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#ifndef GPUARRAY_BUFFER_COLLECTIVES_H
22
#define GPUARRAY_BUFFER_COLLECTIVES_H
33

4-
#include "gpuarray/config.h"
54
#include "gpuarray/buffer.h"
5+
#include "gpuarray/config.h"
66

77
#ifdef __cplusplus
88
extern "C" {
@@ -35,9 +35,9 @@ enum _gpucomm_reduce_ops {
3535
};
3636

3737
#define GA_COMM_ID_BYTES 128 // sizeof(gpucommCliqueId)
38-
/**
39-
* Dummy struct to define byte-array's length through a type
40-
*/
38+
/**
39+
* Dummy struct to define byte-array's length through a type
40+
*/
4141
typedef struct _gpucommCliqueId {
4242
char internal[GA_COMM_ID_BYTES];
4343
} gpucommCliqueId;
@@ -61,7 +61,6 @@ GPUARRAY_PUBLIC int gpucomm_new(gpucomm** comm, gpucontext* ctx,
6161
*/
6262
GPUARRAY_PUBLIC void gpucomm_free(gpucomm* comm);
6363

64-
6564
/**
6665
* \brief Returns nice error message concerning collectives array and buffer API.
6766
* \param ctx [gpucontext*] TODO
@@ -82,8 +81,7 @@ GPUARRAY_PUBLIC gpucontext* gpucomm_context(gpucomm* comm);
8281
* \param comm_id [gpucommCliqueId*]
8382
* \return int TODO
8483
*/
85-
GPUARRAY_PUBLIC int gpucomm_gen_clique_id(gpucontext* ctx,
86-
gpucommCliqueId* comm_id);
84+
GPUARRAY_PUBLIC int gpucomm_gen_clique_id(gpucontext* ctx, gpucommCliqueId* comm_id);
8785

8886
/**
8987
* \brief TODO
@@ -114,10 +112,9 @@ GPUARRAY_PUBLIC int gpucomm_get_rank(gpucomm* comm, int* rank);
114112
* \param comm [gpucomm*] TODO
115113
* \return int TODO
116114
*/
117-
GPUARRAY_PUBLIC int gpucomm_reduce(gpudata* src, size_t offsrc,
118-
gpudata* dest, size_t offdest,
119-
int count, int typecode, int opcode,
120-
int root, gpucomm* comm);
115+
GPUARRAY_PUBLIC int gpucomm_reduce(gpudata* src, size_t offsrc, gpudata* dest,
116+
size_t offdest, int count, int typecode,
117+
int opcode, int root, gpucomm* comm);
121118

122119
/**
123120
* \brief TODO
@@ -131,10 +128,9 @@ GPUARRAY_PUBLIC int gpucomm_reduce(gpudata* src, size_t offsrc,
131128
* \param comm [gpucomm*] TODO
132129
* \return int TODO
133130
*/
134-
GPUARRAY_PUBLIC int gpucomm_all_reduce(gpudata* src, size_t offsrc,
135-
gpudata* dest, size_t offdest,
136-
int count, int typecode, int opcode,
137-
gpucomm* comm);
131+
GPUARRAY_PUBLIC int gpucomm_all_reduce(gpudata* src, size_t offsrc, gpudata* dest,
132+
size_t offdest, int count, int typecode,
133+
int opcode, gpucomm* comm);
138134

139135
/**
140136
* \brief TODO
@@ -149,9 +145,8 @@ GPUARRAY_PUBLIC int gpucomm_all_reduce(gpudata* src, size_t offsrc,
149145
* \return int TODO
150146
*/
151147
GPUARRAY_PUBLIC int gpucomm_reduce_scatter(gpudata* src, size_t offsrc,
152-
gpudata* dest, size_t offdest,
153-
int count, int typecode, int opcode,
154-
gpucomm* comm);
148+
gpudata* dest, size_t offdest, int count,
149+
int typecode, int opcode, gpucomm* comm);
155150

156151
/**
157152
* \brief TODO
@@ -163,9 +158,8 @@ GPUARRAY_PUBLIC int gpucomm_reduce_scatter(gpudata* src, size_t offsrc,
163158
* \param comm [gpucomm*] TODO
164159
* \return int TODO
165160
*/
166-
GPUARRAY_PUBLIC int gpucomm_broadcast(gpudata* array, size_t offset,
167-
int count, int typecode,
168-
int root, gpucomm* comm);
161+
GPUARRAY_PUBLIC int gpucomm_broadcast(gpudata* array, size_t offset, int count,
162+
int typecode, int root, gpucomm* comm);
169163

170164
/**
171165
* \brief TODO
@@ -178,9 +172,8 @@ GPUARRAY_PUBLIC int gpucomm_broadcast(gpudata* array, size_t offset,
178172
* \param comm [gpucomm*] TODO
179173
* \return int TODO
180174
*/
181-
GPUARRAY_PUBLIC int gpucomm_all_gather(gpudata* src, size_t offsrc,
182-
gpudata* dest, size_t offdest,
183-
int count, int typecode,
175+
GPUARRAY_PUBLIC int gpucomm_all_gather(gpudata* src, size_t offsrc, gpudata* dest,
176+
size_t offdest, int count, int typecode,
184177
gpucomm* comm);
185178

186179
#ifdef __cplusplus

src/gpuarray/collectives.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#ifndef GPUARRAY_COLLECTIVES_H
22
#define GPUARRAY_COLLECTIVES_H
33

4-
#include <gpuarray/config.h>
54
#include <gpuarray/array.h>
65
#include <gpuarray/buffer_collectives.h>
6+
#include <gpuarray/config.h>
77

88
#ifdef __cplusplus
99
extern "C" {
@@ -25,8 +25,8 @@ extern "C" {
2525
* \param comm [gpucomm*] TODO
2626
* \return int TODO
2727
*/
28-
GPUARRAY_PUBLIC int GpuArray_reduce(const GpuArray* src, GpuArray* dest,
29-
int opcode, int root, gpucomm* comm);
28+
GPUARRAY_PUBLIC int GpuArray_reduce(const GpuArray* src, GpuArray* dest, int opcode,
29+
int root, gpucomm* comm);
3030

3131
/**
3232
* \brief TODO

src/gpuarray_buffer_collectives.c

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,104 @@
1-
#include "private.h"
2-
31
#include "gpuarray/buffer.h"
42
#include "gpuarray/buffer_collectives.h"
53
#include "gpuarray/error.h"
64

7-
int gpucomm_new(gpucomm** comm, gpucontext* ctx,
8-
gpucommCliqueId comm_id, int ndev, int rank) {
5+
#include "private.h"
6+
7+
int gpucomm_new(gpucomm** comm, gpucontext* ctx, gpucommCliqueId comm_id, int ndev,
8+
int rank)
9+
{
910
if (ctx->comm_ops == NULL) {
1011
*comm = NULL;
1112
return GA_UNSUPPORTED_ERROR;
1213
}
1314
return ctx->comm_ops->comm_new(comm, ctx, comm_id, ndev, rank);
1415
}
1516

16-
void gpucomm_free(gpucomm* comm) {
17+
void gpucomm_free(gpucomm* comm)
18+
{
1719
gpucontext* ctx = gpucomm_context(comm);
1820
if (ctx->comm_ops != NULL)
1921
ctx->comm_ops->comm_free(comm);
2022
}
2123

22-
const char* gpucomm_error(gpucontext* ctx) {
24+
const char* gpucomm_error(gpucontext* ctx)
25+
{
2326
if (ctx->comm_ops != NULL)
24-
return ctx->comm_error;
25-
return "No collective ops available, API error. Is a collectives library installed?";
26-
}
27-
28-
gpucontext* gpucomm_context(gpucomm* comm) {
29-
return ((partial_gpucomm*) comm)->ctx;
27+
return ctx->error_msg;
28+
return "No collective ops available, API error. Is a collectives library "
29+
"installed?";
3030
}
3131

32-
int gpucomm_gen_clique_id(gpucontext* ctx, gpucommCliqueId* comm_id) {
32+
gpucontext* gpucomm_context(gpucomm* comm) { return ((partial_gpucomm*)comm)->ctx; }
33+
int gpucomm_gen_clique_id(gpucontext* ctx, gpucommCliqueId* comm_id)
34+
{
3335
if (ctx->comm_ops == NULL)
3436
return GA_COMM_ERROR;
3537
return ctx->comm_ops->generate_clique_id(ctx, comm_id);
3638
}
3739

38-
int gpucomm_get_count(gpucomm* comm, int* count) {
40+
int gpucomm_get_count(gpucomm* comm, int* count)
41+
{
3942
gpucontext* ctx = gpucomm_context(comm);
4043
if (ctx->comm_ops == NULL)
4144
return GA_COMM_ERROR;
4245
return ctx->comm_ops->get_count(comm, count);
4346
}
4447

45-
int gpucomm_get_rank(gpucomm* comm, int* rank) {
48+
int gpucomm_get_rank(gpucomm* comm, int* rank)
49+
{
4650
gpucontext* ctx = gpucomm_context(comm);
4751
if (ctx->comm_ops == NULL)
4852
return GA_COMM_ERROR;
4953
return ctx->comm_ops->get_rank(comm, rank);
5054
}
5155

52-
int gpucomm_reduce(gpudata* src, size_t offsrc,
53-
gpudata* dest, size_t offdest,
54-
int count, int typecode, int opcode,
55-
int root, gpucomm* comm) {
56+
int gpucomm_reduce(gpudata* src, size_t offsrc, gpudata* dest, size_t offdest,
57+
int count, int typecode, int opcode, int root, gpucomm* comm)
58+
{
5659
gpucontext* ctx = gpucomm_context(comm);
5760
if (ctx->comm_ops == NULL)
5861
return GA_COMM_ERROR;
59-
return ctx->comm_ops->reduce(src, offsrc, dest, offdest,
60-
count, typecode, opcode, root, comm);
62+
return ctx->comm_ops->reduce(src, offsrc, dest, offdest, count, typecode, opcode,
63+
root, comm);
6164
}
6265

63-
int gpucomm_all_reduce(gpudata* src, size_t offsrc,
64-
gpudata* dest, size_t offdest,
65-
int count, int typecode, int opcode,
66-
gpucomm* comm) {
66+
int gpucomm_all_reduce(gpudata* src, size_t offsrc, gpudata* dest, size_t offdest,
67+
int count, int typecode, int opcode, gpucomm* comm)
68+
{
6769
gpucontext* ctx = gpucomm_context(comm);
6870
if (ctx->comm_ops == NULL)
6971
return GA_COMM_ERROR;
70-
return ctx->comm_ops->all_reduce(src, offsrc, dest, offdest,
71-
count, typecode, opcode, comm);
72+
return ctx->comm_ops->all_reduce(src, offsrc, dest, offdest, count, typecode,
73+
opcode, comm);
7274
}
7375

74-
int gpucomm_reduce_scatter(gpudata* src, size_t offsrc,
75-
gpudata* dest, size_t offdest,
76-
int count, int typecode, int opcode,
77-
gpucomm* comm) {
76+
int gpucomm_reduce_scatter(gpudata* src, size_t offsrc, gpudata* dest,
77+
size_t offdest, int count, int typecode, int opcode,
78+
gpucomm* comm)
79+
{
7880
gpucontext* ctx = gpucomm_context(comm);
7981
if (ctx->comm_ops == NULL)
8082
return GA_COMM_ERROR;
81-
return ctx->comm_ops->reduce_scatter(src, offsrc, dest, offdest,
82-
count, typecode, opcode, comm);
83+
return ctx->comm_ops->reduce_scatter(src, offsrc, dest, offdest, count, typecode,
84+
opcode, comm);
8385
}
8486

85-
int gpucomm_broadcast(gpudata* array, size_t offset,
86-
int count, int typecode,
87-
int root, gpucomm* comm) {
87+
int gpucomm_broadcast(gpudata* array, size_t offset, int count, int typecode,
88+
int root, gpucomm* comm)
89+
{
8890
gpucontext* ctx = gpucomm_context(comm);
8991
if (ctx->comm_ops == NULL)
9092
return GA_COMM_ERROR;
91-
return ctx->comm_ops->broadcast(array, offset,
92-
count, typecode, root, comm);
93+
return ctx->comm_ops->broadcast(array, offset, count, typecode, root, comm);
9394
}
9495

95-
int gpucomm_all_gather(gpudata* src, size_t offsrc,
96-
gpudata* dest, size_t offdest,
97-
int count, int typecode,
98-
gpucomm* comm) {
96+
int gpucomm_all_gather(gpudata* src, size_t offsrc, gpudata* dest, size_t offdest,
97+
int count, int typecode, gpucomm* comm)
98+
{
9999
gpucontext* ctx = gpucomm_context(comm);
100100
if (ctx->comm_ops == NULL)
101101
return GA_COMM_ERROR;
102-
return ctx->comm_ops->all_gather(src, offsrc, dest, offdest,
103-
count, typecode, comm);
102+
return ctx->comm_ops->all_gather(src, offsrc, dest, offdest, count, typecode,
103+
comm);
104104
}

0 commit comments

Comments
 (0)