Skip to content

Commit 44026ba

Browse files
author
Bing Xu
committed
v0.1
0 parents  commit 44026ba

File tree

846 files changed

+149832
-0
lines changed

Some content is hidden

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

846 files changed

+149832
-0
lines changed

.circleci/config.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Use the latest 2.1 version of CircleCI pipeline process engine.
2+
# See: https://circleci.com/docs/2.0/configuration-reference
3+
version: 2.1
4+
5+
# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects.
6+
# See: https://circleci.com/docs/2.0/orb-intro/
7+
orbs:
8+
# The python orb contains a set of prepackaged CircleCI configuration you can use repeatedly in your configuration files
9+
# Orb commands and jobs help you with common scripting around a language/tool
10+
# so you dont have to copy and paste it everywhere.
11+
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python
12+
python: circleci/[email protected]
13+
14+
# -------------------------------------------------------------------------------------
15+
# Re-usable commands
16+
# -------------------------------------------------------------------------------------
17+
setup_env: &setup_env
18+
- run:
19+
name: Setup environment
20+
command: |
21+
python3.8 --version
22+
python3.8 -m pip install --upgrade pip
23+
cd python
24+
python3.8 setup.py bdist_wheel
25+
sudo python3.8 -m pip install --no-input dist/*.whl
26+
cd ..
27+
python3.8 -m pip install pytest
28+
python3.8 -m pip install torch
29+
python3.8 -m pip install numpy
30+
python3.8 -m pip install jinja2
31+
python3.8 -m pip install recordtype
32+
python3.8 -m pip install parameterized
33+
python3.8 -m pip install einops
34+
git submodule sync
35+
git submodule update --init
36+
echo 'export PYTHONPATH=$PWD/python:$PYTHONPATH' >> $BASH_ENV
37+
echo 'export PATH=/usr/local/cuda-11.4/bin:$PATH' >> $BASH_ENV
38+
echo 'export CI_FLAG=CIRCLECI' >> $BASH_ENV
39+
echo 'export CACHE_DIR=$PWD/tests/ci_profile_cache' >> $BASH_ENV
40+
41+
basic_tests: &basic_tests
42+
- run:
43+
name: Run tests
44+
command: |
45+
set -e
46+
TEST_FILES=$(circleci tests glob "tests/unittest/**/test_*.py" | grep -v benchmark | circleci tests split --split-by=timings)
47+
mkdir test-results
48+
python3.8 -m pytest $TEST_FILES --junitxml=test-results/junit.xml --verbose --continue-on-collection-errors -rA
49+
50+
51+
# Define a job to be invoked later in a workflow.
52+
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
53+
jobs:
54+
build-and-test:
55+
machine:
56+
image: ubuntu-2004-cuda-11.4:202110-01
57+
# Check T101565170 for multi-gpu use cases.
58+
resource_class: gpu.nvidia.medium
59+
60+
parallelism: 10
61+
62+
# Checkout the code as the first step. This is a dedicated CircleCI step.
63+
# The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default.
64+
# Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt.
65+
# Then run your tests!
66+
# CircleCI will report the results back to your VCS provider.
67+
steps:
68+
- checkout
69+
- <<: *setup_env
70+
- <<: *basic_tests
71+
- store_test_results:
72+
path: test-results
73+
74+
# Invoke jobs via workflows
75+
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
76+
workflows:
77+
unittest: # This is the name of the workflow, feel free to change it to better match your workflow.
78+
# Inside the workflow, you define the jobs you want to run.
79+
jobs:
80+
- build-and-test

