Skip to content
Merged
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
65 changes: 65 additions & 0 deletions cpp/citor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
cmake_minimum_required(VERSION 3.16)
project(runtime_benchmarks_citor)

set(CMAKE_MODULE_PATH
${runtime_benchmarks_citor_SOURCE_DIR}/../1CMake
${CMAKE_MODULE_PATH})

set(CMAKE_EXPORT_COMPILE_COMMANDS "1")
set(CMAKE_CXX_STANDARD 20)

add_definitions(
"-march=native"
)

include(../1CMake/CPM.cmake)

set(CITOR_GIT_TAG v0.4.5)
if(DEFINED ENV{RUNTIME_BENCHMARKS_LIBRARY_REF})
set(CITOR_GIT_TAG "$ENV{RUNTIME_BENCHMARKS_LIBRARY_REF}")
endif()

CPMAddPackage(
NAME citor
GIT_REPOSITORY https://github.com/Lallapallooza/citor.git
GIT_TAG ${CITOR_GIT_TAG}
OPTIONS
"CITOR_BUILD_TESTS OFF"
"CITOR_BUILD_BENCHMARK OFF"
)

include_directories("../2common")

find_package(libtcmalloc)

if(LIBTCMALLOC_FOUND)
set(MALLOC_LIB "${LIBTCMALLOC_LIBRARY}")
message(STATUS "Using malloc: ${MALLOC_LIB}")
else()
find_package(libmimalloc)

if(LIBMIMALLOC_FOUND)
set(MALLOC_LIB "${LIBMIMALLOC_LIBRARY}")
message(STATUS "Using malloc: ${MALLOC_LIB}")
else()
find_package(libjemalloc)

if(LIBJEMALLOC_FOUND)
set(MALLOC_LIB "${LIBJEMALLOC_LIBRARY}")
message(STATUS "Using malloc: ${MALLOC_LIB}")
else()
message(STATUS "Using malloc: default")
endif()
endif()
endif()

link_libraries(${MALLOC_LIB} citor::citor)

# Larger worker stack for deep recursive fork-join (fib, nqueens).
add_compile_definitions(CITOR_WORKER_STACK_KIB=65536)

add_executable(fib fib.cpp)
add_executable(skynet skynet.cpp)
add_executable(nqueens nqueens.cpp)
target_compile_options(nqueens PRIVATE "-falign-loops=64")
add_executable(matmul matmul.cpp)
293 changes: 293 additions & 0 deletions cpp/citor/CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
{
"version": 3,
"configurePresets": [
{
"name": "clang-linux-debug",
"displayName": "Clang-Linux Debug",
"generator": "Ninja",
"description": "Using compilers: C = clang, CXX = clang++",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "clang-linux-release",
"displayName": "Clang-Linux Release",
"generator": "Ninja",
"description": "Using compilers: C = clang, CXX = clang++",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "clang-linux-relwithdebinfo",
"displayName": "Clang-Linux Release with Debug Info",
"generator": "Ninja",
"description": "Using compilers: C = clang, CXX = clang++",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "gcc-linux-debug",
"displayName": "GCC-Linux Debug",
"generator": "Ninja",
"description": "Using compilers: C = gcc, CXX = g++",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "gcc-linux-release",
"displayName": "GCC-Linux Release",
"generator": "Ninja",
"description": "Using compilers: C = gcc, CXX = g++",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "gcc-linux-relwithdebinfo",
"displayName": "GCC-Linux Release with Debug Info",
"generator": "Ninja",
"description": "Using compilers: C = gcc, CXX = g++",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "clang-win-debug",
"displayName": "Clang-Win Debug",
"generator": "Ninja",
"description": "Using compiler: clang-cl.exe",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "clang-cl.exe",
"CMAKE_CXX_COMPILER": "clang-cl.exe",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"toolset": {
"value": "host=x64",
"strategy": "external"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"intelliSenseMode": "windows-clang-x64"
}
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "clang-win-release",
"displayName": "Clang-Win Release",
"generator": "Ninja",
"description": "Using compiler: clang-cl.exe",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER": "clang-cl.exe",
"CMAKE_CXX_COMPILER": "clang-cl.exe",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"toolset": {
"value": "host=x64",
"strategy": "external"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"intelliSenseMode": "windows-clang-x64"
}
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "clang-win-relwithdebinfo",
"displayName": "Clang-Win Release with Debug Info",
"generator": "Ninja",
"description": "Using compiler: clang-cl.exe",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_C_COMPILER": "clang-cl.exe",
"CMAKE_CXX_COMPILER": "clang-cl.exe",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"toolset": {
"value": "host=x64",
"strategy": "external"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"intelliSenseMode": "windows-clang-x64"
}
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "msvc-win-debug",
"displayName": "MSVC-Win Debug",
"description": "Using compiler: cl.exe",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"toolset": {
"value": "host=x64",
"strategy": "external"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "msvc-win-release",
"displayName": "MSVC-Win Release",
"description": "Using compiler: cl.exe",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_CXX_FLAGS": "/DWIN32 /D_WINDOWS /W3 /GR /EHsc /arch:AVX2",
"CMAKE_C_FLAGS": "/DWIN32 /D_WINDOWS /W3 /arch:AVX2"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"toolset": {
"value": "host=x64",
"strategy": "external"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "msvc-win-relwithdebinfo",
"displayName": "MSVC-Win Release with Debug Info",
"description": "Using compiler: cl.exe",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_CXX_FLAGS": "/DWIN32 /D_WINDOWS /W3 /GR /EHsc /arch:AVX2",
"CMAKE_C_FLAGS": "/DWIN32 /D_WINDOWS /W3 /arch:AVX2",
"CMAKE_CXX_FLAGS_RELWITHDEBINFO": "/MD /Zi /O2 /Ob2 /DNDEBUG",
"CMAKE_C_FLAGS_RELWITHDEBINFO": "/MD /Zi /O2 /Ob2 /DNDEBUG",
"CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO": "/debug /INCREMENTAL:NO",
"CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO": "/debug /INCREMENTAL:NO",
"CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO": "/debug /INCREMENTAL:NO"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"toolset": {
"value": "host=x64",
"strategy": "external"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
}
]
}
3 changes: 3 additions & 0 deletions cpp/citor/build_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PRESET=${1:-"clang-linux-release"}
cmake --preset $PRESET .
cmake --build ./build --parallel 16 --target all
Loading