Overhaul pt2ts
#91
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Workflow to run the FTorch test suite | |
| name: Test suite (Windows CPU Intel) | |
| # Controls when the workflow will run | |
| on: | |
| # Triggers the workflow on pushes to the "main" branch, i.e., PR merges | |
| push: | |
| branches: [ "main" ] | |
| # Triggers the workflow on pushes to open pull requests with changes to this workflow | |
| pull_request: | |
| paths: | |
| - '.github/workflows/test_suite_windows_cpu_intel.yml' | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Cancel jobs running if new commits are pushed | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| # Write permissions are not required | |
| permissions: {} | |
| # Workflow run - one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| # This workflow contains a single job called "test-suite-windows" | |
| test-suite: | |
| name: test suite | |
| # The type of runner that the job will run on | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| toolchain: | |
| - {compiler: intel, version: '2023.2'} | |
| # Terminate the job if it runs for more than 15 minutes | |
| timeout-minutes: 15 | |
| steps: | |
| # configure windows VM with intel compilers | |
| - uses: fortran-lang/setup-fortran@d2ba6ea44297a24407def2f6e117954d844a5368 # v1 | |
| id: setup-fortran | |
| with: | |
| compiler: ${{ matrix.toolchain.compiler }} | |
| version: ${{ matrix.toolchain.version }} | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - name: Checkout FTorch repository | |
| with: | |
| persist-credentials: true | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Setup Python | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6 | |
| with: | |
| python-version: '3.13' # Use 3.13 as no PyTorch wheels for 3.14 yet. | |
| - name: Install ftorch_utils | |
| shell: cmd | |
| run: | | |
| pip install --upgrade pip | |
| python -m venv ftorch | |
| call ftorch\Scripts\activate | |
| pip install . | |
| - name: Build FTorch | |
| shell: cmd | |
| run: | | |
| call ftorch\Scripts\activate | |
| rem Find Python executable in venv | |
| for /f %%i in ('python -c "import sys; print(sys.executable)"') do set PYTHON_EXECUTABLE=%%i | |
| rem Find torch location | |
| set TORCH_PATH= | |
| for /f "tokens=2*" %%i in ('pip show torch ^| findstr /R "^Location"') do set TORCH_PATH=%%i | |
| rem Set install location | |
| set FTORCH_INSTALL_DIR=%TEMP%\ftorch-install | |
| cmake ^ | |
| -Bbuild ^ | |
| -G "NMake Makefiles" ^ | |
| -DPython_EXECUTABLE=%PYTHON_EXECUTABLE% ^ | |
| -DCMAKE_Fortran_FLAGS="/fpscomp:logicals" ^ | |
| -DCMAKE_CXX_FLAGS="/D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH" ^ | |
| -DCMAKE_PREFIX_PATH=%TORCH_PATH% ^ | |
| -DCMAKE_BUILD_TYPE=Release ^ | |
| -DCMAKE_Fortran_COMPILER=ifx ^ | |
| -DCMAKE_C_COMPILER=icx ^ | |
| -DCMAKE_CXX_COMPILER=icx ^ | |
| -DCMAKE_BUILD_TESTS=TRUE ^ | |
| -DCMAKE_INSTALL_PREFIX=%FTORCH_INSTALL_DIR% | |
| cmake --build build | |
| cmake --install build | |
| - name: Integration tests | |
| shell: cmd | |
| run: | | |
| call ftorch\Scripts\activate | |
| set TORCH_PATH= | |
| for /f "tokens=2*" %%i in ('pip show torch ^| findstr /R "^Location"') do set TORCH_PATH=%%i | |
| set FTORCH_INSTALL_DIR=%TEMP%\ftorch-install | |
| set PATH=%FTORCH_INSTALL_DIR%\bin;%PATH% | |
| set PATH=%TORCH_PATH%\torch\lib;%PATH% | |
| cd build | |
| ctest --verbose --tests-regex example_tensor | |
| ctest --verbose --tests-regex example_simplenet | |
| ctest --verbose --tests-regex example_resnet | |
| ctest --verbose --tests-regex example_multiio | |
| ctest --verbose --tests-regex example_autograd | |
| - name: Standalone SimpleNet example | |
| shell: cmd | |
| run: | | |
| call ftorch\Scripts\activate | |
| for /f %%i in ('python -c "import sys; print(sys.executable)"') do set PYTHON_EXECUTABLE=%%i | |
| set TORCH_PATH= | |
| for /f "tokens=2*" %%i in ('pip show torch ^| findstr /R "^Location"') do set TORCH_PATH=%%i | |
| set FTORCH_INSTALL_DIR=%TEMP%\ftorch-install | |
| set PATH=%FTORCH_INSTALL_DIR%\bin;%PATH% | |
| set PATH=%TORCH_PATH%\torch\lib;%PATH% | |
| set EXAMPLE_BUILD_DIR=examples\02_SimpleNet\build | |
| if not exist %EXAMPLE_BUILD_DIR% mkdir %EXAMPLE_BUILD_DIR% | |
| cd %EXAMPLE_BUILD_DIR% | |
| cmake .. ^ | |
| -G "NMake Makefiles" ^ | |
| -DCMAKE_Fortran_COMPILER=ifx ^ | |
| -DCMAKE_Fortran_FLAGS="/fpscomp:logicals" ^ | |
| -DPython_EXECUTABLE=%PYTHON_EXECUTABLE% ^ | |
| -DCMAKE_BUILD_TYPE=Release ^ | |
| -DCMAKE_PREFIX_PATH=%FTORCH_INSTALL_DIR%;%TORCH_PATH% ^ | |
| -DCMAKE_BUILD_TESTS=TRUE | |
| cmake --build . | |
| ctest -V |