Skip to content

Commit e160474

Browse files
committed
fbshipit-source-id: 28c84b50b0a6699b88bfd075f7fdcff94f1be102
1 parent ebd2f23 commit e160474

33 files changed

+159
-5267
lines changed

.circleci/config.yml

Lines changed: 63 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,84 @@ setup_env: &setup_env
1818
- run:
1919
name: Setup environment
2020
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
21+
for i in {1..3}; do
22+
python3.8 --version &&
23+
python3.8 -m pip install --upgrade pip &&
24+
cd /home/circleci/project/python &&
25+
python3.8 setup.py bdist_wheel &&
26+
sudo python3.8 -m pip install --no-input dist/*.whl &&
27+
cd /home/circleci/project &&
28+
python3.8 -m pip install pytest &&
29+
python3.8 -m pip install torch &&
30+
python3.8 -m pip install numpy &&
31+
python3.8 -m pip install jinja2 &&
32+
python3.8 -m pip install recordtype &&
33+
python3.8 -m pip install parameterized &&
34+
python3.8 -m pip install einops &&
35+
git submodule sync &&
36+
git submodule update --init &&
37+
echo 'export PYTHONPATH=$PWD/python:$PYTHONPATH' >> $BASH_ENV &&
38+
echo 'export PATH=/usr/local/cuda-11.4/bin:$PATH' >> $BASH_ENV &&
39+
echo 'export CI_FLAG=CIRCLECI' >> $BASH_ENV &&
40+
echo 'export CACHE_DIR=$PWD/tests/ci_profile_cache' >> $BASH_ENV &&
41+
break || sleep 5;
42+
done
43+
44+
45+
setup_fx2ait_env: &setup_fx2ait_env
46+
- run:
47+
name: Setup fx2ait environment
48+
command: |
49+
for i in {1..3}; do
50+
wget https://developer.download.nvidia.com/compute/redist/cudnn/v8.7.0/local_installers/11.8/cudnn-linux-x86_64-8.7.0.84_cuda11-archive.tar.xz
51+
tar -xvf cudnn-*-archive.tar.xz
52+
sudo cp cudnn-*-archive/include/cudnn*.h /usr/local/cuda/include
53+
sudo cp -P cudnn-*-archive/lib/libcudnn* /usr/local/cuda/lib64
54+
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
55+
python3.8 -m pip install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu116
56+
python3.8 fx2ait/setup.py install --prefix=/home/circleci/
57+
echo 'export PYTHONPATH=$PWD/fx2ait:$PYTHONPATH' >> $BASH_ENV
58+
break || sleep 5;
59+
done
4060
4161
basic_tests: &basic_tests
4262
- run:
4363
name: Run tests
4464
command: |
4565
set -e
4666
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
67+
mkdir ~/test-results
68+
python3.8 -m pytest $TEST_FILES -o junit_family=xunit1 --junitxml=~/test-results/junit.xml --verbose --continue-on-collection-errors -rA
4969
70+
fx2ait_tests: &fx2ait_tests
71+
- run:
72+
name: Run fx2ait tests
73+
command: |
74+
source $BASH_ENV
75+
mkdir -p ~/test-fx2ait-results
76+
TEST_FILES=$(circleci tests glob "fx2ait/fx2ait/test/test_*.py" "fx2ait/fx2ait/test/converters/**/test_*.py")
77+
python3.8 -m pytest $TEST_FILES -o junit_family=xunit1 --junitxml=~/test-fx2ait-results/junit.xml --verbose --continue-on-collection-errors -rA
5078
5179
# Define a job to be invoked later in a workflow.
5280
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
5381
jobs:
82+
fx2ait-test:
83+
machine:
84+
image: ubuntu-2004-cuda-11.4:202110-01
85+
resource_class: gpu.nvidia.medium
86+
steps:
87+
- checkout
88+
- <<: *setup_env
89+
- <<: *setup_fx2ait_env
90+
- <<: *fx2ait_tests
91+
- store_test_results:
92+
path: ~/test-fx2ait-results
93+
5494
build-and-test:
5595
machine:
5696
image: ubuntu-2004-cuda-11.4:202110-01
5797
# Check T101565170 for multi-gpu use cases.
5898
resource_class: gpu.nvidia.medium
59-
6099
parallelism: 10
61100

