Skip to content

Commit

Permalink
fbshipit-source-id: 28c84b50b0a6699b88bfd075f7fdcff94f1be102
Browse files Browse the repository at this point in the history
  • Loading branch information
ipiszy committed Jan 31, 2023
1 parent ebd2f23 commit e160474
Show file tree
Hide file tree
Showing 33 changed files with 159 additions and 5,267 deletions.
86 changes: 63 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,84 @@ setup_env: &setup_env
- run:
name: Setup environment
command: |
python3.8 --version
python3.8 -m pip install --upgrade pip
cd python
python3.8 setup.py bdist_wheel
sudo python3.8 -m pip install --no-input dist/*.whl
cd ..
python3.8 -m pip install pytest
python3.8 -m pip install torch
python3.8 -m pip install numpy
python3.8 -m pip install jinja2
python3.8 -m pip install recordtype
python3.8 -m pip install parameterized
python3.8 -m pip install einops
git submodule sync
git submodule update --init
echo 'export PYTHONPATH=$PWD/python:$PYTHONPATH' >> $BASH_ENV
echo 'export PATH=/usr/local/cuda-11.4/bin:$PATH' >> $BASH_ENV
echo 'export CI_FLAG=CIRCLECI' >> $BASH_ENV
echo 'export CACHE_DIR=$PWD/tests/ci_profile_cache' >> $BASH_ENV
for i in {1..3}; do
python3.8 --version &&
python3.8 -m pip install --upgrade pip &&
cd /home/circleci/project/python &&
python3.8 setup.py bdist_wheel &&
sudo python3.8 -m pip install --no-input dist/*.whl &&
cd /home/circleci/project &&
python3.8 -m pip install pytest &&
python3.8 -m pip install torch &&
python3.8 -m pip install numpy &&
python3.8 -m pip install jinja2 &&
python3.8 -m pip install recordtype &&
python3.8 -m pip install parameterized &&
python3.8 -m pip install einops &&
git submodule sync &&
git submodule update --init &&
echo 'export PYTHONPATH=$PWD/python:$PYTHONPATH' >> $BASH_ENV &&
echo 'export PATH=/usr/local/cuda-11.4/bin:$PATH' >> $BASH_ENV &&
echo 'export CI_FLAG=CIRCLECI' >> $BASH_ENV &&
echo 'export CACHE_DIR=$PWD/tests/ci_profile_cache' >> $BASH_ENV &&
break || sleep 5;
done
setup_fx2ait_env: &setup_fx2ait_env
- run:
name: Setup fx2ait environment
command: |
for i in {1..3}; do
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
tar -xvf cudnn-*-archive.tar.xz
sudo cp cudnn-*-archive/include/cudnn*.h /usr/local/cuda/include
sudo cp -P cudnn-*-archive/lib/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
python3.8 -m pip install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu116
python3.8 fx2ait/setup.py install --prefix=/home/circleci/
echo 'export PYTHONPATH=$PWD/fx2ait:$PYTHONPATH' >> $BASH_ENV
break || sleep 5;
done
basic_tests: &basic_tests
- run:
name: Run tests
command: |
set -e
TEST_FILES=$(circleci tests glob "tests/unittest/**/test_*.py" | grep -v benchmark | circleci tests split --split-by=timings)
mkdir test-results
python3.8 -m pytest $TEST_FILES --junitxml=test-results/junit.xml --verbose --continue-on-collection-errors -rA
mkdir ~/test-results
python3.8 -m pytest $TEST_FILES -o junit_family=xunit1 --junitxml=~/test-results/junit.xml --verbose --continue-on-collection-errors -rA
fx2ait_tests: &fx2ait_tests
- run:
name: Run fx2ait tests
command: |
source $BASH_ENV
mkdir -p ~/test-fx2ait-results
TEST_FILES=$(circleci tests glob "fx2ait/fx2ait/test/test_*.py" "fx2ait/fx2ait/test/converters/**/test_*.py")
python3.8 -m pytest $TEST_FILES -o junit_family=xunit1 --junitxml=~/test-fx2ait-results/junit.xml --verbose --continue-on-collection-errors -rA
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
fx2ait-test:
machine:
image: ubuntu-2004-cuda-11.4:202110-01
resource_class: gpu.nvidia.medium
steps:
- checkout
- <<: *setup_env
- <<: *setup_fx2ait_env
- <<: *fx2ait_tests
- store_test_results:
path: ~/test-fx2ait-results

build-and-test:
machine:
image: ubuntu-2004-cuda-11.4:202110-01
# Check T101565170 for multi-gpu use cases.
resource_class: gpu.nvidia.medium

parallelism: 10

# Checkout the code as the first step. This is a dedicated CircleCI step.
Expand All @@ -69,12 +108,13 @@ jobs:
- <<: *setup_env
- <<: *basic_tests
- store_test_results:
path: test-results
path: ~/test-results

# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
unittest: # This is the name of the workflow, feel free to change it to better match your workflow.
# Inside the workflow, you define the jobs you want to run.
jobs:
- fx2ait-test
- build-and-test
106 changes: 53 additions & 53 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -7,111 +7,111 @@ ignore =
# Found in https://github.com/psf/black/issues/429
# Line too long.
B950,
# Indentation is not a multiple of four.
E111,
# Indentation is not a multiple of four.
E111,
# Expected an indented block (comment).
E115,
E115,
# Over-indented.
E117,
# Continuation line under-indented for hanging indent.
# Continuation line under-indented for hanging indent.
E121,
# Continuation line missing indentation or outdented.
# Continuation line missing indentation or outdented.
E122,
# Closing bracket does not match indentation of opening bracket's line.
# Closing bracket does not match indentation of opening bracket's line.
E123,
# Closing bracket does not match visual indentation.
# Closing bracket does not match visual indentation.
E124,
# Continuation line with same indent as next logical line.
# Continuation line with same indent as next logical line.
E125,
# Continuation line over-indented for hanging indent.
# Continuation line over-indented for hanging indent.
E126,
# Continuation line over-indented for visual indent.
# Continuation line over-indented for visual indent.
E127,
# Continuation line under-indented for visual indent.
# Continuation line under-indented for visual indent.
E128,
# Visually indented line with same indent as next logical line.
# Visually indented line with same indent as next logical line.
E129,
# Continuation line unaligned for hanging indent.
# Continuation line unaligned for hanging indent.
E131,
# Whitespace after '('.
# Whitespace after '('.
E201,
# Whitespace before ')'.
# Whitespace before ')'.
E202,
# Whitespace before ':'.
# Whitespace before ':'.
E203,
# Multiple spaces before operator.
# Multiple spaces before operator.
E221,
# Multiple spaces after operator.
# Multiple spaces after operator.
E222,
# Missing whitespace around operator.
# Missing whitespace around operator.
E225,
# Missing whitespace around arithmetic operator.
# Missing whitespace around arithmetic operator.
E226,
# Missing whitespace around bitwise or shift operator.
# Missing whitespace around bitwise or shift operator.
E227,
# Missing whitespace after ',', ';', or ':'.
# Missing whitespace after ',', ';', or ':'.
E231,
# Multiple spaces after ','.
# Multiple spaces after ','.
E241,
# Unexpected spaces around keyword / parameter equals.
# Unexpected spaces around keyword / parameter equals.
E251,
# Missing whitespace around parameter equals.
# Missing whitespace around parameter equals.
E252,
# At least two spaces before inline comment.
E261,
# At least two spaces before inline comment.
E261,
# Inline comment should start with '# '.
E262,
E262,
# Block comment should start with '# '.
E265,
# Multiple spaces after keyword.
# Multiple spaces after keyword.
E271,
# Multiple spaces before keyword.
# Multiple spaces before keyword.
E272,
# Expected 1 blank line, found 0.
# Expected 1 blank line, found 0.
E301,
# Expected 2 blank lines, found 0.
# Expected 2 blank lines, found 0.
E302,
# Too many blank lines (3).
# Too many blank lines (3).
E303,
# Expected 2 blank lines after end of function or class.
# Expected 2 blank lines after end of function or class.
E305,
# Expected 1 blank line before a nested definition.
# Expected 1 blank line before a nested definition.
E306,
# Line too long (82 > 79 characters).
# Line too long (82 > 79 characters).
E501,
# The backslash is redundant between brackets.
# The backslash is redundant between brackets.
E502,
# Multiple statements on one line (colon).
# Multiple statements on one line (colon).
E701,
# Multiple statements on one line (semicolon).
# Multiple statements on one line (semicolon).
E702,
# Statement ends with a semicolon.
# Statement ends with a semicolon.
E703,
# Multiple statements on one line (def).
# Multiple statements on one line (def).
E704,
# Trailing whitespace.
# Trailing whitespace.
W291,
# No newline at end of file.
# No newline at end of file.
W292,
# Blank line contains whitespace.
# Blank line contains whitespace.
W293,
# Blank line at end of file.
# Blank line at end of file.
W391,
# Line break occurred after a binary operator.
W504,
# Line break occurred after a binary operator.
W504,

# Too opinionated.
# Block comment should start with '# '.
E265,
# Too many leading '#' for block comment.
# Too many leading '#' for block comment.
E266,
# Module level import not at top of file. (Use cases like demandimport https://fburl.com/demandimport require statements before imports)
E402,
# Module level import not at top of file. (Use cases like demandimport https://fburl.com/demandimport require statements before imports)
E402,
# Do not use bare except, specify exception instead. (Duplicate of B001)
E722,
E722,
# (Duplicate of B003)
P207,
P207,
# (Duplicate of C403)
P208,
# Line break occurred before a binary operator.
W503
W503
39 changes: 39 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Docs

on:
push:
branches:
- main

pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install autodocsumm
pip install sphinx_rtd_theme
pip install sphinx_gallery
pip install sphinxcontrib-inlinesyntaxhighlight
pip install sphinx_toolbox
cd python
python setup.py develop
cd ..
pip install numpy
- name: Build documents with Sphinx
run: |
cd docs
make html
cd ..
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml → .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Simple workflow for deploying static content to GitHub Pages
name: Documentation
name: Deploy docs to Pages

on:
# Runs on pushes targeting the default branch
Expand Down Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
python-version: ["3.8"]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/lint.yml → .github/workflows/pylint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ufmt
pip install click
pip install flake8
pip install ufmt==2.0.1 click==8.1.3 black==22.12.0 flake8==5.0.4
- name: Analyzing the code with flake8
run: |
echo "::add-matcher::tests/lint/flake8_problem_matcher.json"
Expand All @@ -38,4 +36,4 @@ jobs:
- name: Check Meta copyright header
run: |
python tests/lint/check_meta_header.py --path=./tests --fixit=False
python tests/lint/check_meta_header.py --path=./python --fixit=False
python tests/lint/check_meta_header.py --path=./python --fixit=False
Loading

0 comments on commit e160474

Please sign in to comment.