Skip to content

Commit 88ba04d

Browse files
authored
Update Windows install docs (#578)
* Update Windows install docs * Fix last remaining mismatching pin
1 parent e570619 commit 88ba04d

File tree

2 files changed

+81
-29
lines changed

2 files changed

+81
-29
lines changed

.github/workflows/static_analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5757

5858
- name: Setup Python
59-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
59+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
6060
with:
6161
python-version: '3.13' # Use 3.13 as no PyTorch wheels for 3.14 yet.
6262

pages/installation/systems.md

Lines changed: 80 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: System-Specific Guidance
22
author: Jack Atkinson
3-
date: Last Updated: October 2025
3+
date: Last Updated: April 2026
44

55
## System-Specific Guidance
66

@@ -30,29 +30,99 @@ directory (see the [Intel
3030
docs](https://www.intel.com/content/www/us/en/docs/oneapi/programming-guide/2023-2/use-the-setvars-script-with-windows.html))
3131
for more details.
3232

33-
From `cmd` this can be done with:
33+
From PowerShell this can be done with:
34+
```pwsh
35+
& "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
36+
```
37+
38+
If you are using the legacy `cmd` shell, instead use
3439
```
3540
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
3641
```
3742

3843
FTorch can then be built according to the [regular CMake instructions](|page|/installation/general.html),
3944
with the addition of `-G "NMake Makefiles"`.
4045

41-
So the basic command to build from `cmd` becomes:
42-
```
46+
So the basic command to build (with either PowerShell or `cmd`) becomes:
47+
```pwsh
4348
cmake -G "NMake Makefiles" -DCMAKE_PREFIX_PATH="C:\Users\<path-to-libtorch-download>\libtorch" -DCMAKE_BUILD_TYPE=Release ..
4449
cmake --build .
4550
cmake --install .
4651
```
4752

4853
> Note: _In a Windows environment administrator privileges are required for the default install location._
4954
55+
The following is an example PowerShell script that installs FTorch and runs the integration tests. It assumes you have already installed CMake, git, the Intel
56+
compilers, and Visual Studio.
57+
58+
```pwsh
59+
# Load intel compilers
60+
& "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
61+
62+
# Download ftorch
63+
git clone https://github.com/Cambridge-ICCS/FTorch.git
64+
cd FTorch
65+
66+
# Make virtual environment
67+
python -m venv .ftorch
68+
69+
# Activate the virtual environment
70+
.\ftorch\Scripts\Activate.ps1
5071
51-
The following is an example `cmd` script that installs FTorch and runs the integration tests. It assumes you have already
52-
installed CMake, git, the Intel compilers, and Visual Studio. There are a few
53-
places where output is turned on or off using the `ECHO` command. If you are
54-
experiencing issues with the install then it may be helpful to set `ECHO ON`
55-
throughout.
72+
# Install dependencies (--extra-index-url not required on Windows)
73+
pip install .[examples]
74+
75+
# Find torch location
76+
$Torch_DIR = (pip show torch | Select-String -Pattern "^Location" | ForEach-Object { $_.Line -replace "^Location:\s*", "" })
77+
78+
# Run CMake to generate build scripts
79+
# (Update CMAKE_PREFIX_PATH depending on location of ftorch venv)
80+
cmake `
81+
-Bbuild `
82+
-G "NMake Makefiles" `
83+
-DPython_EXECUTABLE="$PYTHON_EXECUTABLE" `
84+
-DCMAKE_Fortran_FLAGS="/fpscomp:logicals" `
85+
-DCMAKE_CXX_FLAGS="/D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH" `
86+
-DCMAKE_PREFIX_PATH="$Torch_DIR\torch" `
87+
-DCMAKE_BUILD_TYPE=Release `
88+
-DCMAKE_Fortran_COMPILER=ifx `
89+
-DCMAKE_C_COMPILER=icx `
90+
-DCMAKE_CXX_COMPILER=icx `
91+
-DCMAKE_BUILD_TESTS=TRUE `
92+
-DCMAKE_INSTALL_PREFIX="$FTORCH_INSTALL_DIR"
93+
94+
# Build and install FTorch
95+
cmake --build build
96+
cmake --install build
97+
98+
# Add FTorch and PyTorch libs to path
99+
# (Update the first one depending on where you installed FTorch)
100+
$env:PATH = "$FTORCH_INSTALL_DIR\bin;$Torch_DIR\torch\lib;$env:PATH"
101+
102+
# Run integration tests
103+
cd build
104+
ctest --verbose --tests-regex example_tensor
105+
ctest --verbose --tests-regex example_simplenet
106+
ctest --verbose --tests-regex example_resnet
107+
ctest --verbose --tests-regex example_multiio
108+
ctest --verbose --tests-regex example_autograd
109+
```
110+
111+
Here the `/fpscomp:logicals` flag is used to ensure Fortran logicals are
112+
compatible with those used by PyTorch. The
113+
`/D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH` flag is used to suppress warnings
114+
related to mismatched compiler versions between the Intel compilers and
115+
those used to build LibTorch.
116+
117+
We recommend Windows users review the Windows continuous integration workflow
118+
([`.github/workflows/test_suite_windows_cpu_intel.yml`](https://github.com/Cambridge-ICCS/FTorch/blob/main/.github/workflows/test_suite_windows_cpu_intel.yml))
119+
for more information, as this provides another example of how to build and run
120+
FTorch and its integration tests.
121+
122+
If you are using the legacy `cmd` shell then the following script can be used
123+
instead to build and run the tests. There are a few places where output is
124+
turned on or off using the `ECHO` command. If you are experiencing issues
125+
with the install then it may be helpful to set `ECHO ON` throughout.
56126

57127
```cmd
58128
rem Disable output for now
@@ -108,6 +178,7 @@ set PATH=%torch_path%\torch\lib;%PATH%
108178
109179
rem Run integration tests
110180
ECHO ON
181+
cd build
111182
ctest --verbose --tests-regex example1
112183
ctest --verbose --tests-regex example2
113184
ctest --verbose --tests-regex example3
@@ -116,25 +187,6 @@ ctest --verbose --tests-regex example8
116187
if %errorlevel% neq 0 exit /b %errorlevel%
117188
```
118189

119-
Here the `/fpscomp:logicals` flag is used to ensure Fortran logicals are
120-
compatible with those used by PyTorch. The
121-
`/D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH` flag is used to suppress warnings
122-
related to mismatched compiler versions between the Intel compilers and
123-
those used to build LibTorch.
124-
125-
We recommend Windows users review the Windows continuous integration workflow
126-
([`.github/workflows/test_suite_windows_cpu_intel.yml`](https://github.com/Cambridge-ICCS/FTorch/blob/main/.github/workflows/test_suite_windows_cpu_intel.yml))
127-
for more information, as this provides another example of how to build and run
128-
FTorch and its integration tests.
129-
130-
If using powershell the setvars and build commands become:
131-
```
132-
cmd /k '"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" && powershell'
133-
cmake -G "NMake Makefiles" -DCMAKE_PREFIX_PATH="C:\Users\<path-to-libtorch-download>\libtorch" -DCMAKE_BUILD_TYPE=Release ..
134-
cmake --build .
135-
cmake --install .
136-
```
137-
138190

139191
### MacOS (Apple Silicon)
140192

0 commit comments

Comments
 (0)