diff --git a/.github/workflows/run-tests-on-modified-meta.yml b/.github/workflows/run-tests-on-modified-meta.yml index 0925895a1..6e6c41b20 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/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 2f9167b4d..1953991dd 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' @@ -68,33 +68,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 2a35d3440..ff8dc32c5 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' @@ -32,7 +32,7 @@ on: workflow_dispatch: {} jobs: - mlc-run-with-results-upload: + mlc-run: runs-on: ${{ matrix.os }} env: MLC_INDEX: "on" @@ -85,50 +85,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 diff --git a/script/app-mlperf-inference-mlcommons-python/meta.yaml b/script/app-mlperf-inference-mlcommons-python/meta.yaml index e327850c0..95aefbfd7 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 @@ -1071,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 @@ -1090,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: diff --git a/script/benchmark-program-phoronix/run.sh b/script/benchmark-program-phoronix/run.sh index d4e9599ff..e5083fc69 100644 --- a/script/benchmark-program-phoronix/run.sh +++ b/script/benchmark-program-phoronix/run.sh @@ -45,11 +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" -if [ ! -f "${PTS_USER_DIR}/user-config.xml" ]; then +# --- 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}/" +# 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' @@ -100,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}" @@ -131,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}" 2>&1 | tee "${OUTPUT_FILE}" + "${PTS}" benchmark ${MLC_PHORONIX_EXTRA_ARGS} "${MLC_PHORONIX_TEST}" <&3 2>&1 | tee "${OUTPUT_FILE}" fi exitstatus=${PIPESTATUS[0]} @@ -159,7 +169,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/build-apptainer-image/customize.py b/script/build-apptainer-image/customize.py index 04e89c5d8..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 * @@ -77,6 +78,16 @@ 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 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 {shlex.quote(mount)}' + cmd_prefix = "sudo " if is_true( env.get( "MLC_APPTAINER_BUILD_WITH_SUDO", 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' diff --git a/script/build-apptainerfile/customize.py b/script/build-apptainerfile/customize.py index 2700472ea..c8aac4d08 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,10 +282,24 @@ def preprocess(i): f.write(f" {post_cmd}\n") f.write("\n") + # 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") + # %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: + 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( @@ -293,7 +308,8 @@ def preprocess(i): f.write("\n") elif use_copy_repo: repo_name = os.path.basename(mlc_repo_path) - f.write("%setup\n") + 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") @@ -318,6 +334,65 @@ def preprocess(i): return {'return': 0} +MKBIND_SH = """ mlc_mkbind() { + # 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 + case "$_c" in + ""|.) continue ;; + ..) _cur="${_cur%/*}"; continue ;; + esac + _p="${APPTAINER_ROOTFS}$_cur/$_c" + if [ -L "$_p" ]; 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 + 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 + _cur="$_cur/$_c" + done + } +""" + + +def get_bind_destinations(bind_mounts): + """(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() + if not spec: + continue + parts = spec.split(':') + dest = parts[1] if len(parts) > 1 and parts[1] else parts[0] + 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 + + 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..dfdacb904 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 @@ -95,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' diff --git a/script/get-apptainer/install-ubuntu.sh b/script/get-apptainer/install-ubuntu.sh index 8a7036669..a0c56a9b7 100644 --- a/script/get-apptainer/install-ubuntu.sh +++ b/script/get-apptainer/install-ubuntu.sh @@ -4,9 +4,50 @@ ${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 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/{bin/apptainer,libexec/apptainer/bin/starter{,-suid}} flags=(unconfined) { + userns, + include if exists +} +EOF + 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)" +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 diff --git a/script/get-generic-sys-util/meta.yaml b/script/get-generic-sys-util/meta.yaml index 34d786258..ff1a3b648 100644 --- a/script/get-generic-sys-util/meta.yaml +++ b/script/get-generic-sys-util/meta.yaml @@ -561,9 +561,20 @@ variations: zypper: eigen3-devel libfftw3-dev: env: - MLC_SYS_UTIL_NAME: libfftw3-dev + 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 @@ -1228,8 +1239,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: diff --git a/script/get-phoronix-test-suite/run.sh b/script/get-phoronix-test-suite/run.sh index 48b94fa2c..6c210b5c7 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 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" </dev/null 2>&1 \ && echo "Portable install OK: ${PREFIX}/bin/phoronix-test-suite" \ 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', '') != '':