forked from ComputationalRadiationPhysics/picongpu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed 'thirdParty/mallocMC/' changes from e2533d1410..31f9b3c3f1
31f9b3c3f1 version update 2.4.0crp and changelog (ComputationalRadiationPhysics#157) cc54375b1e Port to alpaka (ComputationalRadiationPhysics#173) a2ed3ae927 Merge pull request ComputationalRadiationPhysics#179 from bernhardmgruber/catch 8dd82718e9 added 3rd party catch.hpp and made CMake find it 67bdc1b598 Merge pull request ComputationalRadiationPhysics#176 from bernhardmgruber/addAlpaka 5dd1d036c4 switching to C++14 2bb2f3e6d9 * using alpaka from added git subtree ea73178789 Merge commit '90bb1ebc63d8281718381494e1d91733ac79c405' as 'alpaka' 90bb1ebc63 Squashed 'alpaka/' content from commit a5a8277cd e0be7743ea Merge pull request ComputationalRadiationPhysics#178 from psychocoderHPC/fix-travisCmakeUsage2 28b81447f2 fix used cmake version be77c4c606 Merge pull request ComputationalRadiationPhysics#174 from psychocoderHPC/topic-updateCmakeTo3.15.0 90d2841972 update cmake to 3.15.0 7a3d1cebde Merge pull request ComputationalRadiationPhysics#172 from bernhardmgruber/format 0185438323 added CONTRIBUTING.md with instructions how to use clang-format 4a416a2eca formatting (after clang-tidy) 8aec2cbf3f using trailing return types 5661a80fc3 formatting 669443d558 * setting column limit and allowing short loops * regrouping includes edc10db7c4 added .clang-format file 8c5a8617d1 Merge pull request ComputationalRadiationPhysics#171 from bernhardmgruber/cleaning 95c3223f2c replaced remaining typedefs by using directives d008ddba6b added .vs and build folders to ignores 5c16da78a6 applied clang-tidy 6404efdf61 * added a custom target for mallocMC headers * added header files to projects 43754615dd Merge pull request ComputationalRadiationPhysics#169 from bernhardmgruber/cleaning 28561514df * requiring only C++11 * removed a TODO 507111408b a little modernization of the CMakeLists * using CUDA via project language instead of deprecated find_package * setting CUDA standard to have C++14 inside CUDA as well 73e21de40d * removed check that pagesize is unsigned * made pagesizes signed literals again 25e0de3459 renamed variables with 2 leading underscores 240d4ea634 Suggested during review d37e9ed21e addressed review comments dafc9b7940 * replaced usage of boost::mpl by static constexpr members * dropped dependency on boost 4962156bf4 some cleanup * requiring C++14 * using cstdint instead of boost/cstdint.hpp * using std::tuple instead of boost::tuple * using nullptr * using static_assert * using constexpr * adding const and static where appropriate * removed a few empty lines * replaced std::endl by \n where flush was probably not intended e383f3cd89 Merge pull request ComputationalRadiationPhysics#170 from ax3l/topic-ciBionic 42aed7eafb Travis CI: GCC 5.5.0 + CUDA 9.1.85 36cb7f9f0c Merge pull request ComputationalRadiationPhysics#165 from sbastrakov/topic-nvccComputeCapabilityGuard d911d0cbb9 Add a guard around COMPUTE_CAPABILITY cmake variable eff012d664 Merge pull request ComputationalRadiationPhysics#161 from sbastrakov/topic-cudaDeviceGetArrribute efd20bce5b Merge pull request ComputationalRadiationPhysics#164 from sbastrakov/fix-nvccComputeCapability 450c73d3a7 Choose the value for the -arch nvcc flag depending on CUDA version ce377f18e7 Use cudaDeviceGetAttribute() for querying the compute capability git-subtree-dir: thirdParty/mallocMC git-subtree-split: 31f9b3c3f1cf919a96312a30ab9aa223f41fed67
- Loading branch information
1 parent
044f2f1
commit 542c742
Showing
512 changed files
with
114,217 additions
and
3,501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: AlwaysBreak | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlines: DontAlign | ||
AlignOperands: false | ||
AlignTrailingComments: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: true | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: Yes | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterClass: true | ||
AfterControlStatement: true | ||
AfterEnum: true | ||
AfterFunction: true | ||
AfterNamespace: true | ||
AfterStruct: true | ||
AfterUnion: true | ||
AfterExternBlock: true | ||
BeforeCatch: true | ||
BeforeElse: true | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
SplitEmptyNamespace: false | ||
BreakBeforeBinaryOperators: All | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializers: AfterColon | ||
BreakInheritanceList: AfterColon | ||
BreakStringLiterals: true | ||
ColumnLimit: 80 | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 8 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: false | ||
FixNamespaceComments: false | ||
IncludeBlocks: Regroup | ||
IndentCaseLabels: false | ||
IndentPPDirectives: None | ||
IndentWidth: 4 | ||
IndentWrappedFunctionNames: false | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
Language: Cpp | ||
NamespaceIndentation: All | ||
PointerAlignment: Middle | ||
ReflowComments: true | ||
SortIncludes: true | ||
SortUsingDeclarations: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterTemplateKeyword: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: Never | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceInEmptyParentheses: false | ||
SpacesInAngles: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInContainerLiterals: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Cpp11 | ||
UseTab: Never | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
Checks: '*,-llvm-header-guard,-fuchsia-default-arguments-declarations,-cppcoreguidelines-no-malloc,-cppcoreguidelines-owning-memory,-misc-non-private-member-variables-in-classes' | ||
HeaderFilterRegex: '.*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,5 @@ | |
|
||
*~ | ||
/nbproject | ||
/.vs | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,114 +1,87 @@ | ||
project(mallocMC) | ||
cmake_minimum_required(VERSION 2.8.12.2) | ||
project(mallocMC LANGUAGES CXX) | ||
cmake_minimum_required(VERSION 3.8) | ||
|
||
# helper for libs and packages | ||
set(CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/" | ||
"$ENV{CUDA_ROOT}" "$ENV{BOOST_ROOT}") | ||
|
||
|
||
################################################################################ | ||
# CMake policies | ||
# | ||
# Search in <PackageName>_ROOT: | ||
# https://cmake.org/cmake/help/v3.12/policy/CMP0074.html | ||
################################################################################ | ||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
if(POLICY CMP0074) | ||
cmake_policy(SET CMP0074 NEW) | ||
cmake_policy(SET CMP0074 NEW) | ||
endif() | ||
|
||
|
||
############################################################################### | ||
# CUDA | ||
############################################################################### | ||
find_package(CUDA REQUIRED) | ||
set(CUDA_NVCC_FLAGS "-arch=sm_20;-use_fast_math;") | ||
set(CUDA_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) | ||
include_directories(${CUDA_INCLUDE_DIRS}) | ||
cuda_include_directories(${CUDA_INCLUDE_DIRS}) | ||
|
||
OPTION(CUDA_OUTPUT_INTERMEDIATE_CODE "Output ptx code" OFF) | ||
if(CUDA_OUTPUT_INTERMEDIATE_CODE) | ||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-Xptxas;-v;--keep") | ||
endif(CUDA_OUTPUT_INTERMEDIATE_CODE) | ||
|
||
SET(CUDA_OPTIMIZATION_TYPE "unset" CACHE STRING "CUDA Optimization") | ||
set_property(CACHE CUDA_OPTIMIZATION_TYPE PROPERTY STRINGS "unset;-G0;-O0;-O1;-O2;-O3") | ||
if(NOT ${CUDA_OPTIMIZATION_TYPE} STREQUAL "unset") | ||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};${CUDA_OPTIMIZATION_TYPE}") | ||
# find alpaka | ||
set(mallocMC_ALPAKA_PROVIDER "intern" CACHE STRING "Select which alpaka is used") | ||
set_property(CACHE mallocMC_ALPAKA_PROVIDER PROPERTY STRINGS "intern;extern") | ||
mark_as_advanced(mallocMC_ALPAKA_PROVIDER) | ||
if(${mallocMC_ALPAKA_PROVIDER} STREQUAL "intern") | ||
set(alpaka_BUILD_EXAMPLES OFF) | ||
set(BUILD_TESTING OFF) | ||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/alpaka ${CMAKE_BINARY_DIR}/alpaka) | ||
else() | ||
find_package(alpaka HINTS $ENV{ALPAKA_ROOT}) | ||
endif() | ||
|
||
if(NOT TARGET alpaka::alpaka) | ||
message(FATAL "Required mallocMC dependency alpaka could not be found!") | ||
endif() | ||
|
||
############################################################################### | ||
# Boost | ||
############################################################################### | ||
find_package(Boost 1.48.0 REQUIRED) | ||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) | ||
set(LIBS ${LIBS} ${Boost_LIBRARIES}) | ||
|
||
# nvcc + boost 1.55 work around | ||
if(Boost_VERSION EQUAL 105500) | ||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} \"-DBOOST_NOINLINE=__attribute__((noinline))\" ") | ||
endif(Boost_VERSION EQUAL 105500) | ||
# Catch2 | ||
set(mallocMC_CATCH2_PROVIDER "intern" CACHE STRING "Select which Catch2 is used") | ||
set_property(CACHE mallocMC_CATCH2_PROVIDER PROPERTY STRINGS "intern;extern") | ||
mark_as_advanced(mallocMC_CATCH2_PROVIDER) | ||
if(${mallocMC_CATCH2_PROVIDER} STREQUAL "intern") | ||
add_library(Catch2::Catch2 INTERFACE IMPORTED) | ||
target_include_directories(Catch2::Catch2 INTERFACE ${CMAKE_CURRENT_LIST_DIR}/thirdParty/catch2/include) | ||
else() | ||
find_package(Catch2 CONFIG REQUIRED) | ||
endif() | ||
|
||
# for installation, just copy include folder to install folder | ||
install( | ||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/include/." | ||
DESTINATION include | ||
) | ||
|
||
################################################################################ | ||
# Warnings | ||
################################################################################ | ||
# GNU | ||
# warnings | ||
add_library(warnings INTERFACE) | ||
if(CMAKE_COMPILER_IS_GNUCXX) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter") | ||
# new warning in gcc 4.8 (flag ignored in previous version) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs") | ||
# ICC | ||
target_compile_options(warnings INTERFACE -Wall -Wshadow -Wno-unknown-pragmas -Wextra -Wno-unused-parameter -Wno-unused-local-typedefs) | ||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_NO_VARIADIC_TEMPLATES") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_NO_CXX11_VARIADIC_TEMPLATES") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_NO_FENV_H") | ||
# PGI | ||
target_compile_options(warnings INTERFACE -Wall -Wshadow) | ||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Minform=inform") | ||
target_compile_options(warnings INTERFACE -Minform=inform) | ||
endif() | ||
|
||
|
||
############################################################################### | ||
# Installation | ||
############################################################################### | ||
|
||
# copy include folder to install folder | ||
INSTALL( | ||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/include/." | ||
DESTINATION include | ||
PATTERN ".git" EXCLUDE | ||
PATTERN "mallocMC_config.hpp" EXCLUDE | ||
) | ||
|
||
|
||
############################################################################### | ||
# Executables | ||
############################################################################### | ||
add_custom_target(examples DEPENDS mallocMC_Example01 mallocMC_Example02 mallocMC_Example03 VerifyHeap) | ||
|
||
cuda_add_executable(mallocMC_Example01 | ||
EXCLUDE_FROM_ALL | ||
examples/mallocMC_example01.cu ) | ||
cuda_add_executable(mallocMC_Example02 | ||
EXCLUDE_FROM_ALL | ||
examples/mallocMC_example02.cu ) | ||
cuda_add_executable(mallocMC_Example03 | ||
EXCLUDE_FROM_ALL | ||
examples/mallocMC_example03.cu ) | ||
cuda_add_executable(VerifyHeap | ||
EXCLUDE_FROM_ALL | ||
tests/verify_heap.cu ) | ||
file(GLOB_RECURSE headers src/include/**) | ||
add_custom_target(mallocMCIde SOURCES ${headers}) # create a target with the header files for IDE projects | ||
source_group(TREE ${CMAKE_CURRENT_LIST_DIR}/src/include FILES ${headers}) | ||
|
||
alpaka_add_executable(mallocMC_Example01 EXCLUDE_FROM_ALL examples/mallocMC_example01.cpp) | ||
target_include_directories(mallocMC_Example01 PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include) | ||
target_link_libraries(mallocMC_Example01 PUBLIC alpaka::alpaka warnings) | ||
|
||
alpaka_add_executable(mallocMC_Example03 EXCLUDE_FROM_ALL examples/mallocMC_example03.cpp) | ||
target_include_directories(mallocMC_Example03 PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include) | ||
target_link_libraries(mallocMC_Example03 PUBLIC alpaka::alpaka warnings) | ||
|
||
alpaka_add_executable(VerifyHeap EXCLUDE_FROM_ALL tests/verify_heap.cpp tests/verify_heap_config.hpp) | ||
target_include_directories(VerifyHeap PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include) | ||
target_link_libraries(VerifyHeap PUBLIC alpaka::alpaka warnings) | ||
|
||
if (CUDA_VERSION VERSION_LESS 10.2) # TODO(bgruber): I do not know exactly where it breaks. 9.1 does not work, 10.2 works | ||
# the catch2 main needs to be in a non-CUDA file before CUDA 10.2, because nvcc fails to compile the catch2 header | ||
# TODO: merge the test_main back into the tests exe, once CUDA 10.2 is the minimum version | ||
add_library(tests_main EXCLUDE_FROM_ALL tests/main.cpp) | ||
target_include_directories(tests_main PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include) | ||
target_link_libraries(tests_main PUBLIC Catch2::Catch2 warnings) | ||
|
||
alpaka_add_executable(tests EXCLUDE_FROM_ALL tests/dimensions.cpp tests/policies.cpp) | ||
target_include_directories(tests PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include) | ||
target_link_libraries(tests PUBLIC tests_main alpaka::alpaka Catch2::Catch2 warnings) | ||
else() | ||
alpaka_add_executable(tests EXCLUDE_FROM_ALL tests/main.cpp tests/dimensions.cpp tests/policies.cpp) | ||
target_include_directories(tests PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include) | ||
target_link_libraries(tests PUBLIC alpaka::alpaka Catch2::Catch2 warnings) | ||
endif() | ||
|
||
target_link_libraries(mallocMC_Example01 ${LIBS}) | ||
target_link_libraries(mallocMC_Example02 ${LIBS}) | ||
target_link_libraries(mallocMC_Example03 ${LIBS}) | ||
target_link_libraries(VerifyHeap ${LIBS}) | ||
add_custom_target(examples DEPENDS mallocMC_Example01 mallocMC_Example03 VerifyHeap) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Contributing | ||
|
||
## Formatting | ||
|
||
Please format your code before before opening pull requests using clang-format and the .clang-format file placed in the repository root. | ||
|
||
### Visual Studio and CLion | ||
Suport for clang-format is built-in since Visual Studio 2017 15.7 and CLion 2019.1. | ||
The .clang-format file in the repository will be automatically detected and formatting is done as you type, or triggered when pressing the format hotkey. | ||
|
||
### Bash | ||
First install clang-format. Instructions therefore can be found on the web. To format you can run this command in bash: | ||
``` | ||
find -iname *.cu -o -iname *.hpp | xargs clang-format-10 -i | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.