Skip to content

Commit ea48740

Browse files
committed
Added caching in Azure Pipelines
1 parent a287f7c commit ea48740

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

.azure-pipelines.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,19 @@ jobs:
4343
pool:
4444
vmImage: 'windows-latest'
4545
steps:
46+
- task: Cache@2
47+
inputs:
48+
path: C:\Program Files (x86)\Intel\oneAPI\compiler
49+
key: '"install" | "$(WINDOWS_HPCKIT_URL)" | "$(WINDOWS_CPP_COMPONENTS)" | compiler | scripts/cache_exclude_windows.sh'
50+
cacheHitVar: CACHE_RESTORED
4651
- script: scripts/install_windows.bat $(WINDOWS_HPCKIT_URL) $(WINDOWS_CPP_COMPONENTS)
4752
displayName: install
53+
condition: ne(variables.CACHE_RESTORED, 'true')
4854
- script: scripts/build_windows.bat c++
4955
displayName: build
56+
- bash: scripts/cache_exclude_windows.sh
57+
displayName: exclude unused files from cache
58+
condition: ne(variables.CACHE_RESTORED, 'true')
5059

5160
# Delete the following if you don't want to save install logs
5261
- task: CopyFiles@2
@@ -68,10 +77,19 @@ jobs:
6877
pool:
6978
vmImage: 'windows-latest'
7079
steps:
80+
- task: Cache@2
81+
inputs:
82+
path: C:\Program Files (x86)\Intel\oneAPI\compiler
83+
key: '"install" | "$(WINDOWS_HPCKIT_URL)" | "$(WINDOWS_FORTRAN_COMPONENTS)" | "compiler" | scripts/cache_exclude_windows.sh'
84+
cacheHitVar: CACHE_RESTORED
7185
- script: scripts/install_windows.bat $(WINDOWS_HPCKIT_URL) $(WINDOWS_FORTRAN_COMPONENTS)
7286
displayName: install
87+
condition: ne(variables.CACHE_RESTORED, 'true')
7388
- script: scripts/build_windows.bat fortran
7489
displayName: build
90+
- bash: scripts/cache_exclude_windows.sh
91+
displayName: exclude unused files from cache
92+
condition: ne(variables.CACHE_RESTORED, 'true')
7593

7694
# Delete the following if you don't want to save install logs
7795
- task: CopyFiles@2
@@ -93,10 +111,27 @@ jobs:
93111
pool:
94112
vmImage: 'windows-latest'
95113
steps:
114+
- task: Cache@2 # multiple paths per cache not supported yet. See https://github.com/microsoft/azure-pipelines-agent/pull/2834
115+
inputs:
116+
path: C:\Program Files (x86)\Intel\oneAPI\compiler
117+
key: '"install" | "$(WINDOWS_BASEKIT_URL)" | "$(WINDOWS_DPCPP_COMPONENTS)" | "compiler" | scripts/cache_exclude_windows.sh'
118+
- task: Cache@2
119+
inputs:
120+
path: C:\Program Files (x86)\Intel\oneAPI\tbb
121+
key: '"install" | "$(WINDOWS_BASEKIT_URL)" | "$(WINDOWS_DPCPP_COMPONENTS)" | "tbb" | scripts/cache_exclude_windows.sh'
122+
- task: Cache@2
123+
inputs:
124+
path: C:\Windows\System32\OpenCL.dll
125+
key: '"install" | "$(WINDOWS_BASEKIT_URL)" | "$(WINDOWS_DPCPP_COMPONENTS)" | "opencl" | scripts/cache_exclude_windows.sh'
126+
cacheHitVar: CACHE_RESTORED
96127
- script: scripts/install_windows.bat $(WINDOWS_BASEKIT_URL) $(WINDOWS_DPCPP_COMPONENTS)
97128
displayName: install
129+
condition: ne(variables.CACHE_RESTORED, 'true')
98130
- script: scripts/build_windows.bat dpc++
99131
displayName: build
132+
- bash: scripts/cache_exclude_windows.sh
133+
displayName: exclude unused files from cache
134+
condition: ne(variables.CACHE_RESTORED, 'true')
100135

101136
# Delete the following if you don't want to save install logs
102137
- task: CopyFiles@2
@@ -120,32 +155,69 @@ jobs:
120155
steps:
121156
- script: scripts/setup_apt_repo_linux.sh
122157
displayName: setup apt repo
158+
- script: scripts/apt_depends.sh $LINUX_CPP_COMPONENTS | tee depends.txt
159+
displayName: collect versioned dependencies of apt packages
160+
- task: Cache@2
161+
inputs:
162+
path: /opt/intel/oneapi/compiler
163+
key: '"install" | "$(LINUX_CPP_COMPONENTS)" | depends.txt | "compiler" | scripts/cache_exclude_linux.sh'
164+
cacheHitVar: CACHE_RESTORED
123165
- script: scripts/install_linux_apt.sh $(LINUX_CPP_COMPONENTS)
124166
displayName: install
167+
condition: ne(variables.CACHE_RESTORED, 'true')
125168
- script: scripts/build_linux.sh c++
126169
displayName: build
170+
- bash: scripts/cache_exclude_linux.sh
171+
displayName: exclude unused files from cache
172+
condition: ne(variables.CACHE_RESTORED, 'true')
127173

