@@ -14,7 +14,8 @@ date: Last Updated: October 2025
1414If possible we recommend using the [ Windows Subsystem for Linux] ( https://learn.microsoft.com/en-us/windows/wsl/ ) (WSL) to build
1515the library. In this case the build process is the same as for a Linux environment.
1616
17- To build in native Windows using Visual Studio and the Intel Fortran resources the following additional dependencies are required:
17+ Building in Windows itself can be done using Visual Studio and the Intel Fortran
18+ resources. The following additional dependencies are also required:
1819
1920* [ Visual Studio] ( https://visualstudio.microsoft.com/ ) ensuring C++ tools are selected and installed.
2021* [ Intel OneAPI Basetoolkit] ( https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html )
@@ -48,63 +49,83 @@ cmake --install .
4849
4950
5051The following is an example ` cmd ` script that installs FTorch and runs the integration tests. It assumes you have already
51- installed CMake, git, the Intel compilers, and Visual Studio.
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.
5256
5357``` cmd
54- rem disable output for now
55- ECHO ON
58+ rem Disable output for now
59+ ECHO OFF
5660
57- rem load intel compilers
61+ rem Load intel compilers
5862call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
5963
60- rem download ftorch
64+ rem Download ftorch
6165git clone https://github.com/Cambridge-ICCS/FTorch.git
6266cd FTorch
6367
64- rem make venv
68+ rem Make virtual environment
6569python -m venv .ftorch
6670
67- rem activate the environment
71+ rem Activate the virtual environment
6872call .ftorch\Scripts\activate
6973
70- rem install torch
74+ rem Install torch
7175pip install torch torchvision torchaudio
7276
73- rem enable output
77+ rem Enable output
7478ECHO ON
7579
76- rem run cmake to generate build scripts
77- rem (update CMAKE_PREFIX_PATH depending on location of ftorch venv)
80+ rem Find Torch location
81+ for /f "tokens=2*" %%i in ('pip show torch ^| findstr /R "^Location"') do set torch_path=%%i
82+
83+ rem Run CMake to generate build scripts
84+ rem (Update CMAKE_PREFIX_PATH depending on location of ftorch venv)
7885cmake -Bbuild -G "NMake Makefiles" -DCMAKE_Fortran_FLAGS="/fpscomp:logicals" ^
79- -DCMAKE_PREFIX_PATH="C:\Users\Quickemu\Downloads\FTorch\.ftorch\Lib\site-packages " ^
86+ -DCMAKE_PREFIX_PATH="%torch_path% " ^
8087 -DCMAKE_BUILD_TYPE=Release ^
8188 -DCMAKE_BUILD_TESTS=True ^
82- -DCMAKE_Fortran_COMPILER=ifx -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx
89+ -DCMAKE_Fortran_COMPILER=ifx ^
90+ -DCMAKE_C_COMPILER=icx ^
91+ -DCMAKE_CXX_COMPILER=icx
92+ -DCMAKE_Fortran_FLAGS="/fpscomp:logicals" ^
93+ -DCMAKE_CXX_FLAGS="/D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH"
8394
84- rem build and install ftorch
95+ rem Build and install FTorch
8596cmake --build build
8697cmake --install build
8798
88- rem quit if this raises an error
99+ rem Quit if this raises an error
89100if %errorlevel% neq 0 exit /b %errorlevel%
90101
91102ECHO OFF
92- rem add ftorch and pytorch libs to path
93- rem (update these depending on where you installed ftorch and where you created the venv)
94- set PATH=C:\Users\Quickemu\Downloads\FTorch\.ftorch\Lib\site-packages;%PATH%
103+ rem Add FTorch and PyTorch libs to path
104+ rem (Update the first one depending on where you installed FTorch)
95105set PATH=C:\Program Files (x86)\FTorch\bin;%PATH%
96- set PATH=C:\Users\Quickemu\Downloads\FTorch\.ftorch\Lib\site-packages\torch\lib;%PATH%
106+ set PATH=%torch_path%;%PATH%
107+ set PATH=%torch_path%\torch\lib;%PATH%
97108
98- cd ..
99-
100- rem run integration tests
109+ rem Run integration tests
101110ECHO ON
102- run_integration_tests.bat
111+ ctest --verbose --tests-regex example1
112+ ctest --verbose --tests-regex example2
113+ ctest --verbose --tests-regex example3
114+ ctest --verbose --tests-regex example4
115+ ctest --verbose --tests-regex example8
103116if %errorlevel% neq 0 exit /b %errorlevel%
104117```
105118
106- We recommend Windows users review the Windows CI workflow (` .github/workflows/test_suite_windows.yml ` ) for more
107- information, as this provides another example of how to build and run FTorch and its integration tests.
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.
108129
109130If using powershell the setvars and build commands become:
110131```
0 commit comments