.clang-format

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
AccessModifierOffset: -1
3+
AlignAfterOpenBracket: AlwaysBreak
4+
AlignConsecutiveAssignments: false
5+
AlignConsecutiveDeclarations: false
6+
AlignEscapedNewlinesLeft: true
7+
AlignOperands: false
8+
AlignTrailingComments: false
9+
AllowAllParametersOfDeclarationOnNextLine: false
10+
AllowShortBlocksOnASingleLine: false
11+
AllowShortCaseLabelsOnASingleLine: false
12+
AllowShortFunctionsOnASingleLine: Empty
13+
AllowShortIfStatementsOnASingleLine: false
14+
AllowShortLoopsOnASingleLine: false
15+
AlwaysBreakAfterReturnType: None
16+
AlwaysBreakBeforeMultilineStrings: true
17+
AlwaysBreakTemplateDeclarations: true
18+
BinPackArguments: false
19+
BinPackParameters: false
20+
BraceWrapping:
21+
AfterClass: false
22+
AfterControlStatement: false
23+
AfterEnum: false
24+
AfterFunction: false
25+
AfterNamespace: false
26+
AfterObjCDeclaration: false
27+
AfterStruct: false
28+
AfterUnion: false
29+
BeforeCatch: false
30+
BeforeElse: false
31+
IndentBraces: false
32+
BreakBeforeBinaryOperators: None
33+
BreakBeforeBraces: Attach
34+
BreakBeforeTernaryOperators: true
35+
BreakConstructorInitializersBeforeComma: false
36+
BreakAfterJavaFieldAnnotations: false
37+
BreakStringLiterals: false
38+
ColumnLimit: 80
39+
CommentPragmas: '^ IWYU pragma:'
40+
CompactNamespaces: false
41+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
42+
ConstructorInitializerIndentWidth: 4
43+
ContinuationIndentWidth: 4
44+
Cpp11BracedListStyle: true
45+
DerivePointerAlignment: false
46+
DisableFormat: false
47+
ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ]
48+
IncludeCategories:
49+
- Regex: '^<.*\.h(pp)?>'
50+
Priority: 1
51+
- Regex: '^<.*'
52+
Priority: 2
53+
- Regex: '.*'
54+
Priority: 3
55+
IndentCaseLabels: true
56+
IndentWidth: 2
57+
IndentWrappedFunctionNames: false
58+
KeepEmptyLinesAtTheStartOfBlocks: false
59+
MacroBlockBegin: ''
60+
MacroBlockEnd: ''
61+
MaxEmptyLinesToKeep: 1
62+
NamespaceIndentation: None
63+
ObjCBlockIndentWidth: 2
64+
ObjCSpaceAfterProperty: false
65+
ObjCSpaceBeforeProtocolList: false
66+
PenaltyBreakBeforeFirstCallParameter: 1
67+
PenaltyBreakComment: 300
68+
PenaltyBreakFirstLessLess: 120
69+
PenaltyBreakString: 1000
70+
PenaltyExcessCharacter: 1000000
71+
PenaltyReturnTypeOnItsOwnLine: 2000000
72+
PointerAlignment: Left
73+
ReflowComments: true
74+
SortIncludes: true
75+
SpaceAfterCStyleCast: false
76+
SpaceBeforeAssignmentOperators: true
77+
SpaceBeforeParens: ControlStatements
78+
SpaceInEmptyParentheses: false
79+
SpacesBeforeTrailingComments: 1
80+
SpacesInAngles: false
81+
SpacesInContainerLiterals: true
82+
SpacesInCStyleCastParentheses: false
83+
SpacesInParentheses: false
84+
SpacesInSquareBrackets: false
85+
Standard: Cpp11
86+
TabWidth: 8
87+
UseTab: Never
88+
...

