From 58f76b4a6683216cb18631740e5eeb0591211fe4 Mon Sep 17 00:00:00 2001 From: vfdev Date: Wed, 13 Jul 2022 16:58:00 +0200 Subject: [PATCH 1/8] Create test-m1.yml --- .github/workflows/test-m1.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/test-m1.yml diff --git a/.github/workflows/test-m1.yml b/.github/workflows/test-m1.yml new file mode 100644 index 000000000..e05ef4490 --- /dev/null +++ b/.github/workflows/test-m1.yml @@ -0,0 +1,37 @@ +name: Test-M1 +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: + - main + +jobs: + + tests: + name: "Unit-tests on M1" + runs-on: macos12.3-m1 + strategy: + matrix: + py_vers: [ "3.8"] + + steps: + - name: Checkout functorch + uses: actions/checkout@v2 + - name: Install PyTorch Nightly + shell: arch -arch arm64 bash {0} + run: | + python3 -mpip install --pre torch>=1.12.0.dev -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html + - name: Build Functorch and run tests + shell: arch -arch arm64 bash {0} + run: | + python3 setup.py develop + + python3 -m torch.utils.collect_env + + # test_functorch_lagging_op_db.py: Only run this locally because it checks + # the functorch lagging op db vs PyTorch's op db. + EXIT_STATUS=0 + find test \( -name test\*.py ! -name test_functorch_lagging_op_db.py \) | xargs -I {} -n 1 python {} -v || EXIT_STATUS=$? + exit $EXIT_STATUS + From 057ad7b69d00cc8980850c8d99977323921099e6 Mon Sep 17 00:00:00 2001 From: vfdev Date: Wed, 13 Jul 2022 17:02:33 +0200 Subject: [PATCH 2/8] Update test-m1.yml --- .github/workflows/test-m1.yml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-m1.yml b/.github/workflows/test-m1.yml index e05ef4490..d4e24eb75 100644 --- a/.github/workflows/test-m1.yml +++ b/.github/workflows/test-m1.yml @@ -20,18 +20,32 @@ jobs: uses: actions/checkout@v2 - name: Install PyTorch Nightly shell: arch -arch arm64 bash {0} + env: + ENV_NAME: conda-env-${{ github.run_id }} + PY_VERS: ${{ matrix.py_vers }} run: | - python3 -mpip install --pre torch>=1.12.0.dev -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html + . ~/miniconda3/etc/profile.d/conda.sh + export PATH=~/miniconda3/bin:$PATH + set -ex + conda create -yp ${ENV_NAME} python=${PY_VERS} + conda run -p ${ENV_NAME} python3 -mpip install --pre torch>=1.12.0.dev -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html - name: Build Functorch and run tests shell: arch -arch arm64 bash {0} + env: + ENV_NAME: conda-env-${{ github.run_id }} + PY_VERS: ${{ matrix.py_vers }} run: | - python3 setup.py develop - - python3 -m torch.utils.collect_env + . ~/miniconda3/etc/profile.d/conda.sh + set -ex + conda run -p ${ENV_NAME} python3 setup.py develop + conda run -p ${ENV_NAME} python3 -m torch.utils.collect_env # test_functorch_lagging_op_db.py: Only run this locally because it checks # the functorch lagging op db vs PyTorch's op db. EXIT_STATUS=0 - find test \( -name test\*.py ! -name test_functorch_lagging_op_db.py \) | xargs -I {} -n 1 python {} -v || EXIT_STATUS=$? + conda run -p ${ENV_NAME} find test \( -name test\*.py ! -name test_functorch_lagging_op_db.py \) | xargs -I {} -n 1 python {} -v || EXIT_STATUS=$? + + conda env remove -p ${ENV_NAME} + exit $EXIT_STATUS From b1e7752e8ee9562e69f39ef4dd80cfd9cf862de9 Mon Sep 17 00:00:00 2001 From: vfdev Date: Wed, 13 Jul 2022 17:05:00 +0200 Subject: [PATCH 3/8] Update test-m1.yml --- .github/workflows/test-m1.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-m1.yml b/.github/workflows/test-m1.yml index d4e24eb75..a616306b2 100644 --- a/.github/workflows/test-m1.yml +++ b/.github/workflows/test-m1.yml @@ -43,7 +43,8 @@ jobs: # test_functorch_lagging_op_db.py: Only run this locally because it checks # the functorch lagging op db vs PyTorch's op db. EXIT_STATUS=0 - conda run -p ${ENV_NAME} find test \( -name test\*.py ! -name test_functorch_lagging_op_db.py \) | xargs -I {} -n 1 python {} -v || EXIT_STATUS=$? + + find test \( -name test\*.py ! -name test_functorch_lagging_op_db.py \) | xargs -I {} -n 1 conda run -p ${ENV_NAME} python3 {} -v || EXIT_STATUS=$? conda env remove -p ${ENV_NAME} From 7513a73f53afbb8a9f0ef00b4b2aa199836fbc01 Mon Sep 17 00:00:00 2001 From: vfdev Date: Wed, 13 Jul 2022 17:10:14 +0200 Subject: [PATCH 4/8] Update test-m1.yml --- .github/workflows/test-m1.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-m1.yml b/.github/workflows/test-m1.yml index a616306b2..49f1e06f6 100644 --- a/.github/workflows/test-m1.yml +++ b/.github/workflows/test-m1.yml @@ -43,8 +43,13 @@ jobs: # test_functorch_lagging_op_db.py: Only run this locally because it checks # the functorch lagging op db vs PyTorch's op db. EXIT_STATUS=0 + + export IN_CI=1 + mkdir test-reports + eval "$(conda shell.bash hook)" + conda activate ${ENV_NAME} - find test \( -name test\*.py ! -name test_functorch_lagging_op_db.py \) | xargs -I {} -n 1 conda run -p ${ENV_NAME} python3 {} -v || EXIT_STATUS=$? + find test \( -name test\*.py ! -name test_functorch_lagging_op_db.py \) | xargs -I {} -n 1 python3 {} -v || EXIT_STATUS=$? conda env remove -p ${ENV_NAME} From 0ed4dd2d1a0cfec5ba932a53970a3154aa0bd0e9 Mon Sep 17 00:00:00 2001 From: vfdev Date: Wed, 13 Jul 2022 17:17:53 +0200 Subject: [PATCH 5/8] Update test-m1.yml --- .github/workflows/test-m1.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-m1.yml b/.github/workflows/test-m1.yml index 49f1e06f6..b34cebc0d 100644 --- a/.github/workflows/test-m1.yml +++ b/.github/workflows/test-m1.yml @@ -42,16 +42,17 @@ jobs: conda run -p ${ENV_NAME} python3 -m torch.utils.collect_env # test_functorch_lagging_op_db.py: Only run this locally because it checks # the functorch lagging op db vs PyTorch's op db. - EXIT_STATUS=0 + # EXIT_STATUS=0 export IN_CI=1 mkdir test-reports - eval "$(conda shell.bash hook)" - conda activate ${ENV_NAME} - find test \( -name test\*.py ! -name test_functorch_lagging_op_db.py \) | xargs -I {} -n 1 python3 {} -v || EXIT_STATUS=$? + # find test \( -name test\*.py ! -name test_functorch_lagging_op_db.py \) | xargs -I {} -n 1 python3 {} -v || EXIT_STATUS=$? - conda env remove -p ${ENV_NAME} - - exit $EXIT_STATUS + # Just check vmap, ops and other eager ops + conda run -p ${ENV_NAME} python3 -mpip install pytest + conda run -p ${ENV_NAME} --no-capture-output python3 -u -mpytest -vvv test/test_vmap.py test/test_ops.py test/test_eager_transforms.py + + conda env remove -p ${ENV_NAME} + # exit $EXIT_STATUS From c1baaf9035f92e30f3be7d3112ab0d6ebd926cd3 Mon Sep 17 00:00:00 2001 From: vfdev Date: Wed, 13 Jul 2022 17:21:38 +0200 Subject: [PATCH 6/8] Update test-m1.yml --- .github/workflows/test-m1.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-m1.yml b/.github/workflows/test-m1.yml index b34cebc0d..be7309b3d 100644 --- a/.github/workflows/test-m1.yml +++ b/.github/workflows/test-m1.yml @@ -28,7 +28,7 @@ jobs: export PATH=~/miniconda3/bin:$PATH set -ex conda create -yp ${ENV_NAME} python=${PY_VERS} - conda run -p ${ENV_NAME} python3 -mpip install --pre torch>=1.12.0.dev -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html + conda run -p ${ENV_NAME} python3 -mpip install --pre torch>=1.12.0.dev torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html - name: Build Functorch and run tests shell: arch -arch arm64 bash {0} env: @@ -50,7 +50,7 @@ jobs: # find test \( -name test\*.py ! -name test_functorch_lagging_op_db.py \) | xargs -I {} -n 1 python3 {} -v || EXIT_STATUS=$? # Just check vmap, ops and other eager ops - conda run -p ${ENV_NAME} python3 -mpip install pytest + conda run -p ${ENV_NAME} python3 -mpip install pytest numpy scipy conda run -p ${ENV_NAME} --no-capture-output python3 -u -mpytest -vvv test/test_vmap.py test/test_ops.py test/test_eager_transforms.py conda env remove -p ${ENV_NAME} From fed990d4530e9c55d47c52fd606bea0d04576e09 Mon Sep 17 00:00:00 2001 From: vfdev Date: Wed, 13 Jul 2022 17:24:01 +0200 Subject: [PATCH 7/8] Update test-m1.yml --- .github/workflows/test-m1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-m1.yml b/.github/workflows/test-m1.yml index be7309b3d..93e1051bb 100644 --- a/.github/workflows/test-m1.yml +++ b/.github/workflows/test-m1.yml @@ -50,7 +50,7 @@ jobs: # find test \( -name test\*.py ! -name test_functorch_lagging_op_db.py \) | xargs -I {} -n 1 python3 {} -v || EXIT_STATUS=$? # Just check vmap, ops and other eager ops - conda run -p ${ENV_NAME} python3 -mpip install pytest numpy scipy + conda run -p ${ENV_NAME} python3 -mpip install pytest numpy scipy expecttest conda run -p ${ENV_NAME} --no-capture-output python3 -u -mpytest -vvv test/test_vmap.py test/test_ops.py test/test_eager_transforms.py conda env remove -p ${ENV_NAME} From f25e2d9ea2c5d6489963e230ec9344150e1af9d4 Mon Sep 17 00:00:00 2001 From: vfdev Date: Wed, 13 Jul 2022 17:27:59 +0200 Subject: [PATCH 8/8] Update test-m1.yml --- .github/workflows/test-m1.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-m1.yml b/.github/workflows/test-m1.yml index 93e1051bb..98b7ffd0b 100644 --- a/.github/workflows/test-m1.yml +++ b/.github/workflows/test-m1.yml @@ -50,7 +50,8 @@ jobs: # find test \( -name test\*.py ! -name test_functorch_lagging_op_db.py \) | xargs -I {} -n 1 python3 {} -v || EXIT_STATUS=$? # Just check vmap, ops and other eager ops - conda run -p ${ENV_NAME} python3 -mpip install pytest numpy scipy expecttest + conda run -p ${ENV_NAME} conda install pyyaml + conda run -p ${ENV_NAME} python3 -mpip install pytest numpy scipy expecttest unittest-xml-reporting networkx av conda run -p ${ENV_NAME} --no-capture-output python3 -u -mpytest -vvv test/test_vmap.py test/test_ops.py test/test_eager_transforms.py conda env remove -p ${ENV_NAME}