Skip to content

Commit 2f7d74b

Browse files
authored
Fix lint.sh (#652)
Exit 1 upon any errors from clang-format or black
1 parent b1a88d7 commit 2f7d74b

File tree

6 files changed

+41
-33
lines changed

6 files changed

+41
-33
lines changed

apps/nccl/audit-shim/audit_nccl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ extern "C" __attribute__((visibility("default"))) char *la_objsearch(const char
1414
strcmp(name, "librccl.so.1")) {
1515
return (char *)name;
1616
}
17-
return (char*)library;
17+
return (char *)library;
1818
}

apps/nccl/include/mscclpp/nccl.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ typedef struct ncclConfig_v21700 {
5858

5959
/* Config initializer must be assigned to initialize config structure when it is created.
6060
* Not initialized config will result in NCCL error. */
61-
#define NCCL_CONFIG_INITIALIZER \
62-
{ \
63-
sizeof(ncclConfig_t), /* size */ \
64-
0xcafebeef, /* magic */ \
65-
NCCL_VERSION(NCCL_MAJOR, NCCL_MINOR, NCCL_PATCH), /* version */ \
66-
NCCL_CONFIG_UNDEF_INT, /* blocking */ \
67-
NCCL_CONFIG_UNDEF_INT, /* cgaClusterSize */ \
68-
NCCL_CONFIG_UNDEF_INT, /* minCTAs */ \
69-
NCCL_CONFIG_UNDEF_INT, /* maxCTAs */ \
70-
NCCL_CONFIG_UNDEF_PTR, /* netName */ \
71-
NCCL_CONFIG_UNDEF_INT /* splitShare */ \
61+
#define NCCL_CONFIG_INITIALIZER \
62+
{ \
63+
sizeof(ncclConfig_t), /* size */ \
64+
0xcafebeef, /* magic */ \
65+
NCCL_VERSION(NCCL_MAJOR, NCCL_MINOR, NCCL_PATCH), /* version */ \
66+
NCCL_CONFIG_UNDEF_INT, /* blocking */ \
67+
NCCL_CONFIG_UNDEF_INT, /* cgaClusterSize */ \
68+
NCCL_CONFIG_UNDEF_INT, /* minCTAs */ \
69+
NCCL_CONFIG_UNDEF_INT, /* maxCTAs */ \
70+
NCCL_CONFIG_UNDEF_PTR, /* netName */ \
71+
NCCL_CONFIG_UNDEF_INT /* splitShare */ \
7272
}
7373

7474
/* This struct will be used by ncclGroupSimulateEnd() API to query information about simulation. */

apps/nccl/src/nccl.cu

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,26 +102,26 @@ static inline int mscclppNcclDlopenInit() {
102102
}
103103

104104
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, CommInitRank,
105-
ncclResult_t (*)(ncclComm_t*, int, ncclUniqueId, int));
106-
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, GetUniqueId, ncclResult_t (*)(ncclUniqueId*));
107-
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, CommDestroy, ncclResult_t (*)(ncclComm_t));
108-
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, CommUserRank, ncclResult_t (*)(ncclComm_t, int*));
105+
ncclResult_t(*)(ncclComm_t*, int, ncclUniqueId, int));
106+
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, GetUniqueId, ncclResult_t(*)(ncclUniqueId*));
107+
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, CommDestroy, ncclResult_t(*)(ncclComm_t));
108+
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, CommUserRank, ncclResult_t(*)(ncclComm_t, int*));
109109
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, AllReduce,
110-
ncclResult_t (*)(const void*, void*, size_t, ncclDataType_t, ncclRedOp_t, ncclComm_t, cudaStream_t));
110+
ncclResult_t(*)(const void*, void*, size_t, ncclDataType_t, ncclRedOp_t, ncclComm_t, cudaStream_t));
111111
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, AllGather,
112-
ncclResult_t (*)(const void*, void*, size_t, ncclDataType_t, ncclComm_t, cudaStream_t));
112+
ncclResult_t(*)(const void*, void*, size_t, ncclDataType_t, ncclComm_t, cudaStream_t));
113113
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, Broadcast,
114-
ncclResult_t (*)(const void*, void*, size_t, ncclDataType_t, int, ncclComm_t, cudaStream_t));
114+
ncclResult_t(*)(const void*, void*, size_t, ncclDataType_t, int, ncclComm_t, cudaStream_t));
115115
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, ReduceScatter,
116-
ncclResult_t (*)(const void*, void*, size_t, ncclDataType_t, ncclRedOp_t, ncclComm_t, cudaStream_t));
116+
ncclResult_t(*)(const void*, void*, size_t, ncclDataType_t, ncclRedOp_t, ncclComm_t, cudaStream_t));
117117
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, Reduce,
118-
ncclResult_t (*)(const void*, void*, size_t, ncclDataType_t, ncclRedOp_t, int, ncclComm_t, cudaStream_t));
118+
ncclResult_t(*)(const void*, void*, size_t, ncclDataType_t, ncclRedOp_t, int, ncclComm_t, cudaStream_t));
119119
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, Send,
120-
ncclResult_t (*)(const void*, size_t, ncclDataType_t, int, ncclComm_t, cudaStream_t));
120+
ncclResult_t(*)(const void*, size_t, ncclDataType_t, int, ncclComm_t, cudaStream_t));
121121
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, Recv,
122-
ncclResult_t (*)(void*, size_t, ncclDataType_t, int, ncclComm_t, cudaStream_t));
123-
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, GroupStart, ncclResult_t (*)());
124-
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, GroupEnd, ncclResult_t (*)());
122+
ncclResult_t(*)(void*, size_t, ncclDataType_t, int, ncclComm_t, cudaStream_t));
123+
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, GroupStart, ncclResult_t(*)());
124+
NCCL_DLSYM(mscclppNcclOps, mscclppNcclDlHandle, nccl, GroupEnd, ncclResult_t(*)());
125125

