From fb674f7402e22c1801192f24761449d1cd05e083 Mon Sep 17 00:00:00 2001 From: Arjun Date: Thu, 5 Nov 2026 04:28:39 +0530 Subject: [PATCH 01/19] Fixes for phoronix runs --- script/get-generic-sys-util/meta.yaml | 5 +++++ script/get-phoronix-test-suite/run.sh | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/script/get-generic-sys-util/meta.yaml b/script/get-generic-sys-util/meta.yaml index 34d786258..db52700af 100644 --- a/script/get-generic-sys-util/meta.yaml +++ b/script/get-generic-sys-util/meta.yaml @@ -562,6 +562,11 @@ variations: libfftw3-dev: env: MLC_SYS_UTIL_NAME: libfftw3-dev + MLC_SYS_UTIL_VERSION_CMD: dpkg -s libfftw3-dev | grep 'Version' + MLC_SYS_UTIL_VERSION_RE: ([0-9]+(\.[0-9]+)+) + MLC_TMP_VERSION_DETECT_GROUP_NUMBER: 1 + new_env_keys: + - MLC_LIBFFTW3_DEV_VERSION state: libfftw3-dev: apt: libfftw3-dev diff --git a/script/get-phoronix-test-suite/run.sh b/script/get-phoronix-test-suite/run.sh index 48b94fa2c..3c7217bb7 100755 --- a/script/get-phoronix-test-suite/run.sh +++ b/script/get-phoronix-test-suite/run.sh @@ -51,6 +51,21 @@ if [ "${MLC_PHORONIX_DO_PORTABLE_INSTALL}" == "yes" ]; then [ -n "${src}" ] || { echo "ERROR: phoronix source dir missing"; exit 1; } cp -a "${src}" "${PREFIX}/phoronix-test-suite" + # Reuse the node's php when it already has the XML/mbstring extensions PTS needs. + if command -v php >/dev/null 2>&1 && php -m 2>/dev/null | grep -qx dom && php -m 2>/dev/null | grep -qx mbstring; then + echo "Using system php: $(command -v php)" + cat > "${PREFIX}/bin/phoronix-test-suite" </dev/null 2>&1 \ && echo "Portable install OK: ${PREFIX}/bin/phoronix-test-suite" \ From cbac96c695509567d96cba74a1492b5187ac30d4 Mon Sep 17 00:00:00 2001 From: Arjun Date: Thu, 5 Nov 2026 06:39:51 +0530 Subject: [PATCH 02/19] Fixes for phoronix apptainer run --- script/benchmark-program-phoronix/run.sh | 2 ++ script/build-apptainer-image/customize.py | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/script/benchmark-program-phoronix/run.sh b/script/benchmark-program-phoronix/run.sh index d4e9599ff..e3fd6bb88 100644 --- a/script/benchmark-program-phoronix/run.sh +++ b/script/benchmark-program-phoronix/run.sh @@ -49,6 +49,8 @@ mkdir -p "${RESULTS_DIR}" # prompts and makes `batch-benchmark` fully unattended). Only written when # absent so an existing user configuration is respected. ---------------------- PTS_USER_DIR="${HOME}/.phoronix-test-suite" +# As root (e.g. apptainer --fakeroot) PTS otherwise uses /var/lib/phoronix-test-suite and ignores this config. +export PTS_USER_PATH_OVERRIDE="${PTS_USER_DIR}/" if [ ! -f "${PTS_USER_DIR}/user-config.xml" ]; then mkdir -p "${PTS_USER_DIR}" cat > "${PTS_USER_DIR}/user-config.xml" <<'XML_EOF' diff --git a/script/build-apptainer-image/customize.py b/script/build-apptainer-image/customize.py index 04e89c5d8..8766178ba 100644 --- a/script/build-apptainer-image/customize.py +++ b/script/build-apptainer-image/customize.py @@ -77,6 +77,14 @@ def preprocess(i): if tmpdir: build_opts += f' --tmpdir {tmpdir}' + # Run-time binds (e.g. /pa_nvme compilers) are also needed by the fake run in %post. + build_binds = env.get('MLC_APPTAINER_BIND_MOUNTS', []) + if isinstance(build_binds, str): + build_binds = [build_binds] + for mount in build_binds: + if mount and os.path.exists(mount.split(':', 1)[0]): + build_opts += f' --bind {mount}' + cmd_prefix = "sudo " if is_true( env.get( "MLC_APPTAINER_BUILD_WITH_SUDO", From 5a03d2b4ec85d1ad53ae838485aa7c0e9422f5d0 Mon Sep 17 00:00:00 2001 From: Arjun Date: Thu, 5 Nov 2026 06:47:28 +0530 Subject: [PATCH 03/19] Support apptainer bind in build-apptainerfile --- script/build-apptainerfile/customize.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/script/build-apptainerfile/customize.py b/script/build-apptainerfile/customize.py index 2700472ea..06d430ef8 100644 --- a/script/build-apptainerfile/customize.py +++ b/script/build-apptainerfile/customize.py @@ -281,10 +281,20 @@ def preprocess(i): f.write(f" {post_cmd}\n") f.write("\n") + # Bind destinations must exist in the rootfs for build-time binds + # (apptainer build --bind) used by the fake run in %post. + bind_mounts = env.get('MLC_APPTAINER_BIND_MOUNTS', []) + if isinstance(bind_mounts, str): + bind_mounts = [bind_mounts] + bind_dests = [m.split(':')[1] if ':' in m else m for m in bind_mounts if m] + bind_setup = ''.join( + f" mkdir -p ${{APPTAINER_ROOTFS}}{d}\n" for d in bind_dests) + # Copy section for local repo (use %setup with tar to handle symlinks # gracefully) if use_host_repos: f.write("%setup\n") + f.write(bind_setup) f.write(" mkdir -p ${APPTAINER_ROOTFS}/opt/mlc_host_repos\n") for parent_dir, repo_name in host_repos_to_copy: f.write( @@ -294,11 +304,14 @@ def preprocess(i): elif use_copy_repo: repo_name = os.path.basename(mlc_repo_path) f.write("%setup\n") + f.write(bind_setup) f.write(f" mkdir -p ${{APPTAINER_ROOTFS}}/opt/mlc_repo\n") f.write( f" tar -C {mlc_repo_path}/.. --exclude=repos.json --exclude='index_*.json' --exclude=local --exclude=modified_times.json --exclude='*.sif' -cf - {repo_name} | tar -xf - -C ${{APPTAINER_ROOTFS}}/opt/mlc_repo/\n") f.write(f" chmod -R 777 ${{APPTAINER_ROOTFS}}/opt/mlc_repo\n") f.write("\n") + elif bind_setup: + f.write("%setup\n" + bind_setup + "\n") # Runscript f.write("%runscript\n") From bd11bc3b901b83344248ae68db505607969b4328 Mon Sep 17 00:00:00 2001 From: Arjun Date: Thu, 5 Nov 2026 16:01:50 +0530 Subject: [PATCH 04/19] Fixes for phoronix apptainer run --- script/benchmark-program-phoronix/run.sh | 23 +++++++++++---------- script/run-apptainer-container/customize.py | 20 +++++++++--------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/script/benchmark-program-phoronix/run.sh b/script/benchmark-program-phoronix/run.sh index e3fd6bb88..3b20daa0f 100644 --- a/script/benchmark-program-phoronix/run.sh +++ b/script/benchmark-program-phoronix/run.sh @@ -45,13 +45,14 @@ RESULTS_DIR=${MLC_PHORONIX_RESULTS_DIR:-.} RESULT_ID=${MLC_PHORONIX_RESULT_IDENTIFIER:-mlc-benchmark} mkdir -p "${RESULTS_DIR}" -# --- Seed a non-interactive config (skips the first-run EULA / anonymous-usage -# prompts and makes `batch-benchmark` fully unattended). Only written when -# absent so an existing user configuration is respected. ---------------------- -PTS_USER_DIR="${HOME}/.phoronix-test-suite" -# As root (e.g. apptainer --fakeroot) PTS otherwise uses /var/lib/phoronix-test-suite and ignores this config. +# --- Non-interactive PTS config in a per-run user dir (a shared $HOME would let +# concurrent runs, or a default config PTS wrote earlier, disable batch mode). -- +PTS_USER_DIR="$(cd "${RESULTS_DIR}" && pwd)/pts-user" +# Also covers root (e.g. apptainer --fakeroot), where PTS would use /var/lib/phoronix-test-suite. export PTS_USER_PATH_OVERRIDE="${PTS_USER_DIR}/" -if [ ! -f "${PTS_USER_DIR}/user-config.xml" ]; then +# Never prompt for (or try to apt-install) missing test dependencies. +export NO_EXTERNAL_DEPENDENCIES=1 +{ mkdir -p "${PTS_USER_DIR}" cat > "${PTS_USER_DIR}/user-config.xml" <<'XML_EOF' @@ -102,7 +103,7 @@ if [ ! -f "${PTS_USER_DIR}/user-config.xml" ]; then XML_EOF echo "Wrote non-interactive PTS config: ${PTS_USER_DIR}/user-config.xml" -fi +} # Pre-answer the result save prompts (used when PromptSaveName etc. are FALSE). export TEST_RESULTS_NAME="${RESULT_ID}" @@ -136,7 +137,7 @@ echo "***********************************************************************" # Install the test (compiles from source using CC/CXX when applicable). echo "" echo "Installing test: ${MLC_PHORONIX_TEST}" -"${PTS}" install "${MLC_PHORONIX_TEST}" +"${PTS}" install "${MLC_PHORONIX_TEST}" &1 | tee "${OUTPUT_FILE}" + "${PTS}" batch-benchmark ${MLC_PHORONIX_EXTRA_ARGS} "${MLC_PHORONIX_TEST}" &1 | tee "${OUTPUT_FILE}" else - "${PTS}" benchmark ${MLC_PHORONIX_EXTRA_ARGS} "${MLC_PHORONIX_TEST}" 2>&1 | tee "${OUTPUT_FILE}" + "${PTS}" benchmark ${MLC_PHORONIX_EXTRA_ARGS} "${MLC_PHORONIX_TEST}" &1 | tee "${OUTPUT_FILE}" fi exitstatus=${PIPESTATUS[0]} @@ -161,7 +162,7 @@ fi # Export results. PTS sanitizes the save identifier (strips dots/spaces), # so discover the actual saved result directory (most recently modified) rather # than assuming it equals RESULT_ID. -pts_results_root="${HOME}/.phoronix-test-suite/test-results" +pts_results_root="${PTS_USER_DIR}/test-results" saved_name="" if [ -d "${pts_results_root}" ]; then saved_name=$(ls -1t "${pts_results_root}" 2>/dev/null | head -1) diff --git a/script/run-apptainer-container/customize.py b/script/run-apptainer-container/customize.py index 4db6eb294..d258652ef 100644 --- a/script/run-apptainer-container/customize.py +++ b/script/run-apptainer-container/customize.py @@ -103,17 +103,17 @@ def postprocess(i): if is_true(env.get('MLC_APPTAINER_FAKEROOT', '')): run_opts += ' --fakeroot' + + # Repos baked into the image must be used with or without fakeroot; + # --cleanenv drops MLC_REPOS, which would fall back to the bound $HOME/MLC. + if env.get('MLC_REPO_PATH', ''): + repo_name = os.path.basename(env['MLC_REPO_PATH']) + run_opts += f' --env MLC_REPOS=/opt/mlc_repo/{repo_name}' + elif is_true(env.get('MLC_APPTAINER_HOST_MLC_REPOS', '')): + run_opts += ' --env MLC_REPOS=/opt/mlc_host_repos' + elif is_true(env.get('MLC_APPTAINER_FAKEROOT', '')): # With fakeroot, HOME becomes /root inside the container. - # Use /opt/mlc_repo if repos were pre-copied via --apptainer_mlc_repo_path, - # else fall back to /tmp/mlc-repos. - if env.get('MLC_REPO_PATH', ''): - repo_name = os.path.basename(env['MLC_REPO_PATH']) - run_opts += f' --env MLC_REPOS=/opt/mlc_repo/{repo_name}' - elif is_true(env.get('MLC_APPTAINER_HOST_MLC_REPOS', '')): - # Host repos were registered under /opt/mlc_host_repos at build time. - run_opts += ' --env MLC_REPOS=/opt/mlc_host_repos' - else: - run_opts += ' --env MLC_REPOS=/tmp/mlc-repos' + run_opts += ' --env MLC_REPOS=/tmp/mlc-repos' # Home directory if env.get('MLC_APPTAINER_HOME', '') != '': From 99b56c18eab034773eadf0479f2f8315d8209fb7 Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Thu, 5 Nov 2026 16:59:16 +0530 Subject: [PATCH 05/19] Fixes for apptainer --- script/README.md | 2 +- script/build-apptainerfile/customize.py | 47 +++++++++++++++++-------- script/build-apptainerfile/meta.yaml | 1 + 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/script/README.md b/script/README.md index e1cbfa36c..9d6c7ab87 100644 --- a/script/README.md +++ b/script/README.md @@ -1,6 +1,6 @@ # MLCommons Automation Scripts -*Last updated: 2026-10-31 02:52:31* +*Last updated: 2026-11-05 16:59:17* This directory contains automation scripts for MLPerf benchmarks, AI/ML workflows, and development operations. diff --git a/script/build-apptainerfile/customize.py b/script/build-apptainerfile/customize.py index 06d430ef8..f7b2444a2 100644 --- a/script/build-apptainerfile/customize.py +++ b/script/build-apptainerfile/customize.py @@ -3,6 +3,7 @@ import json import re import shutil +import shlex from utils import * @@ -281,20 +282,23 @@ def preprocess(i): f.write(f" {post_cmd}\n") f.write("\n") - # Bind destinations must exist in the rootfs for build-time binds - # (apptainer build --bind) used by the fake run in %post. - bind_mounts = env.get('MLC_APPTAINER_BIND_MOUNTS', []) - if isinstance(bind_mounts, str): - bind_mounts = [bind_mounts] - bind_dests = [m.split(':')[1] if ':' in m else m for m in bind_mounts if m] - bind_setup = ''.join( - f" mkdir -p ${{APPTAINER_ROOTFS}}{d}\n" for d in bind_dests) + # Bind destinations must exist in the rootfs: apptainer cannot create + # them when binds are applied to the build-time fake run. + bind_dests = get_bind_destinations( + env.get('MLC_APPTAINER_BIND_MOUNTS', [])) # Copy section for local repo (use %setup with tar to handle symlinks # gracefully) - if use_host_repos: + if bind_dests: f.write("%setup\n") - f.write(bind_setup) + for dest in bind_dests: + f.write( + f" mkdir -p \"${{APPTAINER_ROOTFS}}\"{shlex.quote(dest)}\n") + if not (use_host_repos or use_copy_repo): + f.write("\n") + if use_host_repos: + if not bind_dests: + f.write("%setup\n") f.write(" mkdir -p ${APPTAINER_ROOTFS}/opt/mlc_host_repos\n") for parent_dir, repo_name in host_repos_to_copy: f.write( @@ -303,15 +307,13 @@ def preprocess(i): f.write("\n") elif use_copy_repo: repo_name = os.path.basename(mlc_repo_path) - f.write("%setup\n") - f.write(bind_setup) + if not bind_dests: + f.write("%setup\n") f.write(f" mkdir -p ${{APPTAINER_ROOTFS}}/opt/mlc_repo\n") f.write( f" tar -C {mlc_repo_path}/.. --exclude=repos.json --exclude='index_*.json' --exclude=local --exclude=modified_times.json --exclude='*.sif' -cf - {repo_name} | tar -xf - -C ${{APPTAINER_ROOTFS}}/opt/mlc_repo/\n") f.write(f" chmod -R 777 ${{APPTAINER_ROOTFS}}/opt/mlc_repo\n") f.write("\n") - elif bind_setup: - f.write("%setup\n" + bind_setup + "\n") # Runscript f.write("%runscript\n") @@ -331,6 +333,23 @@ def preprocess(i): return {'return': 0} +def get_bind_destinations(bind_mounts): + """Container-side paths of apptainer bind specs (src[:dest[:opts]]).""" + if isinstance(bind_mounts, str): + bind_mounts = [bind_mounts] + dests = [] + for entry in bind_mounts or []: + for spec in str(entry).split(','): + spec = spec.strip() + if not spec: + continue + parts = spec.split(':') + dest = parts[1] if len(parts) > 1 and parts[1] else parts[0] + if dest.startswith('/') and dest not in dests: + dests.append(dest) + return dests + + def get_value(env, config, key, env_key=None): if not env_key: env_key = key diff --git a/script/build-apptainerfile/meta.yaml b/script/build-apptainerfile/meta.yaml index 3e4c6245b..0c172f714 100644 --- a/script/build-apptainerfile/meta.yaml +++ b/script/build-apptainerfile/meta.yaml @@ -25,6 +25,7 @@ new_env_keys: # Input mapping input_mapping: base_image: MLC_APPTAINER_IMAGE_BASE + bind: MLC_APPTAINER_BIND_MOUNTS build: MLC_BUILD_APPTAINER_IMAGE docker_os: MLC_APPTAINER_OS docker_os_version: MLC_APPTAINER_OS_VERSION From f4154f1f04566e5c51cd7a1b702116b58f6b9006 Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 02:17:36 +0530 Subject: [PATCH 06/19] get-apptainer: add AppArmor userns profile on Ubuntu 24.04+ --- script/get-apptainer/install-ubuntu.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/script/get-apptainer/install-ubuntu.sh b/script/get-apptainer/install-ubuntu.sh index 8a7036669..a8b36037a 100644 --- a/script/get-apptainer/install-ubuntu.sh +++ b/script/get-apptainer/install-ubuntu.sh @@ -7,6 +7,20 @@ ${MLC_SUDO} apt-get update ${MLC_SUDO} apt-get install -y apptainer test $? -eq 0 || exit $? +# Ubuntu 24.04+ blocks unprivileged user namespaces via AppArmor; allow them for apptainer only. +if [ "$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null)" = "1" ] && [ ! -f /etc/apparmor.d/apptainer ]; then + ${MLC_SUDO} tee /etc/apparmor.d/apptainer > /dev/null <<'EOF' +abi , +include +profile apptainer /usr/libexec/apptainer/bin/starter{,-suid} flags=(unconfined) { + userns, + include if exists +} +EOF + ${MLC_SUDO} apparmor_parser -r /etc/apparmor.d/apptainer + test $? -eq 0 || exit $? +fi + # Print version apptainer --version From 05781be45f4471739e5b44b9834d264df735bbc2 Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 02:26:44 +0530 Subject: [PATCH 07/19] get-apptainer: replace packaged AppArmor profile lacking userns rule --- script/get-apptainer/install-ubuntu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/get-apptainer/install-ubuntu.sh b/script/get-apptainer/install-ubuntu.sh index a8b36037a..abbe09128 100644 --- a/script/get-apptainer/install-ubuntu.sh +++ b/script/get-apptainer/install-ubuntu.sh @@ -7,8 +7,8 @@ ${MLC_SUDO} apt-get update ${MLC_SUDO} apt-get install -y apptainer test $? -eq 0 || exit $? -# Ubuntu 24.04+ blocks unprivileged user namespaces via AppArmor; allow them for apptainer only. -if [ "$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null)" = "1" ] && [ ! -f /etc/apparmor.d/apptainer ]; then +# Ubuntu 24.04+ blocks unprivileged userns; the packaged profile (abi 3.0, no userns rule) is not enough on newer kernels. +if [ "$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null)" = "1" ] && ! grep -qE '^\s*userns,' /etc/apparmor.d/apptainer 2>/dev/null; then ${MLC_SUDO} tee /etc/apparmor.d/apptainer > /dev/null <<'EOF' abi , include From 8c6034eec6b7ba4724716dc6c4d79df27582eb1e Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 14:16:31 +0530 Subject: [PATCH 08/19] apptainer: make build-time bind mounts optional (--apptainer_build_bind, default no) --- automation/script/apptainer.py | 4 +++- script/README.md | 2 +- script/build-apptainer-image/customize.py | 3 ++- script/build-apptainer-image/meta.yaml | 2 ++ script/build-apptainerfile/customize.py | 3 ++- script/build-apptainerfile/meta.yaml | 2 ++ 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/automation/script/apptainer.py b/automation/script/apptainer.py index c2897b3f2..b0dce0c2f 100644 --- a/automation/script/apptainer.py +++ b/automation/script/apptainer.py @@ -385,6 +385,8 @@ def apptainer_run(self_module, i): build_image_extras['ignore_fakeroot_cmd'] = apptainer_inputs['ignore_fakeroot_cmd'] if apptainer_inputs.get('sudo'): build_image_extras['sudo'] = apptainer_inputs['sudo'] + if apptainer_inputs.get('build_bind'): + build_image_extras['build_bind'] = apptainer_inputs['build_bind'] if build_image_extras: mlc_apptainer_input['add_deps_recursive']['build-apptainer-image'].update( build_image_extras) @@ -431,7 +433,7 @@ def prepare_apptainer_inputs(input_params, apptainer_settings, "mlc_repo", "mlc_repo_branch", "base_image", "os", "os_version", "mlc_repo_path", "mlc_repos", "skip_mlc_sys_upgrade", "extra_sys_deps", "image_name", "gh_token", "fake_run_deps", "run_final_cmds", "real_run", "copy_files", "path", "env", - "ignore_fakeroot_cmd", "sudo" + "ignore_fakeroot_cmd", "sudo", "build_bind" ] if run_stage: diff --git a/script/README.md b/script/README.md index 9d6c7ab87..c49addc73 100644 --- a/script/README.md +++ b/script/README.md @@ -1,6 +1,6 @@ # MLCommons Automation Scripts -*Last updated: 2026-11-05 16:59:17* +*Last updated: 2026-11-06 14:16:32* This directory contains automation scripts for MLPerf benchmarks, AI/ML workflows, and development operations. diff --git a/script/build-apptainer-image/customize.py b/script/build-apptainer-image/customize.py index 8766178ba..dddba2359 100644 --- a/script/build-apptainer-image/customize.py +++ b/script/build-apptainer-image/customize.py @@ -78,7 +78,8 @@ def preprocess(i): build_opts += f' --tmpdir {tmpdir}' # Run-time binds (e.g. /pa_nvme compilers) are also needed by the fake run in %post. - build_binds = env.get('MLC_APPTAINER_BIND_MOUNTS', []) + build_binds = env.get('MLC_APPTAINER_BIND_MOUNTS', []) if is_true( + env.get('MLC_APPTAINER_BUILD_BIND_MOUNTS', '')) else [] if isinstance(build_binds, str): build_binds = [build_binds] for mount in build_binds: diff --git a/script/build-apptainer-image/meta.yaml b/script/build-apptainer-image/meta.yaml index d5a46679c..ce272921b 100644 --- a/script/build-apptainer-image/meta.yaml +++ b/script/build-apptainer-image/meta.yaml @@ -16,6 +16,7 @@ cache: false # Environment default_env: + MLC_APPTAINER_BUILD_BIND_MOUNTS: 'no' MLC_APPTAINER_IMAGE_REPO: local MLC_APPTAINER_IMAGE_TAG: latest new_env_keys: @@ -23,6 +24,7 @@ new_env_keys: # Input mapping input_mapping: + build_bind: MLC_APPTAINER_BUILD_BIND_MOUNTS def_file: MLC_APPTAINERFILE_WITH_PATH docker_os: MLC_APPTAINER_OS docker_os_version: MLC_APPTAINER_OS_VERSION diff --git a/script/build-apptainerfile/customize.py b/script/build-apptainerfile/customize.py index f7b2444a2..54307c787 100644 --- a/script/build-apptainerfile/customize.py +++ b/script/build-apptainerfile/customize.py @@ -285,7 +285,8 @@ def preprocess(i): # Bind destinations must exist in the rootfs: apptainer cannot create # them when binds are applied to the build-time fake run. bind_dests = get_bind_destinations( - env.get('MLC_APPTAINER_BIND_MOUNTS', [])) + env.get('MLC_APPTAINER_BIND_MOUNTS', [])) if is_true( + env.get('MLC_APPTAINER_BUILD_BIND_MOUNTS', '')) else [] # Copy section for local repo (use %setup with tar to handle symlinks # gracefully) diff --git a/script/build-apptainerfile/meta.yaml b/script/build-apptainerfile/meta.yaml index 0c172f714..c2144a610 100644 --- a/script/build-apptainerfile/meta.yaml +++ b/script/build-apptainerfile/meta.yaml @@ -16,6 +16,7 @@ cache: false # Environment default_env: + MLC_APPTAINER_BUILD_BIND_MOUNTS: 'no' MLC_APPTAINER_OS: ubuntu MLC_APPTAINER_OS_VERSION: '24.04' MLC_MLOPS_REPO_BRANCH: dev @@ -27,6 +28,7 @@ input_mapping: base_image: MLC_APPTAINER_IMAGE_BASE bind: MLC_APPTAINER_BIND_MOUNTS build: MLC_BUILD_APPTAINER_IMAGE + build_bind: MLC_APPTAINER_BUILD_BIND_MOUNTS docker_os: MLC_APPTAINER_OS docker_os_version: MLC_APPTAINER_OS_VERSION extra_sys_deps: MLC_APPTAINER_EXTRA_SYS_DEPS From fa6f7486ddb1485ee56c41a2aacc5bdfe2b92362 Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 14:30:16 +0530 Subject: [PATCH 09/19] apptainer CI: allow unprivileged userns, add install diagnostics; drop automation build_bind forwarding --- .github/workflows/run-tests-on-modified-meta.yml | 3 +++ .github/workflows/run_tests_on_modified_meta_with_secrets.yml | 3 +++ automation/script/apptainer.py | 4 +--- script/get-apptainer/install-ubuntu.sh | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests-on-modified-meta.yml b/.github/workflows/run-tests-on-modified-meta.yml index 966b83ae8..75030df04 100644 --- a/.github/workflows/run-tests-on-modified-meta.yml +++ b/.github/workflows/run-tests-on-modified-meta.yml @@ -51,6 +51,9 @@ jobs: file_info: ${{ fromJSON(needs.get_modified_files.outputs.processed_files).file_info }} steps: + - name: Allow unprivileged user namespaces (needed by apptainer) + if: runner.os == 'Linux' + run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 || true - name: Process meta.yaml file shell: bash env: diff --git a/.github/workflows/run_tests_on_modified_meta_with_secrets.yml b/.github/workflows/run_tests_on_modified_meta_with_secrets.yml index b4933a13d..10fb8010d 100644 --- a/.github/workflows/run_tests_on_modified_meta_with_secrets.yml +++ b/.github/workflows/run_tests_on_modified_meta_with_secrets.yml @@ -82,6 +82,9 @@ jobs: echo "CF_ACCESS_CLIENT_ID=${{ steps.op-load-secrets.outputs.CF_ACCESS_CLIENT_ID }}" >> $GITHUB_ENV echo "CF_ACCESS_CLIENT_SECRET=${{ steps.op-load-secrets.outputs.CF_ACCESS_CLIENT_SECRET }}" >> $GITHUB_ENV + - name: Allow unprivileged user namespaces (needed by apptainer) + if: runner.os == 'Linux' + run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 || true - name: Process meta.yaml file shell: bash env: diff --git a/automation/script/apptainer.py b/automation/script/apptainer.py index b0dce0c2f..c2897b3f2 100644 --- a/automation/script/apptainer.py +++ b/automation/script/apptainer.py @@ -385,8 +385,6 @@ def apptainer_run(self_module, i): build_image_extras['ignore_fakeroot_cmd'] = apptainer_inputs['ignore_fakeroot_cmd'] if apptainer_inputs.get('sudo'): build_image_extras['sudo'] = apptainer_inputs['sudo'] - if apptainer_inputs.get('build_bind'): - build_image_extras['build_bind'] = apptainer_inputs['build_bind'] if build_image_extras: mlc_apptainer_input['add_deps_recursive']['build-apptainer-image'].update( build_image_extras) @@ -433,7 +431,7 @@ def prepare_apptainer_inputs(input_params, apptainer_settings, "mlc_repo", "mlc_repo_branch", "base_image", "os", "os_version", "mlc_repo_path", "mlc_repos", "skip_mlc_sys_upgrade", "extra_sys_deps", "image_name", "gh_token", "fake_run_deps", "run_final_cmds", "real_run", "copy_files", "path", "env", - "ignore_fakeroot_cmd", "sudo", "build_bind" + "ignore_fakeroot_cmd", "sudo" ] if run_stage: diff --git a/script/get-apptainer/install-ubuntu.sh b/script/get-apptainer/install-ubuntu.sh index abbe09128..e8a2e33ba 100644 --- a/script/get-apptainer/install-ubuntu.sh +++ b/script/get-apptainer/install-ubuntu.sh @@ -20,6 +20,8 @@ EOF ${MLC_SUDO} apparmor_parser -r /etc/apparmor.d/apptainer test $? -eq 0 || exit $? fi +echo "apparmor_restrict_unprivileged_userns=$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null || echo n/a)" +grep -H userns /etc/apparmor.d/apptainer 2>/dev/null || echo "apptainer AppArmor profile has no userns rule" # Print version apptainer --version From d9c436430e4c3e9579f41c29748df68ee9eb0ea9 Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 14:42:25 +0530 Subject: [PATCH 10/19] Fix phoronix stdin in interactive mode, apptainer bind handling, torchdata cap for rgat, sox-ng version detection; drop build_bind option --- .../meta.yaml | 3 ++ script/benchmark-program-phoronix/run.sh | 13 ++++-- script/build-apptainer-image/customize.py | 11 ++--- script/build-apptainer-image/meta.yaml | 2 - script/build-apptainerfile/customize.py | 45 +++++++++++++++---- script/build-apptainerfile/meta.yaml | 2 - script/get-generic-sys-util/meta.yaml | 5 ++- 7 files changed, 59 insertions(+), 22 deletions(-) diff --git a/script/app-mlperf-inference-mlcommons-python/meta.yaml b/script/app-mlperf-inference-mlcommons-python/meta.yaml index e327850c0..91eb1f07a 100644 --- a/script/app-mlperf-inference-mlcommons-python/meta.yaml +++ b/script/app-mlperf-inference-mlcommons-python/meta.yaml @@ -1061,6 +1061,9 @@ variations: - tags: get,generic-python-lib,_package.torchdata names: - torchdata + # dgl imports torchdata.datapipes, removed in torchdata 0.10 + version_max: 0.9.0 + version_max_usable: 0.9.0 - tags: get,generic-python-lib,_package.pybind11 - tags: get,generic-python-lib,_package.PyYAML - tags: get,generic-python-lib,_package.numpy diff --git a/script/benchmark-program-phoronix/run.sh b/script/benchmark-program-phoronix/run.sh index 3b20daa0f..e5083fc69 100644 --- a/script/benchmark-program-phoronix/run.sh +++ b/script/benchmark-program-phoronix/run.sh @@ -134,10 +134,17 @@ echo " Batch mode: ${MLC_PHORONIX_BATCH_MODE}" echo " Result id: ${RESULT_ID}" echo "***********************************************************************" +# Interactive (non-batch) mode needs stdin for PTS test-option menus. +if [ "${MLC_PHORONIX_BATCH_MODE}" == "yes" ]; then + exec 3&1 | tee "${OUTPUT_FILE}" + "${PTS}" batch-benchmark ${MLC_PHORONIX_EXTRA_ARGS} "${MLC_PHORONIX_TEST}" <&3 2>&1 | tee "${OUTPUT_FILE}" else - "${PTS}" benchmark ${MLC_PHORONIX_EXTRA_ARGS} "${MLC_PHORONIX_TEST}" &1 | tee "${OUTPUT_FILE}" + "${PTS}" benchmark ${MLC_PHORONIX_EXTRA_ARGS} "${MLC_PHORONIX_TEST}" <&3 2>&1 | tee "${OUTPUT_FILE}" fi exitstatus=${PIPESTATUS[0]} diff --git a/script/build-apptainer-image/customize.py b/script/build-apptainer-image/customize.py index dddba2359..6e12d66ae 100644 --- a/script/build-apptainer-image/customize.py +++ b/script/build-apptainer-image/customize.py @@ -78,13 +78,14 @@ def preprocess(i): build_opts += f' --tmpdir {tmpdir}' # Run-time binds (e.g. /pa_nvme compilers) are also needed by the fake run in %post. - build_binds = env.get('MLC_APPTAINER_BIND_MOUNTS', []) if is_true( - env.get('MLC_APPTAINER_BUILD_BIND_MOUNTS', '')) else [] + build_binds = env.get('MLC_APPTAINER_BIND_MOUNTS', []) if isinstance(build_binds, str): build_binds = [build_binds] - for mount in build_binds: - if mount and os.path.exists(mount.split(':', 1)[0]): - build_opts += f' --bind {mount}' + for entry in build_binds: + for mount in str(entry).split(','): + mount = mount.strip() + if mount and os.path.exists(mount.split(':', 1)[0]): + build_opts += f' --bind {mount}' cmd_prefix = "sudo " if is_true( env.get( diff --git a/script/build-apptainer-image/meta.yaml b/script/build-apptainer-image/meta.yaml index ce272921b..d5a46679c 100644 --- a/script/build-apptainer-image/meta.yaml +++ b/script/build-apptainer-image/meta.yaml @@ -16,7 +16,6 @@ cache: false # Environment default_env: - MLC_APPTAINER_BUILD_BIND_MOUNTS: 'no' MLC_APPTAINER_IMAGE_REPO: local MLC_APPTAINER_IMAGE_TAG: latest new_env_keys: @@ -24,7 +23,6 @@ new_env_keys: # Input mapping input_mapping: - build_bind: MLC_APPTAINER_BUILD_BIND_MOUNTS def_file: MLC_APPTAINERFILE_WITH_PATH docker_os: MLC_APPTAINER_OS docker_os_version: MLC_APPTAINER_OS_VERSION diff --git a/script/build-apptainerfile/customize.py b/script/build-apptainerfile/customize.py index 54307c787..30f7c0e4f 100644 --- a/script/build-apptainerfile/customize.py +++ b/script/build-apptainerfile/customize.py @@ -285,16 +285,16 @@ def preprocess(i): # Bind destinations must exist in the rootfs: apptainer cannot create # them when binds are applied to the build-time fake run. bind_dests = get_bind_destinations( - env.get('MLC_APPTAINER_BIND_MOUNTS', [])) if is_true( - env.get('MLC_APPTAINER_BUILD_BIND_MOUNTS', '')) else [] + env.get('MLC_APPTAINER_BIND_MOUNTS', [])) # Copy section for local repo (use %setup with tar to handle symlinks # gracefully) if bind_dests: f.write("%setup\n") - for dest in bind_dests: - f.write( - f" mkdir -p \"${{APPTAINER_ROOTFS}}\"{shlex.quote(dest)}\n") + # %setup runs on the host: create one component at a time and never follow symlinks out of the rootfs. + f.write(MKBIND_SH) + for dest, kind in bind_dests: + f.write(f" mlc_mkbind {shlex.quote(dest)} {kind}\n") if not (use_host_repos or use_copy_repo): f.write("\n") if use_host_repos: @@ -334,11 +334,37 @@ def preprocess(i): return {'return': 0} +MKBIND_SH = """ mlc_mkbind() { + _p="${APPTAINER_ROOTFS}"; _rest="${1#/}" + while [ -n "$_rest" ]; do + _c="${_rest%%/*}" + case "$_rest" in */*) _rest="${_rest#*/}" ;; *) _rest="" ;; esac + if [ -z "$_c" ] || [ "$_c" = "." ]; then continue; fi + _p="$_p/$_c" + if [ -L "$_p" ]; then + echo "Skipping bind point $1: $_p is a symlink"; return 0 + elif [ -z "$_rest" ] && [ "$2" = "file" ]; then + if [ ! -e "$_p" ]; then + : > "$_p" + elif [ ! -f "$_p" ]; then + echo "Skipping bind point $1: $_p is not a regular file"; return 0 + fi + elif [ ! -e "$_p" ]; then + mkdir "$_p" + elif [ ! -d "$_p" ]; then + echo "Skipping bind point $1: $_p is not a directory"; return 0 + fi + done + } +""" + + def get_bind_destinations(bind_mounts): - """Container-side paths of apptainer bind specs (src[:dest[:opts]]).""" + """(container path, 'file'|'dir') for apptainer bind specs (src[:dest[:opts]]).""" if isinstance(bind_mounts, str): bind_mounts = [bind_mounts] dests = [] + seen = set() for entry in bind_mounts or []: for spec in str(entry).split(','): spec = spec.strip() @@ -346,8 +372,11 @@ def get_bind_destinations(bind_mounts): continue parts = spec.split(':') dest = parts[1] if len(parts) > 1 and parts[1] else parts[0] - if dest.startswith('/') and dest not in dests: - dests.append(dest) + if dest.startswith('/') and '..' not in dest.split( + '/') and dest not in seen: + seen.add(dest) + kind = 'file' if os.path.isfile(parts[0]) else 'dir' + dests.append((dest, kind)) return dests diff --git a/script/build-apptainerfile/meta.yaml b/script/build-apptainerfile/meta.yaml index c2144a610..0c172f714 100644 --- a/script/build-apptainerfile/meta.yaml +++ b/script/build-apptainerfile/meta.yaml @@ -16,7 +16,6 @@ cache: false # Environment default_env: - MLC_APPTAINER_BUILD_BIND_MOUNTS: 'no' MLC_APPTAINER_OS: ubuntu MLC_APPTAINER_OS_VERSION: '24.04' MLC_MLOPS_REPO_BRANCH: dev @@ -28,7 +27,6 @@ input_mapping: base_image: MLC_APPTAINER_IMAGE_BASE bind: MLC_APPTAINER_BIND_MOUNTS build: MLC_BUILD_APPTAINER_IMAGE - build_bind: MLC_APPTAINER_BUILD_BIND_MOUNTS docker_os: MLC_APPTAINER_OS docker_os_version: MLC_APPTAINER_OS_VERSION extra_sys_deps: MLC_APPTAINER_EXTRA_SYS_DEPS diff --git a/script/get-generic-sys-util/meta.yaml b/script/get-generic-sys-util/meta.yaml index db52700af..cd8c194d9 100644 --- a/script/get-generic-sys-util/meta.yaml +++ b/script/get-generic-sys-util/meta.yaml @@ -1233,8 +1233,9 @@ variations: env: MLC_SYS_UTIL_NAME: sox MLC_SYS_UTIL_VERSION_CMD: sox --version - MLC_SYS_UTIL_VERSION_RE: sox:\s+SoX\s+v([\d.]+) - MLC_TMP_VERSION_DETECT_GROUP_NUMBER: 0 + # sox-ng (Ubuntu 26.04+) prints a different banner than classic SoX + MLC_SYS_UTIL_VERSION_RE: SoX\S*\s+v?(\d+(?:\.\d+)+) + MLC_TMP_VERSION_DETECT_GROUP_NUMBER: 1 new_env_keys: - MLC_SOX_VERSION state: From f9c8f181a0a1c822f8f97844d48bfb0af78e4ac7 Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 14:56:14 +0530 Subject: [PATCH 11/19] rgat: add pandas dep for dgl; get-apptainer: install squashfuse and fuse2fs on Ubuntu --- script/app-mlperf-inference-mlcommons-python/meta.yaml | 1 + script/get-apptainer/install-ubuntu.sh | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/script/app-mlperf-inference-mlcommons-python/meta.yaml b/script/app-mlperf-inference-mlcommons-python/meta.yaml index 91eb1f07a..20472c321 100644 --- a/script/app-mlperf-inference-mlcommons-python/meta.yaml +++ b/script/app-mlperf-inference-mlcommons-python/meta.yaml @@ -1064,6 +1064,7 @@ variations: # dgl imports torchdata.datapipes, removed in torchdata 0.10 version_max: 0.9.0 version_max_usable: 0.9.0 + - tags: get,generic-python-lib,_package.pandas - tags: get,generic-python-lib,_package.pybind11 - tags: get,generic-python-lib,_package.PyYAML - tags: get,generic-python-lib,_package.numpy diff --git a/script/get-apptainer/install-ubuntu.sh b/script/get-apptainer/install-ubuntu.sh index e8a2e33ba..214f3a01b 100644 --- a/script/get-apptainer/install-ubuntu.sh +++ b/script/get-apptainer/install-ubuntu.sh @@ -4,7 +4,8 @@ ${MLC_SUDO} apt-get update ${MLC_SUDO} apt-get install -y software-properties-common ${MLC_SUDO} add-apt-repository -y ppa:apptainer/ppa ${MLC_SUDO} apt-get update -${MLC_SUDO} apt-get install -y apptainer +# squashfuse/fuse2fs let unprivileged apptainer mount SIF images instead of extracting them. +${MLC_SUDO} apt-get install -y apptainer squashfuse fuse2fs test $? -eq 0 || exit $? # Ubuntu 24.04+ blocks unprivileged userns; the packaged profile (abi 3.0, no userns rule) is not enough on newer kernels. From 48c2a135d773ce2e8c1f8638cc72000ffd485879 Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 16:40:11 +0530 Subject: [PATCH 12/19] apptainer: forward CLI and meta binds to definition generation; get-generic-sys-util: multi-PM FFTW version probe --- automation/script/apptainer.py | 21 +++++++++++++-------- script/get-generic-sys-util/meta.yaml | 3 ++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/automation/script/apptainer.py b/automation/script/apptainer.py index c2897b3f2..b8838afb3 100644 --- a/automation/script/apptainer.py +++ b/automation/script/apptainer.py @@ -302,12 +302,6 @@ def apptainer_run(self_module, i): return {'return': 0, 'warning': 'Apptainer run is set to false in script meta'} - # Regenerate definition file if required - if regenerate_def_file: - r = apptainerfile(self_module, input_i) - if r['return'] > 0: - return r - # Ensure Apptainer is available r = self_module.action_object.access( {'action': 'run', 'automation': 'script', 'tags': "get-apptainer", 'quiet': True}) @@ -337,6 +331,17 @@ def apptainer_run(self_module, i): mounts, env, apptainer_settings, run_state) container_env_string = bind_mounts.get('container_env_string', '') + # Regenerate definition file with the same binds the image build will use + if regenerate_def_file: + def_binds = apptainer_inputs.get('bind') or [] + if isinstance(def_binds, str): + def_binds = [def_binds] + input_i['apptainer_bind'] = list( + dict.fromkeys(def_binds + bind_mounts.get('mounts', []))) + r = apptainerfile(self_module, input_i) + if r['return'] > 0: + return r + # Forward input-mapped env vars to the container's mlcr command input_mapping = meta.get('input_mapping', {}) for input_key, env_key in input_mapping.items(): @@ -431,13 +436,13 @@ def prepare_apptainer_inputs(input_params, apptainer_settings, "mlc_repo", "mlc_repo_branch", "base_image", "os", "os_version", "mlc_repo_path", "mlc_repos", "skip_mlc_sys_upgrade", "extra_sys_deps", "image_name", "gh_token", "fake_run_deps", "run_final_cmds", "real_run", "copy_files", "path", "env", - "ignore_fakeroot_cmd", "sudo" + "ignore_fakeroot_cmd", "sudo", "bind" ] if run_stage: keys += [ "skip_run_cmd", "pre_run_cmds", "run_cmd_prefix", - "nv", "rocm", "bind", "writable", "writable_tmpfs", + "nv", "rocm", "writable", "writable_tmpfs", "cleanenv", "fakeroot", "no_home", "contain", "containall", "overlay", "extra_args", "sandbox", "network", "security_opt" diff --git a/script/get-generic-sys-util/meta.yaml b/script/get-generic-sys-util/meta.yaml index cd8c194d9..b46a97922 100644 --- a/script/get-generic-sys-util/meta.yaml +++ b/script/get-generic-sys-util/meta.yaml @@ -562,7 +562,8 @@ variations: libfftw3-dev: env: MLC_SYS_UTIL_NAME: libfftw3-dev - MLC_SYS_UTIL_VERSION_CMD: dpkg -s libfftw3-dev | grep 'Version' + # Grouped so detect.sh's '> tmp-ver.out' captures whichever probe succeeds (apt / rpm-based / pacman). + MLC_SYS_UTIL_VERSION_CMD: "{ dpkg -s libfftw3-dev 2>/dev/null | grep 'Version' || rpm -q --qf 'Version: %{VERSION}\\n' fftw-devel 2>/dev/null | grep 'Version' || pacman -Q fftw 2>/dev/null; }" MLC_SYS_UTIL_VERSION_RE: ([0-9]+(\.[0-9]+)+) MLC_TMP_VERSION_DETECT_GROUP_NUMBER: 1 new_env_keys: From 82467f0c29d9b3c73b8f181e94bfeeee8eb8c533 Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 16:51:44 +0530 Subject: [PATCH 13/19] rgat: cap pandas at 2.2.3 to stay compatible with numpy 1.26.4 --- script/app-mlperf-inference-mlcommons-python/meta.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/script/app-mlperf-inference-mlcommons-python/meta.yaml b/script/app-mlperf-inference-mlcommons-python/meta.yaml index 20472c321..3c99bf757 100644 --- a/script/app-mlperf-inference-mlcommons-python/meta.yaml +++ b/script/app-mlperf-inference-mlcommons-python/meta.yaml @@ -1064,7 +1064,6 @@ variations: # dgl imports torchdata.datapipes, removed in torchdata 0.10 version_max: 0.9.0 version_max_usable: 0.9.0 - - tags: get,generic-python-lib,_package.pandas - tags: get,generic-python-lib,_package.pybind11 - tags: get,generic-python-lib,_package.PyYAML - tags: get,generic-python-lib,_package.numpy @@ -1075,6 +1074,10 @@ variations: version_max: 1.26.4 names: - numpy-downgrade + # pandas 3.x needs numpy>=2.0.2, but rgat pins numpy 1.26.4 above + - tags: get,generic-python-lib,_package.pandas + version_max: 2.2.3 + version_max_usable: 2.2.3 - tags: get,generic-python-lib,_package.pydantic - tags: get,generic-python-lib,_package.igb,_url.git+https://github.com/IllinoisGraphBenchmark/IGB-Datasets.git - tags: get,generic-python-lib,_package.torch-geometric From 1e9ed3e204f219be4cfe3c96ddc1cff2798b3a94 Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 17:05:25 +0530 Subject: [PATCH 14/19] rgat: pin dgl to 2.4.0 to avoid PyPI fallback lacking torch 2.4 graphbolt --- script/app-mlperf-inference-mlcommons-python/meta.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/app-mlperf-inference-mlcommons-python/meta.yaml b/script/app-mlperf-inference-mlcommons-python/meta.yaml index 3c99bf757..95aefbfd7 100644 --- a/script/app-mlperf-inference-mlcommons-python/meta.yaml +++ b/script/app-mlperf-inference-mlcommons-python/meta.yaml @@ -1097,7 +1097,9 @@ variations: update_tags_from_env_with_prefix: _find_links_url.: - MLC_TMP_GENERIC_PYTHON_PIP_EXTRA_FIND_LINKS_URL + # PyPI only has dgl<=2.1.0 (no graphbolt lib for torch 2.4); force the data.dgl.ai wheel - tags: get,generic-python-lib,_package.dgl + version_min: 2.4.0 version_max: 2.4.0 version_max_usable: 2.4.0 update_tags_from_env_with_prefix: From 598e474d6802e122d9af844ef741ad1f78d6a452 Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 17:21:31 +0530 Subject: [PATCH 15/19] CI: run MLPerf inference workflows on pull_request and drop results upload --- ...bert-deepsparse-tf-onnxruntime-pytorch.yml | 30 +----- ...lperf-inference-mlcommons-cpp-resnet50.yml | 32 +------ .../test-mlperf-inference-resnet50.yml | 47 +--------- .../test-mlperf-inference-retinanet.yml | 2 +- .../test-mlperf-inference-tvm-resnet50.yml | 33 +------ .../test-mlperf-inference-yolo-closed-div.yml | 94 +------------------ .../test-mlperf-inference-yolo-open-div.yml | 74 +-------------- 7 files changed, 9 insertions(+), 303 deletions(-) diff --git a/.github/workflows/test-mlperf-inference-bert-deepsparse-tf-onnxruntime-pytorch.yml b/.github/workflows/test-mlperf-inference-bert-deepsparse-tf-onnxruntime-pytorch.yml index 302607862..297e37766 100644 --- a/.github/workflows/test-mlperf-inference-bert-deepsparse-tf-onnxruntime-pytorch.yml +++ b/.github/workflows/test-mlperf-inference-bert-deepsparse-tf-onnxruntime-pytorch.yml @@ -1,7 +1,7 @@ name: MLPerf inference bert (deepsparse, tf, onnxruntime, pytorch) on: - pull_request_target: + pull_request: branches: [ "main_off", "dev_off" ] paths: - '.github/workflows/test-mlperf-inference-bert-deepsparse-tf-onnxruntime-pytorch.yml' @@ -52,31 +52,3 @@ jobs: if: matrix.os != 'windows-latest' run: | mlcr run,mlperf,inference,generate-run-cmds,_submission,_short --submitter="MLCommons" --hw_name=gh_${{ matrix.os }}_x86 --model=bert-99 --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=5 --precision=${{ matrix.precision }} --target_qps=1 -v --quiet - - name: Randomly Execute Step - id: random-check - run: | - RANDOM_NUMBER=$((RANDOM % 10)) - echo "Random number is $RANDOM_NUMBER" - if [ "$RANDOM_NUMBER" -eq 0 ]; then - echo "run_step=true" >> $GITHUB_ENV - else - echo "run_step=false" >> $GITHUB_ENV - fi - - name: Load secrets - id: op-load-secrets - uses: 1password/load-secrets-action@v3 - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - PAT: op://7basd2jirojjckncf6qnq3azai/bzbaco3uxoqs2rcyu42rvuccga/credential - - name: Push Results - env: - GITHUB_TOKEN: ${{ steps.op-load-secrets.outputs.PAT }} - if: github.repository_owner == 'mlcommons' && env.run_step == 'true' - run: | - git config --global user.name "mlcommons-bot" - git config --global user.email "mlcommons-bot@users.noreply.github.com" - git config --global credential.https://github.com.helper "" - git config --global credential.https://github.com.helper "!gh auth git-credential" - git config --global credential.https://gist.github.com.helper "" - git config --global credential.https://gist.github.com.helper "!gh auth git-credential" - mlcr push,github,mlperf,inference,submission --repo_url=https://github.com/mlcommons/mlperf_inference_test_submissions_v5.0 --repo_branch=auto-update --commit_message="Results from R50 GH action on ${{ matrix.os }}" --quiet diff --git a/.github/workflows/test-mlperf-inference-mlcommons-cpp-resnet50.yml b/.github/workflows/test-mlperf-inference-mlcommons-cpp-resnet50.yml index ff3abfff9..3410c8bf0 100644 --- a/.github/workflows/test-mlperf-inference-mlcommons-cpp-resnet50.yml +++ b/.github/workflows/test-mlperf-inference-mlcommons-cpp-resnet50.yml @@ -1,7 +1,7 @@ name: MLPerf inference MLCommons C++ ResNet50 on: - pull_request_target: + pull_request: branches: [ "main", "dev" ] paths: - '.github/workflows/test-mlperf-inference-mlcommons-cpp-resnet50.yml' @@ -69,33 +69,3 @@ jobs: if: matrix.os != 'windows-latest' run: | mlcr app,mlperf,inference,mlcommons,cpp --submitter="MLCommons" --hw_name=gh_${{ matrix.os }} -v --quiet ${{ matrix.compiler-string }} - - name: Randomly Execute Step - id: random-check - run: | - RANDOM_NUMBER=$((RANDOM % 10)) - echo "Random number is $RANDOM_NUMBER" - if [ "$RANDOM_NUMBER" -eq 0 ]; then - echo "run_step=true" >> $GITHUB_ENV - else - echo "run_step=false" >> $GITHUB_ENV - fi - - name: Load secrets - id: op-load-secrets - uses: 1password/load-secrets-action@v3 - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - PAT: op://7basd2jirojjckncf6qnq3azai/bzbaco3uxoqs2rcyu42rvuccga/credential - - name: Push Results - env: - GITHUB_TOKEN: ${{ steps.op-load-secrets.outputs.PAT }} - USER: mlcommons-bot - EMAIL: mlcommons-bot@users.noreply.github.com - if: github.repository_owner == 'mlcommons' && env.run_step == 'true' - run: | - git config --global user.name "${{ env.USER }}" - git config --global user.email "${{ env.EMAIL }}" - git config --global credential.https://github.com.helper "" - git config --global credential.https://github.com.helper "!gh auth git-credential" - git config --global credential.https://gist.github.com.helper "" - git config --global credential.https://gist.github.com.helper "!gh auth git-credential" - mlcr push,github,mlperf,inference,submission --repo_url=https://github.com/mlcommons/mlperf_inference_test_submissions_v5.0 --repo_branch=dev --commit_message="Results from MLCommons C++ ResNet50 GH action on ${{ matrix.os }}" --quiet diff --git a/.github/workflows/test-mlperf-inference-resnet50.yml b/.github/workflows/test-mlperf-inference-resnet50.yml index 846686256..5fbe2bd49 100644 --- a/.github/workflows/test-mlperf-inference-resnet50.yml +++ b/.github/workflows/test-mlperf-inference-resnet50.yml @@ -4,7 +4,7 @@ permissions: contents: read on: - pull_request_target: + pull_request: branches: [ "main", "dev" ] paths: - '.github/workflows/test-mlperf-inference-resnet50.yml' @@ -33,7 +33,7 @@ on: workflow_dispatch: {} jobs: - mlc-run-with-results-upload: + mlc-run: runs-on: ${{ matrix.os }} env: MLC_INDEX: "on" @@ -86,50 +86,7 @@ jobs: if: matrix.os != 'windows-latest' run: | mlcr run-mlperf,inference,_submission,_short,_r6.0-dev --submitter="MLCommons" --pull_changes=yes --pull_inference_changes=yes --hw_name="gh_${{ matrix.os }} x86" --model=resnet50 --implementation=${{ matrix.implementation }} --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=500 --target_qps=1 -v --quiet - # Step for Linux/MacOS - - name: Randomly Execute Step (Linux/MacOS) - if: runner.os != 'Windows' - run: | - RANDOM_NUMBER=$((RANDOM % 10)) - echo "Random number is $RANDOM_NUMBER" - if [ "$RANDOM_NUMBER" -eq 0 ]; then - echo "run_step=true" >> $GITHUB_ENV - else - echo "run_step=false" >> $GITHUB_ENV - fi - - # Step for Windows - - name: Randomly Execute Step (Windows) - if: runner.os == 'Windows' - run: | - $RANDOM_NUMBER = Get-Random -Maximum 10 - Write-Host "Random number is $RANDOM_NUMBER" - if ($RANDOM_NUMBER -eq 0) { - Write-Host "run_step=true" | Out-File -FilePath $Env:GITHUB_ENV -Append - } else { - Write-Host "run_step=false" | Out-File -FilePath $Env:GITHUB_ENV -Append - } - - name: Load secrets - id: op-load-secrets - uses: 1password/load-secrets-action@v3 - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - PAT: op://7basd2jirojjckncf6qnq3azai/bzbaco3uxoqs2rcyu42rvuccga/credential - - - name: Push Results - env: - GITHUB_TOKEN: ${{ steps.op-load-secrets.outputs.PAT }} - if: github.repository_owner == 'mlcommons' && env.run_step == 'true' - run: | - git config --global user.name "mlcommons-bot" - git config --global user.email "mlcommons-bot@users.noreply.github.com" - git config --global credential.https://github.com.helper "" - git config --global credential.https://github.com.helper "!gh auth git-credential" - git config --global credential.https://gist.github.com.helper "" - git config --global credential.https://gist.github.com.helper "!gh auth git-credential" - mlcr push,github,mlperf,inference,submission --repo_url=https://github.com/mlcommons/mlperf_inference_test_submissions_v5.0 --repo_branch=auto-update --commit_message="Results from R50 GH action on ${{ matrix.os }}" --quiet - mlc-run-rhel-docker: runs-on: ubuntu-latest env: diff --git a/.github/workflows/test-mlperf-inference-retinanet.yml b/.github/workflows/test-mlperf-inference-retinanet.yml index 07f883d65..48a860811 100644 --- a/.github/workflows/test-mlperf-inference-retinanet.yml +++ b/.github/workflows/test-mlperf-inference-retinanet.yml @@ -1,7 +1,7 @@ name: MLPerf inference retinanet on: - pull_request_target: + pull_request: branches: [ "main_off", "dev_off" ] paths: - '.github/workflows/test-mlperf-inference-retinanet.yml' diff --git a/.github/workflows/test-mlperf-inference-tvm-resnet50.yml b/.github/workflows/test-mlperf-inference-tvm-resnet50.yml index 27abcb242..0d8fd537a 100644 --- a/.github/workflows/test-mlperf-inference-tvm-resnet50.yml +++ b/.github/workflows/test-mlperf-inference-tvm-resnet50.yml @@ -1,7 +1,7 @@ name: MLPerf Inference TVM ResNet50 on: - pull_request_target: + pull_request: branches: [ "main-off", "dev-off" ] paths: - '.github/workflows/test-mlperf-inference-tvm-resnet50.yml' @@ -37,34 +37,3 @@ jobs: - name: Test MLC Tutorial TVM run: | mlcr run-mlperf,inference,_submission,_short --adr.python.name=mlperf --adr.python.version_min=3.8 --submitter=MLCommons --implementation=python --hw_name=gh_ubuntu-latest --model=resnet50 --backend=tvm-onnx --device=cpu --scenario=Offline --mode=accuracy --test_query_count=5 --clean --quiet ${{ matrix.extra-options }} - - name: Randomly Execute Step - id: random-check - run: | - RANDOM_NUMBER=$((RANDOM % 10)) - echo "Random number is $RANDOM_NUMBER" - if [ "$RANDOM_NUMBER" -eq 0 ]; then - echo "run_step=true" >> $GITHUB_ENV - else - echo "run_step=false" >> $GITHUB_ENV - fi - - name: Load secrets - if: github.repository_owner == 'mlcommons' && env.run_step == 'true' - id: op-load-secrets - uses: 1password/load-secrets-action@v3 - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - PAT: op://7basd2jirojjckncf6qnq3azai/bzbaco3uxoqs2rcyu42rvuccga/credential - - name: Push Results - env: - GITHUB_TOKEN: ${{ steps.op-load-secrets.outputs.PAT }} - USER: mlcommons-bot - EMAIL: mlcommons-bot@users.noreply.github.com - if: github.repository_owner == 'mlcommons' && env.run_step == 'true' - run: | - git config --global user.name "$USER" - git config --global user.email "$EMAIL" - git config --global credential.https://github.com.helper "" - git config --global credential.https://github.com.helper "!gh auth git-credential" - git config --global credential.https://gist.github.com.helper "" - git config --global credential.https://gist.github.com.helper "!gh auth git-credential" - mlcr push,github,mlperf,inference,submission --repo_url=https://github.com/mlcommons/mlperf_inference_test_submissions_v5.0 --repo_branch=auto-update --commit_message="Results from R50 GH action on ${{ matrix.os }}" --quiet diff --git a/.github/workflows/test-mlperf-inference-yolo-closed-div.yml b/.github/workflows/test-mlperf-inference-yolo-closed-div.yml index 1cbc1cef4..d7789e7e1 100644 --- a/.github/workflows/test-mlperf-inference-yolo-closed-div.yml +++ b/.github/workflows/test-mlperf-inference-yolo-closed-div.yml @@ -5,7 +5,7 @@ permissions: on: #schedule: # - cron: '0 0 * * *' # Runs daily at 12 AM UTC - pull_request_target: + pull_request: branches: [ "main-off", "dev-off" ] paths: - '.github/workflows/test-mlperf-inference-yolo.yml' @@ -52,95 +52,3 @@ jobs: run: | mlcr run-mlperf,inference,_full,_find-performance,_all-scenarios,_r6.0-dev --submitter="MLCommons" --pull_changes=yes --pull_inference_changes=yes --hw_name="gh_${{ matrix.os }}x86" --model=yolo-99 --implementation=reference --category=edge --backend=${{ matrix.backend }} --framework=pytorch --device=cpu --execution_mode=test -v --quiet mlcr run-mlperf,inference,_compliance,_full,_all-modes,_all-scenarios,_r6.0-dev --division=closed --results_dir=${{ env.RESULTS_DIR }} --model=yolo-99 --implementation=reference --category=edge --backend=${{ matrix.backend }} --framework=pytorch --device=cpu --execution_mode=valid --multistream_target_latency=900 --env.MLC_MLPERF_USE_MAX_DURATION=no -v --quiet --submitter="MLCommons" --pull_changes=yes --pull_inference_changes=yes --hw_name="gh_${{ matrix.os }}_python${{ matrix.python-version }}x86" - - name: upload results artifact - uses: actions/upload-artifact@v4 - with: - name: mlperf-inference-yolo-results-${{ matrix.os }}-py${{ matrix.python-version }}-bk${{ matrix.backend }} - path: ${{ env.RESULTS_DIR }} - - upload-results-to-github: - needs: mlc-run - runs-on: ubuntu-latest - env: - MLC_INDEX: "on" - SUBMISSION_DIR: ${{ github.workspace }}/mlperf_inference_submission - ARTIFACT_DOWNLOAD_PATH: ${{ github.workspace }}/gh_artifacts - RESULTS_DIR: ${{ github.workspace }}/mlperf_inference_results - - concurrency: - group: upload-results-v6.0 - cancel-in-progress: false - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - python-version: [ "3.13" ] - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - - name: Install mlcflow - run: | - pip install mlcflow - pip install tabulate - - - name: Pull MLOps repo - shell: bash - env: - REPO: ${{ github.event.pull_request.head.repo.html_url }} - BRANCH: ${{ github.event.pull_request.head.ref }} - run: | - mlc pull repo "$REPO" --branch="$BRANCH" - - - name: Download benchmark artifacts - uses: actions/download-artifact@v4 - with: - path: "${{ env.ARTIFACT_DOWNLOAD_PATH }}" - - - name: Load secrets - id: op-load-secrets - uses: 1password/load-secrets-action@v3 - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - PAT: op://7basd2jirojjckncf6qnq3azai/bzbaco3uxoqs2rcyu42rvuccga/credential - - - name: Prepare Results Directory - run: | - set -euo pipefail - - mkdir -p "${{ env.RESULTS_DIR }}" - - # Iterate over system folders - for system_dir in "${{ env.ARTIFACT_DOWNLOAD_PATH }}/*"; do - if [ -d "${system_dir}/valid_results" ]; then - echo "Processing ${system_dir}/valid_results" - cp -r "${system_dir}/valid_results/"* "${{ env.RESULTS_DIR }}/" - else - echo "Skipping ${system_dir} (no valid_results directory)" - fi - done - - tree -a "${{ env.RESULTS_DIR }}" - - mlcr generate,inference,submission --adr.compiler.tags=gcc --version=v6.0 --clean --preprocess_submission=yes --submission_base_dir="${{ env.SUBMISSION_DIR}}" --results_dir="${{ env.RESULTS_DIR }}" --run_checker --submitter=MLCommons --tar=yes --division=closed --env.MLC_DETERMINE_MEMORY_CONFIGURATION=yes --extra_checker_args="--skip-extra-accuracy-files-check" --quiet $docker_tags - - - name: Push Results - env: - GITHUB_TOKEN: ${{ steps.op-load-secrets.outputs.PAT }} - if: github.repository_owner == 'mlcommons' - run: | - git config --global user.name "mlcommons-bot" - git config --global user.email "mlcommons-bot@users.noreply.github.com" - git config --global credential.https://github.com.helper "" - git config --global credential.https://github.com.helper "!gh auth git-credential" - git config --global credential.https://gist.github.com.helper "" - git config --global credential.https://gist.github.com.helper "!gh auth git-credential" - mlcr push,github,mlperf,inference,submission --submission_dir=${{ env.SUBMISSION_DIR }} --repo_url=https://github.com/mlcommons/mlperf_inference_unofficial_submissions_v5.0/ --repo_branch=v6.0 --commit_message="Results from yolo-v11 GH action on ${{ matrix.os }}" --quiet - diff --git a/.github/workflows/test-mlperf-inference-yolo-open-div.yml b/.github/workflows/test-mlperf-inference-yolo-open-div.yml index ebaf3f4b7..1cf5922a2 100644 --- a/.github/workflows/test-mlperf-inference-yolo-open-div.yml +++ b/.github/workflows/test-mlperf-inference-yolo-open-div.yml @@ -5,7 +5,7 @@ permissions: on: schedule: - cron: '0 0 * * *' # Runs daily at 12 AM UTC - pull_request_target: + pull_request: branches: [ "main_off", "dev_off" ] paths: - '.github/workflows/test-mlperf-inference-yolo.yml' @@ -51,74 +51,4 @@ jobs: - name: Test MLPerf Inference YOLO-v11 (Linux/macOS) run: | mlcr run-mlperf,inference,_full,_find-performance,_all-scenarios,_r6.0-dev --submitter="MLCommons" --pull_changes=yes --pull_inference_changes=yes --hw_name="gh_${{ matrix.os }}x86" --model=yolo-99 --implementation=reference --category=edge --backend=${{ matrix.backend }} --framework=pytorch --device=cpu --execution_mode=test -v --quiet - mlcr run-mlperf,inference,_submission,_full,_all-modes,_all-scenarios,_r6.0-dev --submission_dir=${{ env.SUBMISSION_DIR }} --submitter="MLCommons" --pull_changes=yes --pull_inference_changes=yes --hw_name="gh_${{ matrix.os }}x86" --model=yolo-99 --implementation=reference --category=edge --backend=${{ matrix.backend }} --framework=pytorch --device=cpu --execution_mode=valid --multistream_target_latency=900 --env.MLC_MLPERF_USE_MAX_DURATION=no -v --quiet - - - name: upload results artifact - uses: actions/upload-artifact@v4 - with: - name: mlperf-inference-yolo-results-${{ matrix.os }}-py${{ matrix.python-version }}-bk${{ matrix.backend }} - path: ${{ env.SUBMISSION_DIR }} - - upload-results-to-github: - needs: mlc-run - runs-on: ubuntu-latest - env: - MLC_INDEX: "on" - SUBMISSION_DIR: ${{ github.workspace }}/mlperf_inference_results - concurrency: - group: upload-results-v6.0 - cancel-in-progress: false - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - python-version: [ "3.13" ] - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - - name: Install mlcflow - run: | - pip install mlcflow - pip install tabulate - - - name: Pull MLOps repo - shell: bash - env: - REPO: ${{ github.event.pull_request.head.repo.html_url }} - BRANCH: ${{ github.event.pull_request.head.ref }} - run: | - mlc pull repo "$REPO" --branch="$BRANCH" - - - name: Download benchmark artifacts - uses: actions/download-artifact@v4 - with: - path: "${{ env.SUBMISSION_DIR }}/open" - - - name: Load secrets - id: op-load-secrets - uses: 1password/load-secrets-action@v3 - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - PAT: op://7basd2jirojjckncf6qnq3azai/bzbaco3uxoqs2rcyu42rvuccga/credential - - - name: Push Results - env: - GITHUB_TOKEN: ${{ steps.op-load-secrets.outputs.PAT }} - if: github.repository_owner == 'mlcommons' - run: | - git config --global user.name "mlcommons-bot" - git config --global user.email "mlcommons-bot@users.noreply.github.com" - git config --global credential.https://github.com.helper "" - git config --global credential.https://github.com.helper "!gh auth git-credential" - git config --global credential.https://gist.github.com.helper "" - git config --global credential.https://gist.github.com.helper "!gh auth git-credential" - mlcr push,github,mlperf,inference,submission --submission_dir=${{ env.SUBMISSION_DIR }} --repo_url=https://github.com/mlcommons/mlperf_inference_unofficial_submissions_v5.0/ --repo_branch=v6.0 --commit_message="Results from yolo-v11 GH action on ${{ matrix.os }}" --quiet - + mlcr run-mlperf,inference,_submission,_full,_all-modes,_all-scenarios,_r6.0-dev --submission_dir=${{ env.SUBMISSION_DIR }} --submitter="MLCommons" --pull_changes=yes --pull_inference_changes=yes --hw_name="gh_${{ matrix.os }}x86" --model=yolo-99 --implementation=reference --category=edge --backend=${{ matrix.backend }} --framework=pytorch --device=cpu --execution_mode=valid --multistream_target_latency=900 --env.MLC_MLPERF_USE_MAX_DURATION=no -v --quiet From a3c873f4573ed0b91d991afc4d692bfbd9f3f6c4 Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 17:28:26 +0530 Subject: [PATCH 16/19] Drop EOL Debian 11 from build-dockerfile/build-apptainerfile tests --- script/build-apptainerfile/meta.yaml | 3 --- script/build-dockerfile/meta.yaml | 3 --- 2 files changed, 6 deletions(-) diff --git a/script/build-apptainerfile/meta.yaml b/script/build-apptainerfile/meta.yaml index 0c172f714..dfdacb904 100644 --- a/script/build-apptainerfile/meta.yaml +++ b/script/build-apptainerfile/meta.yaml @@ -96,9 +96,6 @@ tests: - env: MLC_APPTAINER_OS: sles MLC_APPTAINER_OS_VERSION: '15.6' - - env: - MLC_APPTAINER_OS: debian - MLC_APPTAINER_OS_VERSION: '11' - env: MLC_APPTAINER_OS: debian MLC_APPTAINER_OS_VERSION: '12' diff --git a/script/build-dockerfile/meta.yaml b/script/build-dockerfile/meta.yaml index 75c65386d..eee6f558d 100644 --- a/script/build-dockerfile/meta.yaml +++ b/script/build-dockerfile/meta.yaml @@ -123,9 +123,6 @@ tests: - env: MLC_DOCKER_OS: sles MLC_DOCKER_OS_VERSION: '15.6' - - env: - MLC_DOCKER_OS: debian - MLC_DOCKER_OS_VERSION: '11' - env: MLC_DOCKER_OS: debian MLC_DOCKER_OS_VERSION: '12' From f68b2c26a5ba235e92b550695678210a945666dd Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 17:34:02 +0530 Subject: [PATCH 17/19] Drop EOL Debian 11 from build-apptainer-image tests --- script/build-apptainer-image/meta.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/script/build-apptainer-image/meta.yaml b/script/build-apptainer-image/meta.yaml index d5a46679c..b030b4b84 100644 --- a/script/build-apptainer-image/meta.yaml +++ b/script/build-apptainer-image/meta.yaml @@ -81,9 +81,6 @@ tests: - env: MLC_APPTAINER_OS: sles MLC_APPTAINER_OS_VERSION: '15.6' - - env: - MLC_APPTAINER_OS: debian - MLC_APPTAINER_OS_VERSION: '11' - env: MLC_APPTAINER_OS: debian MLC_APPTAINER_OS_VERSION: '12' From 3deeab5a28b4e982066e25440aa61c527cada1c3 Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 18:52:47 +0530 Subject: [PATCH 18/19] apptainer: quote build binds, resolve container symlinks for bind targets, preserve existing AppArmor profiles --- script/build-apptainer-image/customize.py | 3 +- script/build-apptainerfile/customize.py | 23 +++++++++++---- script/get-apptainer/install-ubuntu.sh | 36 +++++++++++++++++++---- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/script/build-apptainer-image/customize.py b/script/build-apptainer-image/customize.py index 6e12d66ae..2d9d7500e 100644 --- a/script/build-apptainer-image/customize.py +++ b/script/build-apptainer-image/customize.py @@ -1,5 +1,6 @@ from mlc import utils import os +import shlex from utils import * @@ -85,7 +86,7 @@ def preprocess(i): for mount in str(entry).split(','): mount = mount.strip() if mount and os.path.exists(mount.split(':', 1)[0]): - build_opts += f' --bind {mount}' + build_opts += f' --bind {shlex.quote(mount)}' cmd_prefix = "sudo " if is_true( env.get( diff --git a/script/build-apptainerfile/customize.py b/script/build-apptainerfile/customize.py index 30f7c0e4f..c8aac4d08 100644 --- a/script/build-apptainerfile/customize.py +++ b/script/build-apptainerfile/customize.py @@ -335,15 +335,27 @@ def preprocess(i): MKBIND_SH = """ mlc_mkbind() { - _p="${APPTAINER_ROOTFS}"; _rest="${1#/}" + # Walk the container path, resolving symlinks against the rootfs (never the host). + _cur=""; _rest="${1#/}"; _links=0 while [ -n "$_rest" ]; do _c="${_rest%%/*}" case "$_rest" in */*) _rest="${_rest#*/}" ;; *) _rest="" ;; esac - if [ -z "$_c" ] || [ "$_c" = "." ]; then continue; fi - _p="$_p/$_c" + case "$_c" in + ""|.) continue ;; + ..) _cur="${_cur%/*}"; continue ;; + esac + _p="${APPTAINER_ROOTFS}$_cur/$_c" if [ -L "$_p" ]; then - echo "Skipping bind point $1: $_p is a symlink"; return 0 - elif [ -z "$_rest" ] && [ "$2" = "file" ]; then + _links=$((_links + 1)) + if [ "$_links" -gt 40 ]; then + echo "ERROR: too many symlinks resolving bind point $1" >&2; return 1 + fi + _t=$(readlink "$_p") + case "$_t" in /*) _cur=""; _t="${_t#/}" ;; esac + _rest="$_t${_rest:+/$_rest}" + continue + fi + if [ -z "$_rest" ] && [ "$2" = "file" ]; then if [ ! -e "$_p" ]; then : > "$_p" elif [ ! -f "$_p" ]; then @@ -354,6 +366,7 @@ def preprocess(i): elif [ ! -d "$_p" ]; then echo "Skipping bind point $1: $_p is not a directory"; return 0 fi + _cur="$_cur/$_c" done } """ diff --git a/script/get-apptainer/install-ubuntu.sh b/script/get-apptainer/install-ubuntu.sh index 214f3a01b..519c5ab6d 100644 --- a/script/get-apptainer/install-ubuntu.sh +++ b/script/get-apptainer/install-ubuntu.sh @@ -8,9 +8,19 @@ ${MLC_SUDO} apt-get update ${MLC_SUDO} apt-get install -y apptainer squashfuse fuse2fs test $? -eq 0 || exit $? -# Ubuntu 24.04+ blocks unprivileged userns; the packaged profile (abi 3.0, no userns rule) is not enough on newer kernels. -if [ "$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null)" = "1" ] && ! grep -qE '^\s*userns,' /etc/apparmor.d/apptainer 2>/dev/null; then - ${MLC_SUDO} tee /etc/apparmor.d/apptainer > /dev/null <<'EOF' +# Ubuntu 24.04+ blocks unprivileged userns unless apptainer's AppArmor profile grants `userns`. +AA_PROFILE=/etc/apparmor.d/apptainer +AA_LOCAL=/etc/apparmor.d/local/apptainer +aa_has_userns() { + ${MLC_SUDO} apparmor_parser -p "${AA_PROFILE}" 2>/dev/null | grep -qE '^\s*userns\s*,' +} +if [ "$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null)" = "1" ] && ! aa_has_userns; then + if [ ! -f "${AA_PROFILE}" ] || [[ "${MLC_APPTAINER_REPLACE_APPARMOR_PROFILE,,}" =~ ^(1|yes|true|on)$ ]]; then + if [ -f "${AA_PROFILE}" ]; then + ${MLC_SUDO} cp -p "${AA_PROFILE}" /var/backups/apparmor-apptainer.mlc-bak + echo "Backed up ${AA_PROFILE} to /var/backups/apparmor-apptainer.mlc-bak" + fi + ${MLC_SUDO} tee "${AA_PROFILE}" > /dev/null <<'EOF' abi , include profile apptainer /usr/libexec/apptainer/bin/starter{,-suid} flags=(unconfined) { @@ -18,11 +28,25 @@ profile apptainer /usr/libexec/apptainer/bin/starter{,-suid} flags=(unconfined) include if exists } EOF - ${MLC_SUDO} apparmor_parser -r /etc/apparmor.d/apptainer - test $? -eq 0 || exit $? + elif grep -qE 'flags=\(\s*unconfined\s*\)' "${AA_PROFILE}" && grep -qE 'include if exists ' "${AA_PROFILE}"; then + # Unconfined profile: raising its ABI to 4.0 (needed for the userns rule) cannot add restrictions. + ${MLC_SUDO} sed -i -E 's|^(\s*abi\s*\s*,)|\14.0\2|' "${AA_PROFILE}" + ${MLC_SUDO} mkdir -p "$(dirname "${AA_LOCAL}")" + echo 'userns,' | ${MLC_SUDO} tee -a "${AA_LOCAL}" > /dev/null + else + echo "WARNING: ${AA_PROFILE} is a confined or customised profile; leaving it unchanged." >&2 + echo " Grant 'userns,' to it manually, or set MLC_APPTAINER_REPLACE_APPARMOR_PROFILE=yes to replace it." >&2 + fi + if aa_has_userns; then + ${MLC_SUDO} apparmor_parser -r "${AA_PROFILE}" + fi fi echo "apparmor_restrict_unprivileged_userns=$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null || echo n/a)" -grep -H userns /etc/apparmor.d/apptainer 2>/dev/null || echo "apptainer AppArmor profile has no userns rule" +if aa_has_userns; then + echo "apptainer AppArmor profile grants userns" +else + echo "apptainer AppArmor profile does not grant userns" +fi # Print version apptainer --version From ea51cb4462ea15830d035e3db799bdb0fefc513f Mon Sep 17 00:00:00 2001 From: arjunsuresh Date: Fri, 6 Nov 2026 19:40:09 +0530 Subject: [PATCH 19/19] get-phoronix-test-suite: check all required php extensions; libfftw3-dev: per-PM version probe and env key fix; apptainer AppArmor profile covers CLI --- script/get-apptainer/install-ubuntu.sh | 2 +- script/get-generic-sys-util/meta.yaml | 13 +++++++++---- script/get-phoronix-test-suite/run.sh | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/script/get-apptainer/install-ubuntu.sh b/script/get-apptainer/install-ubuntu.sh index 519c5ab6d..a0c56a9b7 100644 --- a/script/get-apptainer/install-ubuntu.sh +++ b/script/get-apptainer/install-ubuntu.sh @@ -23,7 +23,7 @@ if [ "$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null)" ${MLC_SUDO} tee "${AA_PROFILE}" > /dev/null <<'EOF' abi , include -profile apptainer /usr/libexec/apptainer/bin/starter{,-suid} flags=(unconfined) { +profile apptainer /usr/{bin/apptainer,libexec/apptainer/bin/starter{,-suid}} flags=(unconfined) { userns, include if exists } diff --git a/script/get-generic-sys-util/meta.yaml b/script/get-generic-sys-util/meta.yaml index b46a97922..ff1a3b648 100644 --- a/script/get-generic-sys-util/meta.yaml +++ b/script/get-generic-sys-util/meta.yaml @@ -561,15 +561,20 @@ variations: zypper: eigen3-devel libfftw3-dev: env: - MLC_SYS_UTIL_NAME: libfftw3-dev - # Grouped so detect.sh's '> tmp-ver.out' captures whichever probe succeeds (apt / rpm-based / pacman). - MLC_SYS_UTIL_VERSION_CMD: "{ dpkg -s libfftw3-dev 2>/dev/null | grep 'Version' || rpm -q --qf 'Version: %{VERSION}\\n' fftw-devel 2>/dev/null | grep 'Version' || pacman -Q fftw 2>/dev/null; }" + MLC_SYS_UTIL_NAME: libfftw3_dev + MLC_SYS_UTIL_VERSION_CMD: >- + case "${MLC_HOST_OS_PACKAGE_MANAGER}" in + apt) dpkg -s libfftw3-dev | grep '^Version:' ;; + dnf|yum|zypper) rpm -q --qf '%{VERSION}\n' fftw-devel ;; + pacman) pacman -Q fftw ;; + *) exit 1 ;; + esac MLC_SYS_UTIL_VERSION_RE: ([0-9]+(\.[0-9]+)+) MLC_TMP_VERSION_DETECT_GROUP_NUMBER: 1 new_env_keys: - MLC_LIBFFTW3_DEV_VERSION state: - libfftw3-dev: + libfftw3_dev: apt: libfftw3-dev dnf: fftw-devel yum: fftw-devel diff --git a/script/get-phoronix-test-suite/run.sh b/script/get-phoronix-test-suite/run.sh index 3c7217bb7..6c210b5c7 100755 --- a/script/get-phoronix-test-suite/run.sh +++ b/script/get-phoronix-test-suite/run.sh @@ -51,8 +51,8 @@ if [ "${MLC_PHORONIX_DO_PORTABLE_INSTALL}" == "yes" ]; then [ -n "${src}" ] || { echo "ERROR: phoronix source dir missing"; exit 1; } cp -a "${src}" "${PREFIX}/phoronix-test-suite" - # Reuse the node's php when it already has the XML/mbstring extensions PTS needs. - if command -v php >/dev/null 2>&1 && php -m 2>/dev/null | grep -qx dom && php -m 2>/dev/null | grep -qx mbstring; then + # Reuse the node's php only when it has every extension PTS needs. + if command -v php >/dev/null 2>&1 && php -r 'exit(extension_loaded("dom") && function_exists("simplexml_load_string") && (extension_loaded("zip") || extension_loaded("zlib")) && function_exists("json_decode") && extension_loaded("mbstring") ? 0 : 1);' 2>/dev/null; then echo "Using system php: $(command -v php)" cat > "${PREFIX}/bin/phoronix-test-suite" <