Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix various linter errors #405

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions .github/config/lint/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
---
AccessModifierOffset: -1
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros:
- FOR_EACH_RANGE
- FOR_EACH
IncludeCategories:
- Regex: '^<.*\.h(pp)?>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
Macros:
- >-
PyObject_HEAD_INIT(type)={
/* this is not exactly match with PyObject_HEAD_INIT in Python source code
* but it is enough for clang-format */
{ 0xFFFFFFFF },
(type)
},
- >-
PyVarObject_HEAD_INIT(type, size)={
{
/* manually expand PyObject_HEAD_INIT(type) above
* because clang-format do not support recursive expansion */
{ 0xFFFFFFFF },
(type)
},
(size)
},
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 2000000
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++17
StatementMacros:
- C10_DEFINE_bool
- C10_DEFINE_int
- C10_DEFINE_int32
- C10_DEFINE_int64
- C10_DEFINE_string
- C10_DEFINE_REGISTRY_WITHOUT_WARNING
- C10_REGISTER_CREATOR
- DEFINE_BINARY
- PyObject_HEAD
- PyObject_VAR_HEAD
- PyException_HEAD
- TORCH_DECLARE_bool

TabWidth: 8
UseTab: Never
---
Language: ObjC
ColumnLimit: 120
AlignAfterOpenBracket: Align
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
...
126 changes: 126 additions & 0 deletions gloo/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
---
AccessModifierOffset: -1
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros:
- FOR_EACH_RANGE
- FOR_EACH
IncludeCategories:
- Regex: '^<.*\.h(pp)?>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
Macros:
- >-
PyObject_HEAD_INIT(type)={
/* this is not exactly match with PyObject_HEAD_INIT in Python source code
* but it is enough for clang-format */
{ 0xFFFFFFFF },
(type)
},
- >-
PyVarObject_HEAD_INIT(type, size)={
{
/* manually expand PyObject_HEAD_INIT(type) above
* because clang-format do not support recursive expansion */
{ 0xFFFFFFFF },
(type)
},
(size)
},
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 2000000
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++17
StatementMacros:
- C10_DEFINE_bool
- C10_DEFINE_int
- C10_DEFINE_int32
- C10_DEFINE_int64
- C10_DEFINE_string
- C10_DEFINE_REGISTRY_WITHOUT_WARNING
- C10_REGISTER_CREATOR
- DEFINE_BINARY
- PyObject_HEAD
- PyObject_VAR_HEAD
- PyException_HEAD
- TORCH_DECLARE_bool

TabWidth: 8
UseTab: Never
---
Language: ObjC
ColumnLimit: 120
AlignAfterOpenBracket: Align
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
...
14 changes: 10 additions & 4 deletions gloo/allreduce_bcube.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,11 @@ class Group {
* @count The total number of elements to be processed by this node
* @return The number of elements to be processed by this group
*/
static int
computeNumElems(int step, const Node& firstNode, int peers, int count) {
static int computeNumElems(
int step,
const Node& firstNode,
int peers,
int count) {
int groupCount =
(0 == step) ? count : firstNode.getNumElemsPerStep(step - 1);
return std::max(groupCount, peers);
Expand All @@ -226,8 +229,11 @@ class Group {
* group
* @return List of ranks of nodes in the group
*/
std::vector<int>
getNodeRanks(int firstNodeRank, int peerDistance, int base, int nodes) const {
std::vector<int> getNodeRanks(
int firstNodeRank,
int peerDistance,
int base,
int nodes) const {
std::vector<int> groupPeers;
for (int i = 0; i < base; ++i) {
int peerRank = firstNodeRank + i * peerDistance;
Expand Down
6 changes: 4 additions & 2 deletions gloo/alltoallv.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ class AlltoallvOptions {
size_t elementSize);

// Untemplated implementation of setInput on opaque pointer.
void
setInput(void* ptr, std::vector<int64_t> elementsPerRank, size_t elementSize);
void setInput(
void* ptr,
std::vector<int64_t> elementsPerRank,
size_t elementSize);

// Untemplated implementation of setOutput on unbound buffer.
void setOutput(
Expand Down
6 changes: 4 additions & 2 deletions gloo/common/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ inline void MakeStringInternal(
}

template <typename T, typename... Args>
inline void
MakeStringInternal(std::stringstream& ss, const T& t, const Args&... args) {
inline void MakeStringInternal(
std::stringstream& ss,
const T& t,
const Args&... args) {
MakeStringInternal(ss, t);
MakeStringInternal(ss, args...);
}
Expand Down
14 changes: 10 additions & 4 deletions gloo/cuda_allreduce_bcube.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,16 +389,22 @@ class Group {
* @count The total number of elements to be processed by this node
* @return The number of elements to be processed by this group
*/
static int
computeNumElems(int step, const Node& firstNode, int peers, int count);
static int computeNumElems(
int step,
const Node& firstNode,
int peers,
int count);
/**
* Determines all the nodes in a group in a particular step
* @param peerDistance This is the distance between rank of each peer in the
* group
* @return List of ranks of nodes in the group
*/
std::vector<int>
getNodeRanks(int firstNodeRank, int peerDistance, int base, int nodes) const;
std::vector<int> getNodeRanks(
int firstNodeRank,
int peerDistance,
int base,
int nodes) const;
};

} // namespace bcube
Expand Down
28 changes: 20 additions & 8 deletions gloo/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,35 @@ inline uint32_t log2ceil(uint32_t value) {

template <>
void sum<float16>(void* c, const void* a, const void* b, size_t n);
extern template void
sum<float16>(void* c, const void* a, const void* b, size_t n);
extern template void sum<float16>(
void* c,
const void* a,
const void* b,
size_t n);

template <>
void product<float16>(void* c, const void* a, const void* b, size_t n);
extern template void
product<float16>(void* c, const void* a, const void* b, size_t n);
extern template void product<float16>(
void* c,
const void* a,
const void* b,
size_t n);

template <>
void max<float16>(void* c, const void* a, const void* b, size_t n);
extern template void
max<float16>(void* c, const void* a, const void* b, size_t n);
extern template void max<float16>(
void* c,
const void* a,
const void* b,
size_t n);

template <>
void min<float16>(void* c, const void* a, const void* b, size_t n);
extern template void
min<float16>(void* c, const void* a, const void* b, size_t n);
extern template void min<float16>(
void* c,
const void* a,
const void* b,
size_t n);

#endif

Expand Down
Loading
Loading