126126
return dlopenSuccess;
127127
}

src/algorithm.cc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ namespace mscclpp {
77

88
class Algorithm::Impl {
99
public:
10-
Impl(std::string name, std::string collective, Algorithm::InitFunc initFunc,
11-
Algorithm::KernelFunc kernelFunc, Algorithm::ContextInitFunc contextInitFunc,
12-
Algorithm::ContextKeyGenFunc contextKeyGenFunc)
10+
Impl(std::string name, std::string collective, Algorithm::InitFunc initFunc, Algorithm::KernelFunc kernelFunc,
11+
Algorithm::ContextInitFunc contextInitFunc, Algorithm::ContextKeyGenFunc contextKeyGenFunc)
1312
: name_(name),
1413
collective_(collective),
1514
initFunc_(initFunc),
@@ -31,8 +30,8 @@ class Algorithm::Impl {
3130
};
3231

3332
int Algorithm::Impl::launch(std::shared_ptr<mscclpp::Communicator> comm, const void* input, void* output, size_t count,
34-
int dtype, cudaStream_t stream,
35-
std::unordered_map<std::string, std::shared_ptr<void>>& extras) {
33+
int dtype, cudaStream_t stream,
34+
std::unordered_map<std::string, std::shared_ptr<void>>& extras) {
3635
if (!initialized_) {
3736
initFunc_(comm, extras);
3837
initialized_ = true;
@@ -62,12 +61,12 @@ std::string Algorithm::name() const { return impl_->name_; }
6261
std::string Algorithm::collective() const { return impl_->collective_; }
6362

6463
void AlgorithmCollection::registerAlgorithm(const std::string collective, const std::string algoName,
65-
Algorithm algorithm) {
64+
Algorithm algorithm) {
6665
this->algoMapByCollective_[collective][algoName] = algorithm;
6766
}
6867

6968
Algorithm AlgorithmCollection::selectAlgorithm(const std::string& collective, const void* input, void* output,
70-
size_t messageSize, int nRanksPerNode, int worldSize) {
69+
size_t messageSize, int nRanksPerNode, int worldSize) {
7170
Algorithm algo;
7271
if (algoSelector_) {
7372
algo = algoSelector_(algoMapByCollective_, collective, input, output, messageSize, nRanksPerNode, worldSize);

test/nvls_test.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ int main() {
151151
CUCHECK(cuMemMap((CUdeviceptr)uc_va, mcSize, 0, memhandle, 0));
152152
// set access on UC address
153153
CUCHECK(cuMemSetAccess((CUdeviceptr)uc_va, mcSize, &accessDesc, 1));
154-
//Memset uc space
154+
// Memset uc space
155155
cudaMemset(uc_va, 0, mcSize);
156156

157157
// everyone binds memory to the multicast

tools/lint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ PROJECT_ROOT=$(dirname "$(realpath "$0")")/..
44
LINT_CPP=false
55
LINT_PYTHON=false
66
DRY_RUN=false
7+
EXIT_CODE=0
78

89
usage() {
910
echo "Usage: $0 [cpp] [py] [dry]"
@@ -48,6 +49,9 @@ if $LINT_CPP; then
4849
else
4950
clang-format -style=file -i $files
5051
fi
52+
if [ $? -ne 0 ]; then
53+
EXIT_CODE=1
54+
fi
5155
fi
5256
fi
5357

@@ -61,5 +65,10 @@ if $LINT_PYTHON; then
6165
else
6266
python3 -m black $files
6367
fi
68+
if [ $? -ne 0 ]; then
69+
EXIT_CODE=1
70+
fi
6471
fi
6572
fi
73+
74+
exit $EXIT_CODE

0 commit comments

Comments
 (0)