62101
# Checkout the code as the first step. This is a dedicated CircleCI step.
@@ -69,12 +108,13 @@ jobs:
69108
- <<: *setup_env
70109
- <<: *basic_tests
71110
- store_test_results:
72-
path: test-results
111+
path: ~/test-results
73112

74113
# Invoke jobs via workflows
75114
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
76115
workflows:
77116
unittest: # This is the name of the workflow, feel free to change it to better match your workflow.
78117
# Inside the workflow, you define the jobs you want to run.
79118
jobs:
119+
- fx2ait-test
80120
- build-and-test

.flake8

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,111 +7,111 @@ ignore =
77
# Found in https://github.com/psf/black/issues/429
88
# Line too long.
99
B950,
10-
# Indentation is not a multiple of four.
11-
E111,
10+
# Indentation is not a multiple of four.
11+
E111,
1212
# Expected an indented block (comment).
13-
E115,
13+
E115,
1414
# Over-indented.
1515
E117,
16-
# Continuation line under-indented for hanging indent.
16+
# Continuation line under-indented for hanging indent.
1717
E121,
18-
# Continuation line missing indentation or outdented.
18+
# Continuation line missing indentation or outdented.
1919
E122,
20-
# Closing bracket does not match indentation of opening bracket's line.
20+
# Closing bracket does not match indentation of opening bracket's line.
2121
E123,
22-
# Closing bracket does not match visual indentation.
22+
# Closing bracket does not match visual indentation.
2323
E124,
24-
# Continuation line with same indent as next logical line.
24+
# Continuation line with same indent as next logical line.
2525
E125,
26-
# Continuation line over-indented for hanging indent.
26+
# Continuation line over-indented for hanging indent.
2727
E126,
28-
# Continuation line over-indented for visual indent.
28+
# Continuation line over-indented for visual indent.
2929
E127,
30-
# Continuation line under-indented for visual indent.
30+
# Continuation line under-indented for visual indent.
3131
E128,
32-
# Visually indented line with same indent as next logical line.
32+
# Visually indented line with same indent as next logical line.
3333
E129,
34-
# Continuation line unaligned for hanging indent.
34+
# Continuation line unaligned for hanging indent.
3535
E131,
36-
# Whitespace after '('.
36+
# Whitespace after '('.
3737
E201,
38-
# Whitespace before ')'.
38+
# Whitespace before ')'.
3939
E202,
40-
# Whitespace before ':'.
40+
# Whitespace before ':'.
4141
E203,
42-
# Multiple spaces before operator.
42+
# Multiple spaces before operator.
4343
E221,
44-
# Multiple spaces after operator.
44+
# Multiple spaces after operator.
4545
E222,
46-
# Missing whitespace around operator.
46+
# Missing whitespace around operator.
4747
E225,
48-
# Missing whitespace around arithmetic operator.
48+
# Missing whitespace around arithmetic operator.
4949
E226,
50-
# Missing whitespace around bitwise or shift operator.
50+
# Missing whitespace around bitwise or shift operator.
5151
E227,
52-
# Missing whitespace after ',', ';', or ':'.
52+
# Missing whitespace after ',', ';', or ':'.
5353
E231,
54-
# Multiple spaces after ','.
54+
# Multiple spaces after ','.
5555
E241,
56-
# Unexpected spaces around keyword / parameter equals.
56+
# Unexpected spaces around keyword / parameter equals.
5757
E251,
58-
# Missing whitespace around parameter equals.
58+
# Missing whitespace around parameter equals.
5959
E252,
60-
# At least two spaces before inline comment.
61-
E261,
60+
# At least two spaces before inline comment.
61+
E261,
6262
# Inline comment should start with '# '.
63-
E262,
63+
E262,
6464
# Block comment should start with '# '.
6565
E265,
66-
# Multiple spaces after keyword.
66+
# Multiple spaces after keyword.
6767
E271,
68-
# Multiple spaces before keyword.
68+
# Multiple spaces before keyword.
6969
E272,
70-
# Expected 1 blank line, found 0.
70+
# Expected 1 blank line, found 0.
7171
E301,
72-
# Expected 2 blank lines, found 0.
72+
# Expected 2 blank lines, found 0.
7373
E302,
74-
# Too many blank lines (3).
74+
# Too many blank lines (3).
7575
E303,
76-
# Expected 2 blank lines after end of function or class.
76+
# Expected 2 blank lines after end of function or class.
7777
E305,
78-
# Expected 1 blank line before a nested definition.
78+
# Expected 1 blank line before a nested definition.
7979
E306,
80-
# Line too long (82 > 79 characters).
80+
# Line too long (82 > 79 characters).
8181
E501,
82-
# The backslash is redundant between brackets.
82+
# The backslash is redundant between brackets.
8383
E502,
84-
# Multiple statements on one line (colon).
84+
# Multiple statements on one line (colon).
8585
E701,
86-
# Multiple statements on one line (semicolon).
86+
# Multiple statements on one line (semicolon).
8787
E702,
88-
# Statement ends with a semicolon.
88+
# Statement ends with a semicolon.
8989
E703,
90-
# Multiple statements on one line (def).
90+
# Multiple statements on one line (def).
9191
E704,
92-
# Trailing whitespace.
92+
# Trailing whitespace.
9393
W291,
94-
# No newline at end of file.
94+
# No newline at end of file.
9595
W292,
96-
# Blank line contains whitespace.
96+
# Blank line contains whitespace.
9797
W293,
98-
# Blank line at end of file.
98+
# Blank line at end of file.
9999
W391,
100-
# Line break occurred after a binary operator.
101-
W504,
100+
# Line break occurred after a binary operator.
101+
W504,
102102