128174
- job: build_linux_apt_fortran
129175
pool:
130176
vmImage: 'ubuntu-latest'
131177
steps:
132178
- script: scripts/setup_apt_repo_linux.sh
133179
displayName: setup apt repo
180+
- script: scripts/apt_depends.sh $LINUX_CPP_COMPONENTS | tee depends.txt
181+
displayName: collect versioned dependencies of apt packages
182+
- task: Cache@2
183+
inputs:
184+
path: /opt/intel/oneapi/compiler
185+
key: '"install" | "$(LINUX_FORTRAN_COMPONENTS)" | depends.txt | "compiler" | scripts/cache_exclude_linux.sh'
186+
cacheHitVar: CACHE_RESTORED
134187
- script: scripts/install_linux_apt.sh $(LINUX_FORTRAN_COMPONENTS)
135188
displayName: install
189+
condition: ne(variables.CACHE_RESTORED, 'true')
136190
- script: scripts/build_linux.sh fortran
137191
displayName: build
192+
- bash: scripts/cache_exclude_linux.sh
193+
displayName: exclude unused files from cache
194+
condition: ne(variables.CACHE_RESTORED, 'true')
138195

139196
- job: build_linux_apt_dpcpp
140197
pool:
141198
vmImage: 'ubuntu-latest'
142199
steps:
143200
- script: scripts/setup_apt_repo_linux.sh
144201
displayName: setup apt repo
202+
- script: scripts/apt_depends.sh $LINUX_CPP_COMPONENTS | tee depends.txt
203+
displayName: collect versioned dependencies of apt packages
204+
- task: Cache@2
205+
inputs:
206+
path: /opt/intel/oneapi/compiler
207+
key: '"install" | "$(LINUX_DPCPP_COMPONENTS)" | depends.txt | "compiler" | scripts/cache_exclude_linux.sh'
208+
- task: Cache@2
209+
inputs:
210+
path: /opt/intel/oneapi/tbb
211+
key: '"install" | "$(LINUX_DPCPP_COMPONENTS)" | depends.txt | "tbb" | scripts/cache_exclude_linux.sh'
212+
cacheHitVar: CACHE_RESTORED
145213
- script: scripts/install_linux_apt.sh $(LINUX_DPCPP_COMPONENTS)
146214
displayName: install
215+
condition: ne(variables.CACHE_RESTORED, 'true')
147216
- script: scripts/build_linux.sh dpc++
148217
displayName: build
218+
- bash: scripts/cache_exclude_linux.sh
219+
displayName: exclude unused files from cache
220+
condition: ne(variables.CACHE_RESTORED, 'true')
149221

150222
- job: build_linux_container_cpp
151223
pool:
@@ -181,8 +253,18 @@ jobs:
181253
pool:
182254
vmImage: 'macOS-latest'
183255
steps:
256+
- script: |
257+
sudo mkdir -p /opt/intel
258+
sudo chown $USER /opt/intel
259+
displayName: prepare for cache restore
260+
- task: Cache@2
261+
inputs:
262+
path: /opt/intel/oneapi
263+
key: '"install" | "$(MACOS_HPCKIT_URL)" | "$(MACOS_CPP_COMPONENTS)"'
264+
cacheHitVar: CACHE_RESTORED
184265
- script: scripts/install_macos.sh $(MACOS_HPCKIT_URL) $(MACOS_CPP_COMPONENTS)
185266
displayName: install
267+
condition: ne(variables.CACHE_RESTORED, 'true')
186268
- script: scripts/build_macos.sh c++
187269
displayName: build
188270

@@ -205,8 +287,18 @@ jobs:
205287
pool:
206288
vmImage: 'macOS-latest'
207289
steps:
290+
- script: |
291+
sudo mkdir -p /opt/intel
292+
sudo chown $USER /opt/intel
293+
displayName: prepare for cache restore
294+
- task: Cache@2
295+
inputs:
296+
path: /opt/intel/oneapi
297+
key: '"install" | "$(MACOS_HPCKIT_URL)" | "$(MACOS_FORTRAN_COMPONENTS)"'
298+
cacheHitVar: CACHE_RESTORED
208299
- script: scripts/install_macos.sh $(MACOS_HPCKIT_URL) $(MACOS_FORTRAN_COMPONENTS)
209300
displayName: install
301+
condition: ne(variables.CACHE_RESTORED, 'true')
210302
- script: scripts/build_macos.sh fortran
211303
displayName: build
212304

0 commit comments

Comments
 (0)