4242
4343 steps :
4444 # configure windows VM with intel compilers
45- - uses : fortran-lang/setup-fortran@d2ba6ea44297a24407def2f6e117954d844a5368 # v1
45+ - name : Setup Fortran
46+ uses : fortran-lang/setup-fortran@2a1b9c55897d827a9dfeb114408f3615e53b2b72 # v1.9.0
4647 id : setup-fortran
4748 with :
4849 compiler : ${{ matrix.toolchain.compiler }}
@@ -55,60 +56,60 @@ jobs:
5556 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5657
5758 - name : Setup Python
58- uses : actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
59+ uses : actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
5960 with :
6061 python-version : ' 3.13' # Use 3.13 as no PyTorch wheels for 3.14 yet.
6162
6263 - name : Install ftorch_utils
63- shell : cmd
64+ shell : pwsh
6465 run : |
6566 pip install --upgrade pip
6667 python -m venv ftorch
67- call ftorch\Scripts\activate
68+ .\ ftorch\Scripts\Activate.ps1
6869 pip install . --group test
6970
7071 - name : Build FTorch
71- shell : cmd
72+ shell : pwsh
7273 run : |
73- call ftorch\Scripts\activate
74- rem Find Python executable in venv
75- for /f %%i in ('python -c "import sys; print(sys.executable)"') do set PYTHON_EXECUTABLE=%%i
76- rem Find torch location
77- set TORCH_PATH=
78- for /f "tokens=2*" %%i in ('pip show torch ^| findstr /R "^Location"') do set TORCH_PATH=%%i
79- rem Set install location
80- set FTORCH_INSTALL_DIR=%TEMP%\ftorch-install
81- cmake ^
82- -Bbuild ^
83- -G "NMake Makefiles" ^
84- -DPython_EXECUTABLE=%PYTHON_EXECUTABLE% ^
85- -DCMAKE_Fortran_FLAGS="/fpscomp:logicals" ^
86- -DCMAKE_CXX_FLAGS="/D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH" ^
87- -DCMAKE_PREFIX_PATH=%TORCH_PATH% ^
88- -DCMAKE_BUILD_TYPE=Release ^
89- -DCMAKE_Fortran_COMPILER=ifx ^
90- -DCMAKE_C_COMPILER=icx ^
91- -DCMAKE_CXX_COMPILER=icx ^
92- -DCMAKE_BUILD_TESTS=TRUE ^
93- -DCMAKE_INSTALL_PREFIX=%FTORCH_INSTALL_DIR%
74+ .\ftorch\Scripts\Activate.ps1
75+ # Find Python executable in venv
76+ $PYTHON_EXECUTABLE = python -c "import sys; print(sys.executable)"
77+ # Find torch location
78+ $Torch_DIR = (pip show torch | Select-String -Pattern "^Location" | ForEach-Object { $_.Line -replace "^Location:\s*", "" })
79+ # Set install location
80+ $FTORCH_INSTALL_DIR = "$env:TEMP\ftorch-install"
81+ cmake `
82+ -Bbuild `
83+ -G "NMake Makefiles" `
84+ -DPython_EXECUTABLE="$PYTHON_EXECUTABLE" `
85+ -DCMAKE_Fortran_FLAGS="/fpscomp:logicals" `
86+ -DCMAKE_CXX_FLAGS="/D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH" `
87+ -DCMAKE_PREFIX_PATH="$Torch_DIR\torch" `
88+ -DCMAKE_BUILD_TYPE=Release `
89+ -DCMAKE_Fortran_COMPILER=ifx `
90+ -DCMAKE_C_COMPILER=icx `
91+ -DCMAKE_CXX_COMPILER=icx `
92+ -DCMAKE_BUILD_TESTS=TRUE `
93+ -DCMAKE_INSTALL_PREFIX="$FTORCH_INSTALL_DIR"
9494 cmake --build build
9595 cmake --install build
9696
9797 - name : Run Python unit tests
98- shell : cmd
98+ shell : pwsh
9999 run : |
100- call ftorch\Scripts\activate
100+ .\ ftorch\Scripts\Activate.ps1
101101 pytest --verbose test/ftorch_utils
102102
103103 - name : Integration tests
104- shell : cmd
104+ shell : pwsh
105105 run : |
106- call ftorch\Scripts\activate
107- set TORCH_PATH=
108- for /f "tokens=2*" %%i in ('pip show torch ^| findstr /R "^Location"') do set TORCH_PATH=%%i
109- set FTORCH_INSTALL_DIR=%TEMP%\ftorch-install
110- set PATH=%FTORCH_INSTALL_DIR%\bin;%PATH%
111- set PATH=%TORCH_PATH%\torch\lib;%PATH%
106+ .\ftorch\Scripts\Activate.ps1
107+ # Find Python executable in venv
108+ $Torch_DIR = (pip show torch | Select-String -Pattern "^Location" | ForEach-Object { $_.Line -replace "^Location:\s*", "" })
109+ # Set install location
110+ $FTORCH_INSTALL_DIR = "$env:TEMP\ftorch-install"
111+ # Add FTorch and PyTorch to the path for the test executables
112+ $env:PATH = "$FTORCH_INSTALL_DIR\bin;$Torch_DIR\torch\lib;$env:PATH"
112113 cd build
113114 ctest --verbose --tests-regex example_tensor
114115 ctest --verbose --tests-regex example_simplenet
@@ -117,25 +118,27 @@ jobs:
117118 ctest --verbose --tests-regex example_autograd
118119
119120 - name : Standalone SimpleNet example
120- shell : cmd
121+ shell : pwsh
121122 run : |
122- call ftorch\Scripts\activate
123- for /f %%i in ('python -c "import sys; print(sys.executable)"') do set PYTHON_EXECUTABLE=%%i
124- set TORCH_PATH=
125- for /f "tokens=2*" %%i in ('pip show torch ^| findstr /R "^Location"') do set TORCH_PATH=%%i
126- set FTORCH_INSTALL_DIR=%TEMP%\ftorch-install
127- set PATH=%FTORCH_INSTALL_DIR%\bin;%PATH%
128- set PATH=%TORCH_PATH%\torch\lib;%PATH%
129- set EXAMPLE_BUILD_DIR=examples\02_SimpleNet\build
130- if not exist %EXAMPLE_BUILD_DIR% mkdir %EXAMPLE_BUILD_DIR%
131- cd %EXAMPLE_BUILD_DIR%
132- cmake .. ^
133- -G "NMake Makefiles" ^
134- -DCMAKE_Fortran_COMPILER=ifx ^
135- -DCMAKE_Fortran_FLAGS="/fpscomp:logicals" ^
136- -DPython_EXECUTABLE=%PYTHON_EXECUTABLE% ^
137- -DCMAKE_BUILD_TYPE=Release ^
138- -DCMAKE_PREFIX_PATH=%FTORCH_INSTALL_DIR%;%TORCH_PATH% ^
123+ .\ftorch\Scripts\Activate.ps1
124+ # Find Python executable in venv
125+ $PYTHON_EXECUTABLE = python -c "import sys; print(sys.executable)"
126+ # Find torch location
127+ $Torch_DIR = (pip show torch | Select-String -Pattern "^Location" | ForEach-Object { $_.Line -replace "^Location:\s*", "" })
128+ # Set install location
129+ $FTORCH_INSTALL_DIR = "$env:TEMP\ftorch-install"
130+ # Add FTorch and PyTorch to the path for the test executables
131+ $env:PATH = "$FTORCH_INSTALL_DIR\bin;$Torch_DIR\torch\lib;$env:PATH"
132+ $EXAMPLE_BUILD_DIR = "examples\02_SimpleNet\build"
133+ if (-not (Test-Path $EXAMPLE_BUILD_DIR)) { New-Item -ItemType Directory -Path $EXAMPLE_BUILD_DIR | Out-Null }
134+ cd $EXAMPLE_BUILD_DIR
135+ cmake .. `
136+ -G "NMake Makefiles" `
137+ -DCMAKE_Fortran_COMPILER=ifx `
138+ -DCMAKE_Fortran_FLAGS="/fpscomp:logicals" `
139+ -DPython_EXECUTABLE="$PYTHON_EXECUTABLE" `
140+ -DCMAKE_BUILD_TYPE=Release `
141+ -DCMAKE_PREFIX_PATH="$FTORCH_INSTALL_DIR;$Torch_DIR\torch" `
139142 -DCMAKE_BUILD_TESTS=TRUE
140143 cmake --build .
141144 ctest -V
0 commit comments