103103
# Too opinionated.
104104
# Block comment should start with '# '.
105105
E265,
106-
# Too many leading '#' for block comment.
106+
# Too many leading '#' for block comment.
107107
E266,
108-
# Module level import not at top of file. (Use cases like demandimport https://fburl.com/demandimport require statements before imports)
109-
E402,
108+
# Module level import not at top of file. (Use cases like demandimport https://fburl.com/demandimport require statements before imports)
109+
E402,
110110
# Do not use bare except, specify exception instead. (Duplicate of B001)
111-
E722,
111+
E722,
112112
# (Duplicate of B003)
113-
P207,
113+
P207,
114114
# (Duplicate of C403)
115115
P208,
116116
# Line break occurred before a binary operator.
117-
W503
117+
W503

.github/workflows/docs.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Docs
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.9"]
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 autodocsumm
27+
pip install sphinx_rtd_theme
28+
pip install sphinx_gallery
29+
pip install sphinxcontrib-inlinesyntaxhighlight
30+
pip install sphinx_toolbox
31+
cd python
32+
python setup.py develop
33+
cd ..
34+
pip install numpy
35+
- name: Build documents with Sphinx
36+
run: |
37+
cd docs
38+
make html
39+
cd ..

.github/workflows/docs.yml renamed to .github/workflows/pages.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Simple workflow for deploying static content to GitHub Pages
2-
name: Documentation
2+
name: Deploy docs to Pages
33

44
on:
55
# Runs on pushes targeting the default branch
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
strategy:
3131
matrix:
32-
python-version: ["3.9"]
32+
python-version: ["3.8"]
3333
steps:
3434
- name: Checkout
3535
uses: actions/checkout@v3

.github/workflows/lint.yml renamed to .github/workflows/pylint.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ jobs:
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip
26-
pip install ufmt
27-
pip install click
28-
pip install flake8
26+
pip install ufmt==2.0.1 click==8.1.3 black==22.12.0 flake8==5.0.4
2927
- name: Analyzing the code with flake8
3028
run: |
3129
echo "::add-matcher::tests/lint/flake8_problem_matcher.json"
@@ -38,4 +36,4 @@ jobs:
3836
- name: Check Meta copyright header
3937
run: |
4038
python tests/lint/check_meta_header.py --path=./tests --fixit=False
41-
python tests/lint/check_meta_header.py --path=./python --fixit=False
39+
python tests/lint/check_meta_header.py --path=./python --fixit=False

0 commit comments

Comments
 (0)