Skip to content

Commit

Permalink
Googlebenchmark integration (#277)
Browse files Browse the repository at this point in the history
* Fix CI

* add clang format file and ci lint stage

* Use googlebenchmark for the generate benchmark

Instead of an ad-hoc reporting format, use the googlebenchmark library to define, filter and execute benchmarks.
Custom context information is also added to the benchmark for archival reasons similar to rocPRIM.
Googlebenchmark is automatically downloaded if not found when benchmarks are enabled.

* Workaround broken hip headers included from host compiler in package test

The hip headers have device only code visible to the host compiler on
the nvcc path. Package test is compiled with just the host compiler
because its only using the host api of rocrand. This workaround sets it
to CUDA mode in the nvcc path until the fix for hip headers is released.

Modernize to CUDA language instead of FindCuda.cmake.

* Revert workaround for `ROCM_SYMLINK_LIBS`

The underlying issue has been fixed in latest rocm-cmake.

* Fix shebang of check-format.sh using env

On some distributions (notable ones include alpine and nixos) `bash`
is not part of the base installation, therefore its not installed in `/bin`.
Use `env` to find bash in the `PATH` which is portable on most *nix
systems.

* Separate new and legacy benchmarks with a cmake option

Restore the old `bencmark_rocrand_generate` for backwards compatibility.
Add the googlebenchmark based version as `benchmark_rocrand_host_api`.
Building the old benchmark can be enabled by setting `BUILD_LEGACY_BENCHMARK`
to `ON` (on by default).
A later change can change the default and then finally remove the old
benchmarks giving users time to adjust to the changes.

* Use the new benchmark name for the host api benchmark

* Add deprecation for BUILD_LEGACY_BENCHMARK

* Drop googlebenchmark compiler override

The underlying issue has been fixed in v1.5.5 with
google/benchmark#1174. The workaround is no
longer needed.

* Fixes to enable benchmark build on Windows (#282)

* add new generators to changed benchmarks

* Windows googlebench ci fix (#294)

* Update windows compiler for googlebenchmark

* Fix line indentations

Co-authored-by: Lőrinc Serfőző <[email protected]>
Co-authored-by: Nol Moonen <[email protected]>
Co-authored-by: Bibrak Qamar <[email protected]>
Co-authored-by: Máté Ferenc Nagy-Egri <[email protected]>
Co-authored-by: Stanley Tsang <[email protected]>
  • Loading branch information
6 people authored Sep 27, 2022
1 parent fbef7d8 commit 622e20e
Show file tree
Hide file tree
Showing 15 changed files with 1,205 additions and 375 deletions.
140 changes: 140 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Style file for MLSE Libraries based on the modified rocBLAS style

# Common settings
BasedOnStyle: WebKit
TabWidth: 4
IndentWidth: 4
UseTab: Never
ColumnLimit: 100
UseCRLF: false

# Other languages JavaScript, Proto

---
Language: Cpp

# http://releases.llvm.org/6.0.1/tools/clang/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code
# int formatted_code;
# // clang-format off
# void unformatted_code ;
# // clang-format on
# void formatted_code_again;

DisableFormat: false
Standard: Cpp11

AccessModifierOffset: -4
AlignAfterOpenBracket: true
AlignArrayOfStructures: Right
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros: ['HIPRANDAPI', 'QUALIFIERS', 'FQUALIFIERS']
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: Both

# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom
# Control of individual brace wrapping cases
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
AfterExternBlock: false
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: true
BeforeWhile: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false

BreakBeforeBinaryOperators: All
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakStringLiterals: true
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: false
DerivePointerAlignment: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IfMacros: []
IncludeBlocks: Preserve
IndentAccessModifiers: false
IndentCaseBlocks: true
IndentCaseLabels: true
IndentExternBlock: NoIndent
IndentPPDirectives: BeforeHash
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PPIndentWidth: -1
PackConstructorInitializers: NextLine
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: false
ShortNamespaceLines: 0
SortIncludes: CaseSensitive
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: Never
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
---
8 changes: 8 additions & 0 deletions .githooks/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

cd "$(git rev-parse --git-dir)"
cd hooks

echo "Installing hooks..."
ln -s ../../.githooks/pre-commit pre-commit
echo "Done!"
12 changes: 12 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# Redirect output to stderr.
exec 1>&2

# Do the code format check
if ! "$(git rev-parse --show-toplevel)/scripts/code-format/check-format.sh" HEAD --cached 1>&2; then
printf "
Pre-commit check failed, please fix the reported errors.
Note: Use '\033[33mgit commit --no-verify\033[0m' to bypass checks.\n"
exit 1
fi
42 changes: 0 additions & 42 deletions .gitlab-ci-gputest.yml

This file was deleted.

Loading

0 comments on commit 622e20e

Please sign in to comment.