-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathtest_suite_windows_cpu_intel.yml
More file actions
141 lines (125 loc) · 5.08 KB
/
test_suite_windows_cpu_intel.yml
File metadata and controls
141 lines (125 loc) · 5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# 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 . --group test
- 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: Run Python unit tests
shell: cmd
run: |
call ftorch\Scripts\activate
pytest --verbose test/ftorch_utils
- 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