diff --git a/.github/workflows/PyTorchPreviewTest.yml b/.github/workflows/PyTorchPreviewTest.yml new file mode 100644 index 000000000..0a75c8d86 --- /dev/null +++ b/.github/workflows/PyTorchPreviewTest.yml @@ -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 + diff --git a/test/builds/install_windows.bat b/test/builds/install_windows.bat index 938b6a2d0..cdd41a642 100644 --- a/test/builds/install_windows.bat +++ b/test/builds/install_windows.bat @@ -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 ----- diff --git a/test/builds/test_pytest_PyTorchPreview.cmd b/test/builds/test_pytest_PyTorchPreview.cmd new file mode 100644 index 000000000..0be8df8ec --- /dev/null +++ b/test/builds/test_pytest_PyTorchPreview.cmd @@ -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 diff --git a/test/builds/vcbuild.cmd b/test/builds/vcbuild.cmd new file mode 100644 index 000000000..f90514148 --- /dev/null +++ b/test/builds/vcbuild.cmd @@ -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" %* +)