-
Notifications
You must be signed in to change notification settings - Fork 49
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 NVTX C++ wrappers #2
Changes from 12 commits
b1d8ea8
8aa5ce4
c644e3e
a6021df
6cd7d64
0086b6f
42f1fbf
93698a1
b6d0441
4f75b6f
e2e17c2
db90682
140782f
72d2c43
5ce9414
d4aedca
2aae81f
f507556
1774836
bdaf419
e82b298
0ba005e
5c92197
38bc1a0
514543a
8a54e24
2a94775
5be7445
fd92c41
e610b88
52e43a3
016bf7f
eb2e0a0
331efea
38e155d
48d9679
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,155 @@ | ||
--- | ||
# Refer to the following link for the explanation of each params: | ||
# http://releases.llvm.org/8.0.0/tools/clang/docs/ClangFormatStyleOptions.html | ||
Language: Cpp | ||
# BasedOnStyle: Google | ||
AccessModifierOffset: -1 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: true | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlines: Left | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: true | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: All | ||
AllowShortIfStatementsOnASingleLine: true | ||
AllowShortLoopsOnASingleLine: true | ||
# This is deprecated | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: Yes | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BraceWrapping: | ||
AfterClass: false | ||
AfterControlStatement: false | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
AfterExternBlock: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
# disabling the below splits, else, they'll just add to the vertical length of source files! | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
SplitEmptyNamespace: false | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: WebKit | ||
BreakBeforeInheritanceComma: false | ||
BreakInheritanceList: BeforeColon | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakConstructorInitializers: BeforeColon | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: true | ||
ColumnLimit: 100 | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
# Kept the below 2 to be the same as `IndentWidth` to keep everything uniform | ||
ConstructorInitializerIndentWidth: 2 | ||
ContinuationIndentWidth: 2 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: true | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: true | ||
ForEachMacros: | ||
- foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
IncludeBlocks: Preserve | ||
IncludeCategories: | ||
- Regex: '^<ext/.*\.h>' | ||
Priority: 2 | ||
- Regex: '^<.*\.h>' | ||
Priority: 1 | ||
- Regex: '^<.*' | ||
Priority: 2 | ||
- Regex: '.*' | ||
Priority: 3 | ||
IncludeIsMainRegex: '([-_](test|unittest))?$' | ||
IndentCaseLabels: true | ||
IndentPPDirectives: None | ||
IndentWidth: 2 | ||
IndentWrappedFunctionNames: false | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBinPackProtocolList: Never | ||
ObjCBlockIndentWidth: 2 | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 1 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyBreakTemplateDeclaration: 10 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 200 | ||
PointerAlignment: Left | ||
RawStringFormats: | ||
- Language: Cpp | ||
Delimiters: | ||
- cc | ||
- CC | ||
- cpp | ||
- Cpp | ||
- CPP | ||
- 'c++' | ||
- 'C++' | ||
CanonicalDelimiter: '' | ||
- Language: TextProto | ||
Delimiters: | ||
- pb | ||
- PB | ||
- proto | ||
- PROTO | ||
EnclosingFunctions: | ||
- EqualsProto | ||
- EquivToProto | ||
- PARSE_PARTIAL_TEXT_PROTO | ||
- PARSE_TEST_PROTO | ||
- PARSE_TEXT_PROTO | ||
- ParseTextOrDie | ||
- ParseTextProtoOrDie | ||
CanonicalDelimiter: '' | ||
BasedOnStyle: google | ||
# Enabling comment reflow causes doxygen comments to be messed up in their formats! | ||
ReflowComments: true | ||
SortIncludes: true | ||
SortUsingDeclarations: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterTemplateKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 2 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Cpp11 | ||
StatementMacros: | ||
- Q_UNUSED | ||
- QT_REQUIRE_VERSION | ||
# Be consistent with indent-width, even for people who use tab for indentation! | ||
TabWidth: 2 | ||
UseTab: Never |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build/ | ||
docs/html/ | ||
docs/index.html | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,110 @@ | ||||||||||||||||||||||
#============================================================================= | ||||||||||||||||||||||
# Copyright (c) 2020, NVIDIA CORPORATION. | ||||||||||||||||||||||
# | ||||||||||||||||||||||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||
# you may not use this file except in compliance with the License. | ||||||||||||||||||||||
# You may obtain a copy of the License at | ||||||||||||||||||||||
# | ||||||||||||||||||||||
# http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||
# | ||||||||||||||||||||||
# Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||
# distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||
# See the License for the specific language governing permissions and | ||||||||||||||||||||||
# limitations under the License. | ||||||||||||||||||||||
#============================================================================= | ||||||||||||||||||||||
cmake_minimum_required(VERSION 3.12 FATAL_ERROR) | ||||||||||||||||||||||
|
||||||||||||||||||||||
project(NVTX VERSION 0.1.0 LANGUAGES C CXX CUDA) | ||||||||||||||||||||||
|
||||||||||||||||||||||
find_package(CUDA REQUIRED) | ||||||||||||||||||||||
|
||||||||||||||||||||||
################################################################################################### | ||||||||||||||||||||||
# - build type ------------------------------------------------------------------------------------ | ||||||||||||||||||||||
|
||||||||||||||||||||||
# Set a default build type if none was specified | ||||||||||||||||||||||
set(DEFAULT_BUILD_TYPE "Release") | ||||||||||||||||||||||
|
||||||||||||||||||||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||||||||||||||||||||||
message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' since none specified.") | ||||||||||||||||||||||
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE | ||||||||||||||||||||||
STRING "Choose the type of build." FORCE) | ||||||||||||||||||||||
# Set the possible values of build type for cmake-gui | ||||||||||||||||||||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS | ||||||||||||||||||||||
"Debug" "Release" "MinSizeRel" "RelWithDebInfo") | ||||||||||||||||||||||
endif() | ||||||||||||||||||||||
|
||||||||||||||||||||||
################################################################################################### | ||||||||||||||||||||||
# - compiler options ------------------------------------------------------------------------------ | ||||||||||||||||||||||
|
||||||||||||||||||||||
set(CMAKE_CXX_STANDARD 11) | ||||||||||||||||||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||||||||||||||||||||||
set(CMAKE_C_COMPILER $ENV{CC}) | ||||||||||||||||||||||
set(CMAKE_CXX_COMPILER $ENV{CXX}) | ||||||||||||||||||||||
|
||||||||||||||||||||||
if(CMAKE_COMPILER_IS_GNUCXX) | ||||||||||||||||||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") | ||||||||||||||||||||||
|
||||||||||||||||||||||
option(CMAKE_CXX11_ABI "Enable the GLIBCXX11 ABI" ON) | ||||||||||||||||||||||
if(CMAKE_CXX11_ABI) | ||||||||||||||||||||||
message(STATUS "NVTX3: Enabling the GLIBCXX11 ABI") | ||||||||||||||||||||||
else() | ||||||||||||||||||||||
message(STATUS "NVTX3: Disabling the GLIBCXX11 ABI") | ||||||||||||||||||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") | ||||||||||||||||||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") | ||||||||||||||||||||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler -D_GLIBCXX_USE_CXX11_ABI=0") | ||||||||||||||||||||||
endif(CMAKE_CXX11_ABI) | ||||||||||||||||||||||
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. It seems unlikely to me that you'd want to do mess with the GLIBCXX11 ABI here, ie, this probably could all be removed.
Suggested change
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. After I made this change I get a segfault when I run the benchmarks. I suspect this has something to do with the way gbench is configured, but I don't know enough to triage the exact cause. 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. 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. Well, removing it all is obviously what should be done, and goes to show that one (that is, me) shouldn't just make suggestions based on what I see in the PR, but rather look at the whole thing. I guess I'm surprised that you got segfaults rather than link errors -- when I dealt with libstdc++ ABI changes before, they had put the new ABI into a |
||||||||||||||||||||||
endif(CMAKE_COMPILER_IS_GNUCXX) | ||||||||||||||||||||||
|
||||||||||||||||||||||
# Build options | ||||||||||||||||||||||
option(BUILD_TESTS "Configure CMake to build tests" ON) | ||||||||||||||||||||||
option(BUILD_BENCHMARKS "Configure CMake to build (google) benchmarks" ON) | ||||||||||||||||||||||
|
||||||||||||||||||||||
################################################################################################### | ||||||||||||||||||||||
# - cmake modules --------------------------------------------------------------------------------- | ||||||||||||||||||||||
|
||||||||||||||||||||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH}) | ||||||||||||||||||||||
jrhemstad marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||
|
||||||||||||||||||||||
include(FeatureSummary) | ||||||||||||||||||||||
include(CheckIncludeFiles) | ||||||||||||||||||||||
include(CheckLibraryExists) | ||||||||||||||||||||||
|
||||||||||||||||||||||
################################################################################################### | ||||||||||||||||||||||
# - add gtest ------------------------------------------------------------------------------------- | ||||||||||||||||||||||
|
||||||||||||||||||||||
include(CTest) | ||||||||||||||||||||||
include(ConfigureGoogleTest) | ||||||||||||||||||||||
|
||||||||||||||||||||||
if(BUILD_TESTS) | ||||||||||||||||||||||
if(GTEST_FOUND) | ||||||||||||||||||||||
message(STATUS "Google C++ Testing Framework (Google Test) found in ${GTEST_ROOT}") | ||||||||||||||||||||||
include_directories(${GTEST_INCLUDE_DIR}) | ||||||||||||||||||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests) | ||||||||||||||||||||||
else() | ||||||||||||||||||||||
message(AUTHOR_WARNING "Google C++ Testing Framework (Google Test) not found: automated tests are disabled.") | ||||||||||||||||||||||
endif(GTEST_FOUND) | ||||||||||||||||||||||
endif(BUILD_TESTS) | ||||||||||||||||||||||
|
||||||||||||||||||||||
################################################################################################### | ||||||||||||||||||||||
# - add google benchmark -------------------------------------------------------------------------- | ||||||||||||||||||||||
|
||||||||||||||||||||||
if(BUILD_BENCHMARKS) | ||||||||||||||||||||||
include(ConfigureGoogleBenchmark) | ||||||||||||||||||||||
if(GBENCH_FOUND) | ||||||||||||||||||||||
message(STATUS "Google C++ Benchmarking Framework (Google Benchmark) found in ${GBENCH_ROOT}") | ||||||||||||||||||||||
include_directories(${GBENCH_INCLUDE_DIR}) | ||||||||||||||||||||||
add_subdirectory(${CMAKE_SOURCE_DIR}/benchmarks) | ||||||||||||||||||||||
else() | ||||||||||||||||||||||
message(AUTHOR_WARNING "Google C++ Benchmarking Framework (Google Benchmark) not found: automated tests are disabled.") | ||||||||||||||||||||||
endif(GBENCH_FOUND) | ||||||||||||||||||||||
endif(BUILD_BENCHMARKS) | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
################################################################################################### | ||||||||||||||||||||||
# - build doxygen --------------------------------------------------------------------------------- | ||||||||||||||||||||||
add_custom_command(OUTPUT BUILD_DOXYGEN | ||||||||||||||||||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||||||||||||||||||||||
COMMAND doxygen doxygen/Doxyfile | ||||||||||||||||||||||
VERBATIM) | ||||||||||||||||||||||
|
||||||||||||||||||||||
add_custom_target(docs DEPENDS BUILD_DOXYGEN) |
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.
I've seen this used elsewhere (in rapids), but unless there's a specific reason for it, I'd recommend not do this. The default behavior of cmake is to use the environment variables
CC
andCXX
as default forCMAKE_{C,CXX}_COMPILER
, anyway. So setting them this is way is not necessary, and in fact I believe it makescmake -DCMAKE_{C,CXX}_COMPILER=/path/whatever
not working as intended.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.
That's probably because this file is straight up copy and pasted from RMM or cuDF :)
I'm far from a CMake expert, so I would be super appreciative of how to improve this cmake file.