Skip to content

Commit 352fd1c

Browse files
authored
Added GitLab CI caching, fixed Circle CI caching on Windows (#29)
2 parents 1978992 + 3ce7dd0 commit 352fd1c

File tree

3 files changed

+170
-18
lines changed

3 files changed

+170
-18
lines changed

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
- run:
7272
command: |
7373
mkdir InstallLogs
74-
cp extract* bootstrapper* installer* InstallLogs
74+
cp extract* bootstrapper* installer* InstallLogs || :
7575
when: always
7676
- store_artifacts:
7777
path: InstallLogs
@@ -105,7 +105,7 @@ jobs:
105105
- run:
106106
command: |
107107
mkdir InstallLogs
108-
cp extract* bootstrapper* installer* InstallLogs
108+
cp extract* bootstrapper* installer* InstallLogs || :
109109
when: always
110110
- store_artifacts:
111111
path: InstallLogs
@@ -118,7 +118,7 @@ jobs:
118118
- checkout
119119
- restore_cache:
120120
keys:
121-
- install-<< pipeline.parameters.WINDOWS_BASEKIT_URL >>-<< pipeline.parameters.WINDOWS_DPCPP_COMPONENTS >>-compiler-{{ checksum "scripts/cache_exclude_windows.sh" }}
121+
- install-<< pipeline.parameters.WINDOWS_BASEKIT_URL >>-<< pipeline.parameters.WINDOWS_DPCPP_COMPONENTS >>-compiler-tbb-opencl-{{ checksum "scripts/cache_exclude_windows.sh" }}
122122
- run:
123123
name: install
124124
command: |
@@ -131,7 +131,7 @@ jobs:
131131
name: exclude unused files from cache
132132
command: scripts/cache_exclude_windows.sh
133133
- save_cache:
134-
key: install-<< pipeline.parameters.WINDOWS_BASEKIT_URL >>-<< pipeline.parameters.WINDOWS_DPCPP_COMPONENTS >>-compiler-{{ checksum "scripts/cache_exclude_windows.sh" }}
134+
key: install-<< pipeline.parameters.WINDOWS_BASEKIT_URL >>-<< pipeline.parameters.WINDOWS_DPCPP_COMPONENTS >>-compiler-tbb-opencl-{{ checksum "scripts/cache_exclude_windows.sh" }}
135135
paths:
136136
- C:\Program Files (x86)\Intel\oneAPI\compiler
137137
- C:\Program Files (x86)\Intel\oneAPI\tbb
@@ -141,7 +141,7 @@ jobs:
141141
- run:
142142
command: |
143143
mkdir InstallLogs
144-
cp extract* bootstrapper* installer* InstallLogs
144+
cp extract* bootstrapper* installer* InstallLogs || :
145145
when: always
146146
- store_artifacts:
147147
path: InstallLogs

.gitlab-ci.yml

Lines changed: 153 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ variables:
1717
LINUX_DPCPP_COMPONENTS: intel-oneapi-dpcpp-cpp-compiler
1818
MACOS_CPP_COMPONENTS: intel.oneapi.mac.cpp-compiler
1919
MACOS_FORTRAN_COMPONENTS: intel.oneapi.mac.ifort-compiler
20+
RELEASE: 2021.1-beta10
2021

2122
.shared_windows_runners:
2223
tags:
@@ -28,9 +29,32 @@ build_windows_cpp:
2829
extends:
2930
- .shared_windows_runners
3031
stage: build
32+
cache:
33+
key:
34+
prefix: install-${RELEASE}-${WINDOWS_CPP_COMPONENTS}-compiler
35+
files:
36+
- scripts/cache_exclude_windows.ps1
37+
paths:
38+
- cache # GitLab CI cannot cache files outside build directory
39+
before_script: # Restoring install directory from 'cache' folder
40+
- |
41+
if(Test-Path cache) {
42+
New-Item -ItemType "directory" -Path "C:\Program Files (x86)\Intel\oneAPI" -Force
43+
Move-Item -Path cache\compiler -Destination "C:\Program Files (x86)\Intel\oneAPI"
44+
} else {
45+
scripts/install_windows.bat $WINDOWS_HPCKIT_URL $WINDOWS_CPP_COMPONENTS
46+
}
3147
script:
32-
- scripts/install_windows.bat $WINDOWS_HPCKIT_URL $WINDOWS_CPP_COMPONENTS
3348
- scripts/build_windows.bat c++ 2019_build_tools
49+
after_script: # Moving install directory into 'cache' folder inside build directory
50+
- |
51+
if(!(Test-Path cache)) {
52+
scripts/cache_exclude_windows.ps1
53+
New-Item -ItemType "directory" -Path "cache"
54+
}
55+
# "push-pull" is the default cache policy, so cache folder needs to be setup in every run.
56+
# consider setting "policy: pull" once the cache is warm.
57+
Move-Item -Path "C:\Program Files (x86)\Intel\oneAPI\compiler" -Destination "cache"
3458
3559
# Delete the following if you don't want to save install logs
3660
artifacts:
@@ -45,9 +69,30 @@ build_windows_fortran:
4569
extends:
4670
- .shared_windows_runners
4771
stage: build
72+
cache:
73+
key:
74+
prefix: install-${RELEASE}-${WINDOWS_FORTRAN_COMPONENTS}-compiler
75+
files:
76+
- scripts/cache_exclude_windows.ps1
77+
paths:
78+
- cache
79+
before_script:
80+
- |
81+
if(Test-Path cache) {
82+
New-Item -ItemType "directory" -Path "C:\Program Files (x86)\Intel\oneAPI" -Force
83+
Move-Item -Path cache\compiler -Destination "C:\Program Files (x86)\Intel\oneAPI"
84+
} else {
85+
scripts/install_windows.bat $WINDOWS_HPCKIT_URL $WINDOWS_FORTRAN_COMPONENTS
86+
}
4887
script:
49-
- scripts/install_windows.bat $WINDOWS_HPCKIT_URL $WINDOWS_FORTRAN_COMPONENTS
5088
- scripts/build_windows.bat fortran 2019_build_tools
89+
after_script:
90+
- |
91+
if(!(Test-Path cache)) {
92+
scripts/cache_exclude_windows.ps1
93+
New-Item -ItemType "directory" -Path "cache"
94+
}
95+
Move-Item -Path "C:\Program Files (x86)\Intel\oneAPI\compiler" -Destination "cache"
5196
5297
# Delete the following if you don't want to save install logs
5398
artifacts:
@@ -62,10 +107,34 @@ build_windows_dpcpp:
62107
extends:
63108
- .shared_windows_runners
64109
stage: build
110+
cache:
111+
key:
112+
prefix: install-${RELEASE}-${WINDOWS_DPCPP_COMPONENTS}-compiler-tbb-opencl
113+
files:
114+
- scripts/cache_exclude_windows.ps1
115+
paths:
116+
- cache
117+
before_script:
118+
- |
119+
if(Test-Path cache) {
120+
New-Item -ItemType "directory" -Path "C:\Program Files (x86)\Intel\oneAPI" -Force
121+
Move-Item -Path cache\compiler -Destination "C:\Program Files (x86)\Intel\oneAPI"
122+
Move-Item -Path cache\tbb -Destination "C:\Program Files (x86)\Intel\oneAPI"
123+
Move-Item -Path cache\OpenCL.dll -Destination "C:\Windows\System32"
124+
} else {
125+
scripts/install_windows.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_COMPONENTS
126+
}
65127
script:
66-
- scripts/install_windows.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_COMPONENTS
67128
- scripts/build_windows.bat dpc++ 2019_build_tools
68-
129+
after_script:
130+
- |
131+
if(!(Test-Path cache)) {
132+
scripts/cache_exclude_windows.ps1
133+
New-Item -ItemType "directory" -Path "cache"
134+
}
135+
Move-Item -Path "C:\Program Files (x86)\Intel\oneAPI\compiler" -Destination "cache"
136+
Move-Item -Path "C:\Program Files (x86)\Intel\oneAPI\tbb" -Destination "cache"
137+
Move-Item -Path "C:\Windows\System32\OpenCL.dll" -Destination "cache"
69138
# Delete the following if you don't want to save install logs
70139
artifacts:
71140
when: always
@@ -78,26 +147,97 @@ build_windows_dpcpp:
78147
build_linux_apt_cpp:
79148
image: ubuntu:latest
80149
stage: build
81-
script:
150+
cache:
151+
key: # GitLab CI doesn't support steps before cache is restored, i.e. only static cache keys are supported.
152+
prefix: install-${RELEASE}-${LINUX_CPP_COMPONENTS}-compiler
153+
files:
154+
- scripts/cache_exclude_linux_no_sudo.sh
155+
paths:
156+
- cache
157+
before_script:
82158
- . scripts/install_prerequisites_linux_apt_no_sudo.sh
83-
- . scripts/setup_apt_repo_linux_no_sudo.sh
84-
- . scripts/install_linux_apt_no_sudo.sh $LINUX_CPP_COMPONENTS
159+
- |
160+
if [[ -d cache ]]
161+
then
162+
mkdir -p /opt/intel/oneapi
163+
mv cache/compiler /opt/intel/oneapi/
164+
else
165+
. scripts/setup_apt_repo_linux_no_sudo.sh
166+
. scripts/install_linux_apt_no_sudo.sh $LINUX_CPP_COMPONENTS
167+
fi
168+
script:
85169
- scripts/build_linux.sh c++
170+
after_script:
171+
- |
172+
if [[ ! -d cache ]]
173+
then
174+
. scripts/cache_exclude_linux_no_sudo.sh
175+
mkdir cache
176+
fi
177+
mv /opt/intel/oneapi/compiler cache
86178
87179
build_linux_apt_fortran:
88180
image: ubuntu:latest
89181
stage: build
90-
script:
182+
cache:
183+
key:
184+
prefix: install-${RELEASE}-${LINUX_FORTRAN_COMPONENTS}-compiler
185+
files:
186+
- scripts/cache_exclude_linux_no_sudo.sh
187+
paths:
188+
- cache
189+
before_script:
91190
- . scripts/install_prerequisites_linux_apt_no_sudo.sh
92-
- . scripts/setup_apt_repo_linux_no_sudo.sh
93-
- . scripts/install_linux_apt_no_sudo.sh $LINUX_FORTRAN_COMPONENTS
191+
- |
192+
if [[ -d cache ]]
193+
then
194+
mkdir -p /opt/intel/oneapi
195+
mv cache/compiler /opt/intel/oneapi/
196+
else
197+
. scripts/setup_apt_repo_linux_no_sudo.sh
198+
. scripts/install_linux_apt_no_sudo.sh $LINUX_FORTRAN_COMPONENTS
199+
fi
200+
script:
94201
- scripts/build_linux.sh fortran
202+
after_script:
203+
- |
204+
if [[ ! -d cache ]]
205+
then
206+
. scripts/cache_exclude_linux_no_sudo.sh
207+
mkdir cache
208+
fi
209+
mv /opt/intel/oneapi/compiler cache
95210
96211
build_linux_apt_dpcpp:
97212
image: ubuntu:latest
98213
stage: build
99-
script:
214+
cache:
215+
key:
216+
prefix: install-${RELEASE}-${LINUX_DPCPP_COMPONENTS}-compiler-tbb
217+
files:
218+
- scripts/cache_exclude_linux_no_sudo.sh
219+
paths:
220+
- cache
221+
before_script:
100222
- . scripts/install_prerequisites_linux_apt_no_sudo.sh
101-
- . scripts/setup_apt_repo_linux_no_sudo.sh
102-
- . scripts/install_linux_apt_no_sudo.sh $LINUX_DPCPP_COMPONENTS
223+
- |
224+
if [[ -d cache ]]
225+
then
226+
mkdir -p /opt/intel/oneapi
227+
mv cache/compiler /opt/intel/oneapi/
228+
mv cache/tbb /opt/intel/oneapi/
229+
else
230+
. scripts/setup_apt_repo_linux_no_sudo.sh
231+
. scripts/install_linux_apt_no_sudo.sh $LINUX_DPCPP_COMPONENTS
232+
fi
233+
script:
103234
- scripts/build_linux.sh dpc++
235+
after_script:
236+
- |
237+
if [[ ! -d cache ]]
238+
then
239+
. scripts/cache_exclude_linux_no_sudo.sh
240+
mkdir cache
241+
fi
242+
mv /opt/intel/oneapi/compiler cache
243+
mv /opt/intel/oneapi/tbb cache

scripts/cache_exclude_windows.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SPDX-FileCopyrightText: 2020 Intel Corporation
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
Remove-Item "C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta10\windows\compiler\lib\ia32_win" -Force -Recurse -ErrorAction SilentlyContinue
6+
Remove-Item "C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta10\windows\bin\intel64_ia32" -Force -Recurse -ErrorAction SilentlyContinue
7+
Remove-Item "C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta10\windows\lib\emu" -Force -Recurse -ErrorAction SilentlyContinue
8+
Remove-Item "C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta10\windows\lib\oclfpga" -Force -Recurse -ErrorAction SilentlyContinue
9+
Remove-Item "C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta10\windows\lib\ocloc" -Force -Recurse -ErrorAction SilentlyContinue
10+
Remove-Item "C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta10\windows\lib\x86" -Force -Recurse -ErrorAction SilentlyContinue
11+
12+
exit 0

0 commit comments

Comments
 (0)