Skip to content

Commit

Permalink
TorchScript to Knossos test with preview PyTorch on GitHub Actions (#669
Browse files Browse the repository at this point in the history
)

* Try using PyTorch Preview for a nightly build - helps us detect if breakages occur early
* Make failable actions exit
* Create vcbuild.cmd
https://github.com/microsoft/vswhere/wiki/Find-VC
#679
  • Loading branch information
cgravill authored Mar 29, 2021
1 parent 9f33639 commit 5f32322
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 3 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/PyTorchPreviewTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: PyTorch (preview)

on:

schedule:
- cron: '5 4 * * *'
workflow_dispatch:

# named branch push is for testing while experimenting. Remove before merge to master
push:
branches:
- cogravil/pytorch_preview_ci

jobs:
build:

runs-on: windows-2019

steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: 3.7

- name: 'Make directories [userInstall]'
shell: pwsh
run: test/builds/mkdirs.ps1

- name: 'Install dependencies [userInstall]'
shell: cmd
run: call test/builds/install_windows.bat || sleep 30 && call test/builds/install_windows.bat || sleep 30 && call test/builds/install_windows.bat

- name: 'GHC compile src/ksc/Main.hs [userTest]'
shell: cmd
run: refreshenv && C:/ProgramData/chocolatey/lib/cabal/tools/cabal-3.0.0.0/cabal v2-install --with-ghc=C:/ProgramData/chocolatey/lib/ghc/tools/ghc-8.4.4/bin/ghc --installdir=build/bin --overwrite-policy=always --install-method=copy

# Preview version of PyTorch
- name: Testing ksc python package [userTest]
shell: cmd
run: test/builds/test_pytest_PyTorchPreview.cmd

6 changes: 3 additions & 3 deletions test/builds/install_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ choco install mingw --version 8.1.0 -y || exit /b
echo ----- test g++ installation -----
g++ --version
where g++
echo ----- install Ninja -----
choco install ninja || exit /b
echo ----- install ghc -----
choco install cabal --allow-downgrade --version 3.0.0.0 -y || exit /b
choco install ghc --allow-downgrade --version 8.4.4 -y || exit /b
echo ----- cabal install -----
refreshenv && C:/ProgramData/chocolatey/lib/cabal/tools/cabal-3.0.0.0/cabal new-update || exit /b
echo ----- install Ninja -----
choco install ninja
call refreshenv && C:/ProgramData/chocolatey/lib/cabal/tools/cabal-3.0.0.0/cabal new-update || exit /b
echo ----- installation done -----
40 changes: 40 additions & 0 deletions test/builds/test_pytest_PyTorchPreview.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
set -e

set PreferredToolArchitecture=x64

IF defined GITHUB_ACTIONS (
ECHO on GitHub Actions, activating vcbuild environment
call %~dp0vcbuild.cmd -arch=x64 -host_arch=x64
)

where cl.exe

echo Set Pip to specific version...
python -m pip install --force-reinstall pip==20.3 || exit /b

REM New resolver with PyTorch version notation https://pip.pypa.io/en/latest/user_guide/#changes-to-the-pip-dependency-resolver-in-20-3-2020
REM Too big, throw memory exception https://stackoverflow.com/a/31526029/35544

REM currently have backend issues on PyTorch 1.8.0 https://github.com/microsoft/knossos-ksc/issues/659 so trying nightly
echo Installing dependencies...
python -m pip install -r src/python/requirements.txt || exit /b
python -m pip install --pre --use-deprecated=legacy-resolver --no-cache-dir pytest numpy torch -f https://download.pytorch.org/whl/nightly/cu111/torch_nightly.html || exit /b

echo Installing ksc...
cd ./src/python
python -m pip install --editable . || exit /b
cd ../..

echo Running pytest
pytest test/python || exit /b

echo Installing TS2KS...
cd ./src/ts2k
python -m pip install --editable . || exit /b
cd ../..

REM we only run a single test for now, multiple tests run out of heap see #679
pytest test\ts2k\test_ts2k.py -k test_cat

REM echo Running pytest on ts2k
REM pytest test/ts2k || exit /b
10 changes: 10 additions & 0 deletions test/builds/vcbuild.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@REM from https://github.com/microsoft/vswhere/wiki/Find-VC
@echo off

for /f "usebackq tokens=*" %%i in (`vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
set InstallDir=%%i
)

if exist "%InstallDir%\Common7\Tools\vsdevcmd.bat" (
"%InstallDir%\Common7\Tools\vsdevcmd.bat" %*
)

0 comments on commit 5f32322

Please sign in to comment.