.flake8

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
[flake8]
2+
select = B,C,E,F,P,W,B9
3+
max-line-length = 80
4+
# Main Explanation Docs: https://github.com/grantmcconnaughey/Flake8Rules
5+
ignore =
6+
# Black conflicts and overlaps.
7+
# Found in https://github.com/psf/black/issues/429
8+
B950, # Line too long.
9+
E111, # Indentation is not a multiple of four.
10+
E115, # Expected an indented block (comment).
11+
E117, # Over-indented.
12+
E121, # Continuation line under-indented for hanging indent.
13+
E122, # Continuation line missing indentation or outdented.
14+
E123, # Closing bracket does not match indentation of opening bracket's line.
15+
E124, # Closing bracket does not match visual indentation.
16+
E125, # Continuation line with same indent as next logical line.
17+
E126, # Continuation line over-indented for hanging indent.
18+
E127, # Continuation line over-indented for visual indent.
19+
E128, # Continuation line under-indented for visual indent.
20+
E129, # Visually indented line with same indent as next logical line.
21+
E131, # Continuation line unaligned for hanging indent.
22+
E201, # Whitespace after '('.
23+
E202, # Whitespace before ')'.
24+
E203, # Whitespace before ':'.
25+
E221, # Multiple spaces before operator.
26+
E222, # Multiple spaces after operator.
27+
E225, # Missing whitespace around operator.
28+
E226, # Missing whitespace around arithmetic operator.
29+
E227, # Missing whitespace around bitwise or shift operator.
30+
E231, # Missing whitespace after ',', ';', or ':'.
31+
E241, # Multiple spaces after ','.
32+
E251, # Unexpected spaces around keyword / parameter equals.
33+
E252, # Missing whitespace around parameter equals.
34+
E261, # At least two spaces before inline comment.
35+
E262, # Inline comment should start with '# '.
36+
E265, # Block comment should start with '# '.
37+
E271, # Multiple spaces after keyword.
38+
E272, # Multiple spaces before keyword.
39+
E301, # Expected 1 blank line, found 0.
40+
E302, # Expected 2 blank lines, found 0.
41+
E303, # Too many blank lines (3).
42+
E305, # Expected 2 blank lines after end of function or class.
43+
E306, # Expected 1 blank line before a nested definition.
44+
E501, # Line too long (82 > 79 characters).
45+
E502, # The backslash is redundant between brackets.
46+
E701, # Multiple statements on one line (colon).
47+
E702, # Multiple statements on one line (semicolon).
48+
E703, # Statement ends with a semicolon.
49+
E704, # Multiple statements on one line (def).
50+
W291, # Trailing whitespace.
51+
W292, # No newline at end of file.
52+
W293, # Blank line contains whitespace.
53+
W391, # Blank line at end of file.
54+
W504, # Line break occurred after a binary operator.
55+
56+
# Too opinionated.
57+
E265, # Block comment should start with '# '.
58+
E266, # Too many leading '#' for block comment.
59+
E402, # Module level import not at top of file. (Use cases like demandimport https://fburl.com/demandimport require statements before imports)
60+
E722, # Do not use bare except, specify exception instead. (Duplicate of B001)
61+
P207, # (Duplicate of B003)
62+
P208, # (Duplicate of C403)
63+
W503 # Line break occurred before a binary operator.

.github/workflows/docs.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Documentation
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["main"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow one concurrent deployment
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: true
22+
23+
jobs:
24+
# Single deploy job since we're just deploying
25+
deploy:
26+
environment:
27+
name: github-pages
28+
url: ${{ steps.deployment.outputs.page_url }}
29+
runs-on: ubuntu-latest
30+
strategy:
31+
matrix:
32+
python-version: ["3.9"]
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v3
36+
- name: Set up Python ${{ matrix.python-version }}
37+
uses: actions/setup-python@v2
38+
with:
39+
python-version: ${{ matrix.python-version }}
40+
- name: Install dependencies
41+
run: |
42+
python -m pip install --upgrade pip
43+
pip install autodocsumm
44+
pip install sphinx_rtd_theme
45+
pip install sphinx_gallery
46+
pip install sphinxcontrib-inlinesyntaxhighlight
47+
pip install sphinx_toolbox
48+
pip install numpy
49+
pip install jinja2
50+
pip install torch
51+
cd python
52+
python setup.py develop
53+
cd ..
54+
- name: Build documents with Sphinx
55+
run: |
56+
cd docs
57+
BUILD_DOCS=1 make html
58+
cd ..
59+
- name: Setup Pages
60+
uses: actions/configure-pages@v2
61+
- name: Upload artifact
62+
uses: actions/upload-pages-artifact@v1
63+
with:
64+
path: './docs/build/html'
65+
- name: Deploy to GitHub Pages
66+
id: deployment
67+
uses: actions/deploy-pages@v1

.github/workflows/lint.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
branches:
10+
- main
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.8"]
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install ufmt
27+
pip install click
28+
pip install flake8
29+
- name: Analyzing the code with flake8
30+
run: |
31+
echo "::add-matcher::tests/lint/flake8_problem_matcher.json"
32+
flake8 .
33+
- name: Analyzing the code with ufmt
34+
run: |
35+
ufmt diff python
36+
ufmt diff tests
37+
ufmt diff docs
38+
- name: Check Meta copyright header
39+
run: |
40+
python tests/lint/check_meta_header.py --path=./tests --fixit=False
41+
python tests/lint/check_meta_header.py --path=./python --fixit=False

0 commit comments

Comments
 (0)