Skip to content

Commit 26d2df0

Browse files
committed
Fix Windows build
* Non-fixed build cpu/mem allocation while in github ci * add psutil python package to ci run * Enable Windows jobs * Merge tags from new retagger char
1 parent e767c2f commit 26d2df0

File tree

7 files changed

+84
-10
lines changed

7 files changed

+84
-10
lines changed

.github/scripts/extract_matrix.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,12 @@ def get_download_steps(self, key: str, version: str) -> str:
128128
filename = download_link.split('/')[-1]
129129

130130
if self.runs_on == "windows-latest":
131-
return (f"""Invoke-WebRequest -Uri {download_link} -OutFile {filename}
131+
return (f"""
132+
Invoke-WebRequest -Uri {download_link} -OutFile {filename}
132133
$dirname = (& tar -tzf {filename} | Select-Object -First 1).Split('/')[0]
133134
tar -xzf {filename}
134-
Add-Content $env:GITHUB_ENV "{key}=$(Resolve-Path $dirname)""")
135+
Add-Content $env:GITHUB_ENV "{key}=$(Resolve-Path $dirname)"
136+
""")
135137

136138
return (f"wget -q {download_link} && "
137139
f"dirname=$(tar -tzf {filename} | head -1 | cut -f1 -d '/') && "
@@ -293,6 +295,7 @@ def get_tagged_jobs(buildspec, target, filter=None):
293295

294296

295297
def main(jsonnet_bin, ci_jsonnet, target, filter=None, indent=False):
298+
296299
result = subprocess.check_output([jsonnet_bin, ci_jsonnet], text=True)
297300
buildspec = json.loads(result)
298301
tagged_jobs = get_tagged_jobs(buildspec, target, filter=filter)

.github/workflows/ci-matrix-gen.yml

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
127127
# Setup mx, buildtools and labsjdk
128128
- name: Get mx, buildtools, and labsjdk
129-
if: ${{ runner.os != 'Windows' && matrix.mx_version }}
129+
if: ${{ matrix.mx_version }}
130130
shell: bash
131131
run: |
132132
git clone https://github.com/graalvm/mx
@@ -190,8 +190,59 @@ jobs:
190190
run: |
191191
${{ matrix.setup_steps }}
192192
193-
- name: Check disk space
194-
run: df -h
193+
- name: Check disk space and memory usage
194+
if: ${{ runner.os == 'macOS' }}
195+
run: |
196+
echo "before purge"
197+
df -h
198+
pagesize=$(sysctl -n hw.pagesize)
199+
vm_stat
200+
vm_stat | awk -v ps=$pagesize '
201+
/Pages free/ {free=$3}
202+
/Pages active/ {active=$3}
203+
/Pages inactive/ {inactive=$3}
204+
/Pages speculative/ {speculative=$3}
205+
/Pages wired/ {wired=$4}
206+
END {
207+
used=(active+inactive+wired+speculative)*ps/1024/1024;
208+
free=free*ps/1024/1024;
209+
printf "Used: %.2f MB\nFree: %.2f MB\n", used, free
210+
}'
211+
ps aux | sort -nrk 4 | head
212+
sudo purge
213+
echo "after purge"
214+
pagesize=$(sysctl -n hw.pagesize)
215+
vm_stat
216+
vm_stat | awk -v ps=$pagesize '
217+
/Pages free/ {free=$3}
218+
/Pages active/ {active=$3}
219+
/Pages inactive/ {inactive=$3}
220+
/Pages speculative/ {speculative=$3}
221+
/Pages wired/ {wired=$4}
222+
END {
223+
used=(active+inactive+wired+speculative)*ps/1024/1024;
224+
free=free*ps/1024/1024;
225+
printf "Used: %.2f MB\nFree: %.2f MB\n", used, free
226+
}'
227+
228+
229+
- name: Free resources on macOS
230+
run: |
231+
echo "Disabling Spotlight indexing..."
232+
sudo mdutil -a -i off
233+
sudo mdutil -a -d
234+
sudo launchctl bootout system /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
235+
sudo pkill -f "mds|mds_stores|mdworker_shared|Spotlight|corespotlightd"
236+
237+
echo "Forcing disk cache to be purged..."
238+
sudo purge
239+
240+
echo "Top processes sorted by memory usage:"
241+
ps -emo pid,pmem,pcpu,comm | head 2>/dev/null
242+
echo ""
243+
memory_pressure
244+
echo ""
245+
if: ${{ runner.os == 'macOS' }}
195246

196247
- name: Run on Unix
197248
working-directory: main
@@ -200,6 +251,7 @@ jobs:
200251
env
201252
${{ matrix.run_steps }}
202253
- name: Run on Windows
254+
working-directory: main
203255
if: ${{ matrix.run_steps && runner.os == 'Windows' }}
204256
shell: cmd
205257
run: |

ci.jsonnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@
244244
"python-unittest-retagger": ut_retagger + platform_spec(no_jobs) + batches(RETAGGER_SPLIT) + platform_spec({
245245
"linux:amd64:jdk-latest" : tier2 + require(GPY_NATIVE_STANDALONE),
246246
"linux:aarch64:jdk-latest" : tier3 + require(GPY_NATIVE_STANDALONE),
247-
"darwin:aarch64:jdk-latest" : weekly + t("20:00:00"),
248-
"windows:amd64:jdk-latest" : weekly + t("20:00:00"),
247+
"darwin:aarch64:jdk-latest" : tier3 + require(GPY_NATIVE_STANDALONE),
248+
"windows:amd64:jdk-latest" : tier3 + require(GPY_NATIVE_STANDALONE),
249249
}),
250250
"python-coverage-jacoco-tagged": cov_jacoco_tagged + batches(COVERAGE_SPLIT) + platform_spec(no_jobs) + platform_spec({
251251
"linux:amd64:jdk21" : weekly + t("20:00:00"),

ci/graal/ci/common.jsonnet

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ local common_json = import "../common.json";
150150
packages+: {
151151
python3: "==3.8.10",
152152
"pip:ninja_syntax": common_json.pip.ninja_syntax,
153+
"pip:psutil": "==7.1.3",
153154
mx: common_json.mx_version,
154155
},
155156
python_version: "3", # To use the correct virtualenv

ci/python-gate.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
},
161161
windows: {
162162
common: {
163-
PATH: "$MAVEN_HOME\\bin;$PATH",
163+
PATH: "$MAVEN_HOME\\bin;$PATH;C:\\hostedtoolcache\\windows\\Python\\3.12.3\\x64\\Scripts;C:\\hostedtoolcache\\windows\\Python\\3.12.3\\x64;C:\\Program Files\\PowerShell\\7;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\windows\\System32\\OpenSSH\\;C:\\Program Files\\dotnet\\;C:\\Program Files\\Microsoft SQL Server\\150\\Tools\\Binn\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Git\\usr\\bin;C:\\hostedtoolcache\\windows\\Ruby\\3.2.3\\x64\\bin;C:\\hostedtoolcache\\windows\\Go\\1.22.2\\x64\\bin;C:\\hostedtoolcache\\windows\\Node\\20.11.1\\x64\\;C:\\npm\\prefix;C:\\Program Files\\Amazon\\AWSCLIV2\\;C:\\Program Files\\Amazon\\SessionManagerPlugin\\bin\\;C:\\Program Files\\LLVM\\bin;C:\\Program Files\\CMake\\bin;C:\\Program Files\\OpenSSL\\bin;C:\\msys64\\usr\\bin;C:\\hostedtoolcache\\windows\\php\\8.2.15\\x64;C:\\Program Files\\Azure DevOps CLI\\bin;C:\\hostedtoolcache\\windows\\R\\4.3.3\\x64\\bin;C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\Enterprise\\Common7\\IDE\\Extensions\\Microsoft\\NuGet;",
164164
},
165165
amd64: {},
166166
aarch64: {},

graalpython/com.oracle.graal.python.test/src/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ def main_merge_tags(args):
13921392
test_file,
13931393
results,
13941394
tag_platform=args.platform,
1395-
untag_failed= os.environ.get("GITHUB_CI") is not None,
1395+
untag_failed=os.environ.get("GITHUB_CI") is not None,
13961396
untag_skipped=True,
13971397
untag_missing=True,
13981398
)

mx.graalpython/mx_graalpython.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import subprocess
3838
import sys
3939
import time
40+
import psutil
4041
from functools import wraps
4142
from pathlib import Path
4243
from textwrap import dedent
@@ -122,6 +123,7 @@ def get_boolean_env(name, default=False):
122123
_COLLECTING_COVERAGE = False
123124

124125
CI = get_boolean_env("CI")
126+
GITHUB_CI = get_boolean_env("GITHUB_CI")
125127
WIN32 = sys.platform == "win32"
126128
BUILD_NATIVE_IMAGE_WITH_ASSERTIONS = get_boolean_env('BUILD_WITH_ASSERTIONS', CI)
127129
BYTECODE_DSL_INTERPRETER = get_boolean_env('BYTECODE_DSL_INTERPRETER', False)
@@ -250,6 +252,22 @@ def _is_overridden_native_image_arg(prefix):
250252
return any(arg.startswith(prefix) for arg in extras)
251253

252254

255+
def github_ci_build_args():
256+
total_mem = psutil.virtual_memory().total / (1024 ** 3)
257+
min_bound = 8
258+
max_mem = 14*1024
259+
min_mem = int(1024 * (total_mem if total_mem < min_bound else total_mem * .9))
260+
os_cpu = os.cpu_count() or int(os.environ.get("NUMBER_OF_PROCESSORS", 1)) or 1
261+
262+
build_mem = min(min_mem, max_mem)
263+
parallelism = os_cpu if os_cpu >= 4 and build_mem >= min_bound*1024 else 1
264+
265+
return ["-Ob",
266+
# f"-J-Xms{build_mem}m",
267+
f"-J-Xms7g",
268+
f"--parallelism={parallelism}"
269+
]
270+
253271
def libpythonvm_build_args():
254272
build_args = []
255273
build_args += bytecode_dsl_build_args()
@@ -832,7 +850,7 @@ def graalpy_standalone_home(standalone_type, enterprise=False, dev=False, build=
832850
mx_args = ['-p', SUITE.dir, *(['--env', env_file] if env_file else [])]
833851

834852
print(f"[DEBUG] GITHUB_CI env: {os.environ.get('GITHUB_CI')}")
835-
if os.environ.get("GITHUB_CI"):
853+
if GITHUB_CI:
836854
print("[DEBUG] Running in GitHub Ci")
837855
mx_args.append("--extra-image-builder-argument=-Ob")
838856
else:

0 commit comments

Comments
 (0)