Skip to content

Commit ad821d8

Browse files
author
Mark Hildebrand
authored
Initial Commit of the Library (#1)
1 parent dbb024f commit ad821d8

File tree

347 files changed

+46290
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

347 files changed

+46290
-5
lines changed

.clang-format

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
IndentWidth: 4
3+
---
4+
Language: Cpp
5+
AlignAfterOpenBracket: BlockIndent
6+
AlignEscapedNewlines: Left
7+
AlignTrailingComments: true
8+
AllowAllArgumentsOnNextLine: true
9+
#AllowAllParametersOnNextLine: true
10+
AllowShortBlocksOnASingleLine: Always
11+
AllowShortCaseLabelsOnASingleLine: false
12+
AllowShortEnumsOnASingleLine: true
13+
AllowShortFunctionsOnASingleLine: All
14+
AllowShortIfStatementsOnASingleLine: Never
15+
AllowShortLambdasOnASingleLine: All
16+
AllowShortLoopsOnASingleLine: false
17+
BinPackArguments: false
18+
BinPackParameters: false
19+
BreakConstructorInitializers: BeforeComma
20+
ColumnLimit: 92
21+
CompactNamespaces: false
22+
DerivePointerAlignment: false
23+
#EmptyLineAfterAccessModifier: Never
24+
#EmptyLineBeforeAccessModifier: LogicalBlock
25+
FixNamespaceComments: true
26+
IndentCaseLabels: true
27+
KeepEmptyLinesAtTheStartOfBlocks: false
28+
#LambdaBodyIndentation: OuterScope
29+
PointerAlignment: Left
30+
ReferenceAlignment: Left
31+
ReflowComments: true
32+
---

.clang-tidy

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Checks: "-*,
2+
bugprone*,
3+
-bugprone-easily-swappable-parameters,
4+
-bugprone-macro-parentheses,
5+
clang-analyzer*,
6+
readability*,
7+
-readability-magic-numbers,
8+
-readability-identifier-length"
9+
10+
CheckOptions:
11+
- key: readability-implicit-bool-conversion.AllowIntegerConditions
12+
value: '1'

.github/workflows/build-docs.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Build Docs
3+
4+
on:
5+
# For testing purposes.
6+
pull_request:
7+
branches:
8+
- main
9+
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14+
permissions:
15+
contents: read
16+
17+
concurrency:
18+
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
19+
cancel-in-progress: true
20+
21+
jobs:
22+
# Single deploy job since we're just deploying
23+
build:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
29+
- name: Install Dependencies
30+
run: |
31+
sudo apt install -y doxygen
32+
pip install \
33+
archspec \
34+
scikit-build \
35+
sphinx \
36+
breathe \
37+
sphinx_rtd_theme \
38+
sphinx-collapse
39+
40+
- name: Build Wheel
41+
env:
42+
CC: clang-13
43+
CXX: clang++-13
44+
run: |
45+
cd ${GITHUB_WORKSPACE}/bindings/python
46+
python setup.py bdist_wheel --cmake-executable="cmake" --build-type=Debug -- -- -j2
47+
pip install ./dist/pysvs*.whl
48+
49+
- name: Build Docs
50+
working-directory: ${{ runner.temp }}
51+
run: |
52+
cmake \
53+
-B${{ runner.temp }}/build_docs \
54+
"-S${GITHUB_WORKSPACE}" \
55+
-DSVS_BUILD_DOCS=YES
56+
make -C ${{ runner.temp }}/build_docs

.github/workflows/build-linux.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Linux Build and Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
# This allows a subsequently queued workflow run to interrupt previous runs
13+
concurrency:
14+
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
name: ${{ matrix.cxx }}, ${{ matrix.build_type }}
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
#build_type: [Debug, Release]
24+
build_type: [Release]
25+
cxx: [g++-11, clang++-13]
26+
include:
27+
- cxx: g++-11
28+
cc: gcc-11
29+
- cxx: clang++-13
30+
cc: clang-13
31+
32+
steps:
33+
- uses: actions/checkout@v2
34+
- name: Configure build
35+
working-directory: ${{ runner.temp }}
36+
env:
37+
CXX: ${{ matrix.cxx }}
38+
CC: ${{ matrix.cc }}
39+
TEMP_WORKSPACE: ${{ runner.temp }}
40+
run: |
41+
cmake -B${TEMP_WORKSPACE}/build -S${GITHUB_WORKSPACE} \
42+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
43+
-DSVS_BUILD_BINARIES=YES \
44+
-DSVS_BUILD_TESTS=YES \
45+
-DSVS_BUILD_EXAMPLES=YES \
46+
-DSVS_NO_AVX512=NO
47+
48+
- name: Build Tests and Utilities
49+
working-directory: ${{ runner.temp }}/build
50+
run: make -j$(nproc)
51+
52+
- name: Run tests
53+
env:
54+
CTEST_OUTPUT_ON_FAILURE: 1
55+
working-directory: ${{ runner.temp }}/build/tests
56+
run: ctest -C ${{ matrix.build_type }}
57+

.github/workflows/cibuildwheel.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CIBuildWheel
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
python-build:
11+
name: Build Wheel
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Install cibuildwheel
18+
run: python -m pip install cibuildwheel
19+
20+
# Install inside the temporary working directory.
21+
- name: Build Wheel
22+
env:
23+
TEMP_WORKSPACE: ${{ runner.temp }}/usr
24+
run: |
25+
cd ${GITHUB_WORKSPACE}
26+
cibuildwheel --only $(python tools/pybuild.py) bindings/python
27+
pip install ./wheelhouse/pysvs*.whl --target=${TEMP_WORKSPACE}
28+
29+
# Make sure to add the location of the generated wheel to the python path.
30+
- name: Run Default Tests
31+
env:
32+
PYTHONPATH: ${{ runner.temp }}/usr
33+
CTEST_OUTPUT_ON_FAILURE: 1
34+
working-directory: ${{ runner.temp }}
35+
run: python -m unittest discover -s ${GITHUB_WORKSPACE}/bindings/python
36+

.github/workflows/docs.yml .github/workflows/deploy-docs.yml

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# Simple workflow for deploying static content to GitHub Pages
2-
name: Deploy static content to Pages
2+
name: Deploy Docs
33

44
on:
55
# Runs on pushes targeting the default branch
66
push:
77
branches: ["main"]
88

9+
# For testing purposes.
10+
pull_request:
11+
branches:
12+
- main
13+
914
# Allows you to run this workflow manually from the Actions tab
1015
workflow_dispatch:
1116

@@ -35,7 +40,13 @@ jobs:
3540
- name: Install Dependencies
3641
run: |
3742
sudo apt install -y doxygen
38-
pip install sphinx breathe sphinx_rtd_theme sphinx-rtd-theme
43+
pip install \
44+
archspec \
45+
scikit-build \
46+
sphinx \
47+
breathe \
48+
sphinx_rtd_theme \
49+
sphinx-collapse
3950
4051
- name: Build Wheel
4152
env:

.gitignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Build directories
2+
/build*/
3+
usr/
4+
wheelhouse/
5+
6+
# Bundled test data
7+
/data/
8+
9+
# Misc tool related files
10+
*.swp
11+
tags
12+
compile_commands.json
13+
.python-version
14+
15+
# Python related files
16+
__pycache__/
17+
/bindings/python/build/
18+
/bindings/python/_skbuild/
19+
/bindings/python/dist/
20+
21+
# Example generated files.
22+
example_data_*/

CMakeLists.txt

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
cmake_minimum_required(VERSION 3.18)
2+
3+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake")
4+
5+
project(svs
6+
LANGUAGES CXX
7+
VERSION 0.0.1
8+
)
9+
10+
set(SVS_LIB svs_devel)
11+
add_library(${SVS_LIB} INTERFACE)
12+
set_target_properties(${SVS_LIB} PROPERTIES EXPORT_NAME svs)
13+
add_library(svs::svs ALIAS ${SVS_LIB})
14+
15+
# Runtime include directories are established in the installation logic.
16+
target_include_directories(
17+
${SVS_LIB}
18+
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
19+
)
20+
21+
# We use C++ 20 features in our exposed headers.
22+
# Anyone using us as a depdency and including our headers will need to be C++20 compatible.
23+
target_compile_features(${SVS_LIB} INTERFACE cxx_std_20)
24+
25+
#####
26+
##### Options and extra build steps
27+
#####
28+
29+
include("cmake/options.cmake")
30+
include("cmake/clang-tidy.cmake")
31+
include("cmake/pthread.cmake")
32+
include("cmake/numa.cmake")
33+
include("cmake/robin-map.cmake")
34+
include("cmake/fmt.cmake")
35+
include("cmake/toml.cmake")
36+
37+
# TODO: Right now this is always needed.
38+
# Decoupling our dependence on EVE to disable quantization will be ... tricky ...
39+
if(SVS_ENABLE_QUANTIZATION)
40+
include("cmake/eve.cmake")
41+
endif()
42+
43+
#####
44+
##### Build Objects
45+
#####
46+
47+
if(SVS_BUILD_BINARIES)
48+
add_subdirectory(utils)
49+
endif()
50+
51+
if(SVS_BUILD_TESTS)
52+
add_subdirectory(tests)
53+
endif()
54+
55+
if(SVS_BUILD_EXAMPLES)
56+
add_subdirectory(examples)
57+
endif()
58+
59+
if(SVS_BUILD_DOCS)
60+
add_subdirectory(docs)
61+
endif()
62+
63+
#####
64+
##### Install Logic
65+
#####
66+
67+
include(GNUInstallDirs)
68+
69+
# Location of auxiliary generated cmake files to help consumers of this package.
70+
set(LIB_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/svs")
71+
72+
# Install headers and target information.
73+
install(
74+
TARGETS svs_devel svs_compile_options svs_native_options
75+
EXPORT svs-targets
76+
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
77+
)
78+
install(
79+
DIRECTORY "${PROJECT_SOURCE_DIR}/include/svs"
80+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
81+
FILES_MATCHING PATTERN "*.h"
82+
)
83+
install(
84+
EXPORT svs-targets
85+
NAMESPACE "svs::"
86+
DESTINATION "${LIB_CONFIG_INSTALL_DIR}"
87+
)
88+
89+
#####
90+
##### Config File
91+
#####
92+
93+
include(CMakePackageConfigHelpers)
94+
configure_package_config_file(
95+
"${CMAKE_CURRENT_LIST_DIR}/cmake/Config.cmake.in"
96+
"${CMAKE_CURRENT_BINARY_DIR}/svsConfig.cmake"
97+
INSTALL_DESTINATION "${LIB_CONFIG_INSTALL_DIR}"
98+
)
99+
100+
install(FILES
101+
"${CMAKE_CURRENT_BINARY_DIR}/svsConfig.cmake"
102+
DESTINATION "${LIB_CONFIG_INSTALL_DIR}"
103+
)
104+
105+
# Copy any "Find*" files that may be needed.
106+
set(CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake")
107+
set(SVS_CMAKE_FIND_FILES
108+
${CMAKE_DIR}/FindNuma.cmake
109+
)
110+
111+
install(FILES
112+
${SVS_CMAKE_FIND_FILES}
113+
DESTINATION "${LIB_CONFIG_INSTALL_DIR}"
114+
)
115+

LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,8 @@ the "copyright" line and a pointer to where the full notice is found.
633633
Copyright (C) <year> <name of author>
634634

635635
This program is free software: you can redistribute it and/or modify
636-
it under the terms of the GNU Affero General Public License as published
637-
by the Free Software Foundation, either version 3 of the License, or
636+
it under the terms of the GNU Affero General Public License as published by
637+
the Free Software Foundation, either version 3 of the License, or
638638
(at your option) any later version.
639639

640640
This program is distributed in the hope that it will be useful,

0 commit comments

Comments
 (0)