-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add clang tidy #129
base: dev
Are you sure you want to change the base?
Add clang tidy #129
Changes from all commits
a3e2015
c296f83
706c9ff
08e2d5b
d41a133
47b6b4d
877a47d
0c789b5
31fc0b2
0969a39
b95b5e9
88a8665
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
Checks: 'clang-diagnostic-*, | ||
clang-analyzer-*, | ||
cppcoreguidelines-*, | ||
modernize-*, | ||
bugprone-*, | ||
performance-*, | ||
readability-*, | ||
llvm-*, | ||
-cppcoreguidelines-macro-usage, | ||
-llvm-header-guard, | ||
-modernize-use-trailing-return-type, | ||
-readability-static-accessed-through-instance, | ||
-readability-named-parameter' | ||
WarningsAsErrors: '' | ||
HeaderFilterRegex: '' | ||
AnalyzeTemporaryDtors: false | ||
FormatStyle: none | ||
CheckOptions: | ||
- key: cert-dcl16-c.NewSuffixes | ||
value: 'L;LL;LU;LLU' | ||
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField | ||
value: '0' | ||
- key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons | ||
value: '0' | ||
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors | ||
value: '1' | ||
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic | ||
value: '1' | ||
- key: google-readability-braces-around-statements.ShortStatementLines | ||
value: '1' | ||
- key: google-readability-function-size.StatementThreshold | ||
value: '800' | ||
- key: google-readability-namespace-comments.ShortNamespaceLines | ||
value: '10' | ||
- key: google-readability-namespace-comments.SpacesBeforeComments | ||
value: '2' | ||
- key: llvm-else-after-return.WarnOnConditionVariables | ||
value: '0' | ||
- key: llvm-else-after-return.WarnOnUnfixable | ||
value: '0' | ||
- key: llvm-qualified-auto.AddConstToQualified | ||
value: '0' | ||
- key: modernize-loop-convert.MaxCopySize | ||
value: '16' | ||
- key: modernize-loop-convert.MinConfidence | ||
value: reasonable | ||
- key: modernize-loop-convert.NamingStyle | ||
value: CamelCase | ||
- key: modernize-pass-by-value.IncludeStyle | ||
value: llvm | ||
- key: modernize-replace-auto-ptr.IncludeStyle | ||
value: llvm | ||
- key: modernize-use-nullptr.NullMacros | ||
value: 'NULL' | ||
- key: readability-identifier-length.IgnoredParameterNames | ||
value: 'mr|os' | ||
- key: readability-identifier-length.IgnoredVariableNames | ||
value: 'mr|_' | ||
#- key: readability-function-cognitive-complexity.IgnoreMacros | ||
# value: '1' | ||
- key: bugprone-easily-swappable-parameters.IgnoredParameterNames | ||
value: 'alignment' | ||
- key: cppcoreguidelines-avoid-magic-numbers.IgnorePowersOf2IntegerValues | ||
value: '1' | ||
- key: readability-magic-numbers.IgnorePowersOf2IntegerValues | ||
value: '1' | ||
... |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,9 @@ class cuda_event_timer { | |
* every iteration. | ||
* @param[in] stream_ The CUDA stream we are measuring time on. | ||
*/ | ||
cuda_event_timer(benchmark::State &state, bool flush_l2_cache = false, cudaStream_t stream = 0) | ||
cuda_event_timer(benchmark::State& state, | ||
bool flush_l2_cache = false, | ||
cudaStream_t stream = nullptr) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default stream is commonly represented by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
: p_state(&state), stream_(stream) | ||
{ | ||
// flush all of L2$ | ||
|
@@ -95,7 +97,7 @@ class cuda_event_timer { | |
|
||
if (l2_cache_bytes > 0) { | ||
const int memset_value = 0; | ||
int *l2_cache_buffer = nullptr; | ||
int* l2_cache_buffer = nullptr; | ||
BENCH_CUDA_TRY(cudaMalloc(&l2_cache_buffer, l2_cache_bytes)); | ||
BENCH_CUDA_TRY(cudaMemsetAsync(l2_cache_buffer, memset_value, l2_cache_bytes, stream_)); | ||
BENCH_CUDA_TRY(cudaFree(l2_cache_buffer)); | ||
|
@@ -128,5 +130,5 @@ class cuda_event_timer { | |
cudaEvent_t start_; | ||
cudaEvent_t stop_; | ||
cudaStream_t stream_; | ||
benchmark::State *p_state; | ||
}; | ||
benchmark::State* p_state; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
# Copyright (c) 2018-2021, NVIDIA CORPORATION. | ||
|
||
# Ignore errors and set path | ||
set +e | ||
PATH=/conda/bin:$PATH | ||
LC_ALL=C.UTF-8 | ||
LANG=C.UTF-8 | ||
|
||
# Activate common conda env | ||
. /opt/conda/etc/profile.d/conda.sh | ||
conda activate rapids | ||
|
||
# Run clang-format and check for a consistent code format | ||
CLANG_FORMAT=`python scripts/run-clang-format.py 2>&1` | ||
CLANG_FORMAT_RETVAL=$? | ||
|
||
if [ "$CLANG_FORMAT_RETVAL" != "0" ]; then | ||
echo -e "\n\n>>>> FAILED: clang format check; begin output\n\n" | ||
echo -e "$CLANG_FORMAT" | ||
echo -e "\n\n>>>> FAILED: clang format check; end output\n\n" | ||
else | ||
echo -e "\n\n>>>> PASSED: clang format check\n\n" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also enables us to use other development tools that use the
clangd
language server. Awesome!