Revert "[CI] Use setup-python from for Mac tests (#155698)"

This reverts commit 2b9d638e33.

Reverted https://github.com/pytorch/pytorch/pull/155698 on behalf of https://github.com/malfet due to It causes weird flaky failures in MPS and do not upload usage logs anymore ([comment](https://github.com/pytorch/pytorch/pull/155698#issuecomment-2967120676))
This commit is contained in:
PyTorch MergeBot 2025-06-12 14:42:32 +00:00
parent 0fd711df19
commit 2a3b41cbd0
4 changed files with 33 additions and 24 deletions

View File

@ -5,6 +5,11 @@ set -x
# shellcheck source=./macos-common.sh
source "$(dirname "${BASH_SOURCE[0]}")/macos-common.sh"
if [[ -n "$CONDA_ENV" ]]; then
# Use binaries under conda environment
export PATH="$CONDA_ENV/bin":$PATH
fi
# Test that OpenMP is enabled
pushd test
if [[ ! $(python -c "import torch; print(int(torch.backends.openmp.is_available()))") == "1" ]]; then

View File

@ -60,6 +60,8 @@ jobs:
test:
# Don't run on forked repos or empty test matrix
if: github.repository_owner == 'pytorch' && toJSON(fromJSON(inputs.test-matrix).include) != '[]'
# For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179
# Also ensure that we always run with the right architecture
defaults:
run:
shell: bash -e -l {0}
@ -122,8 +124,8 @@ jobs:
MONITOR_LOG_INTERVAL: ${{ inputs.monitor-log-interval }}
MONITOR_DATA_COLLECT_INTERVAL: ${{ inputs.monitor-data-collect-interval }}
run: |
python3 -m pip install psutil==5.9.1 dataclasses_json==0.6.7
python3 -m tools.stats.monitor --log-interval "$MONITOR_LOG_INTERVAL" --data-collect-interval "$MONITOR_DATA_COLLECT_INTERVAL" > usage_log.txt 2>&1 &
${CONDA_RUN} python3 -m pip install psutil==5.9.1 dataclasses_json==0.6.7
${CONDA_RUN} python3 -m tools.stats.monitor --log-interval "$MONITOR_LOG_INTERVAL" --data-collect-interval "$MONITOR_DATA_COLLECT_INTERVAL" > usage_log.txt 2>&1 &
echo "monitor-script-pid=${!}" >> "${GITHUB_OUTPUT}"
- name: Download build artifacts
@ -138,10 +140,11 @@ jobs:
with:
use-gha: true
- name: Setup Python
uses: pytorch/test-infra/.github/actions/setup-python@main
- name: Setup miniconda
uses: pytorch/test-infra/.github/actions/setup-miniconda@main
with:
python-version: ${{ inputs.python-version }}
environment-file: .github/requirements/conda-env-macOS-ARM64
pip-requirements-file: .github/requirements/pip-requirements-macOS.txt
default-packages: ""
@ -194,32 +197,37 @@ jobs:
# shellcheck disable=SC1090
set -ex
# TODO: Remove me later, and properly activate venv
PATH="$(dirname "$(which python)"):$PATH"
export PATH
arch
if [[ -n "$CONDA_ENV" ]]; then
# Use binaries under conda environment
export PATH="$CONDA_ENV/bin":$PATH
fi
# Print out some information about the test environment
for tool in python3 python; do
which $tool
$tool --version
done
which conda
conda --version
${CONDA_RUN} which python3
${CONDA_RUN} python3 --version
${CONDA_RUN} which python
${CONDA_RUN} python --version
python3 -mpip install --no-index --no-deps dist/*.whl
${CONDA_RUN} python3 -mpip install --no-index --no-deps dist/*.whl
set +e
pushd "${RUNNER_TEMP}"
# Install pip dependencies if they are not found. This is to mitigate a peculiar
# flaky missing dependencies on MacOS
python3 -c "import torch"
${CONDA_RUN} python3 -c "import torch"
RC=$?
popd
if [ "${RC}" -ne 0 ]; then
python3 -mpip install --ignore-installed -r "${PIP_REQUIREMENTS_FILE}"
${CONDA_RUN} python3 -mpip install --ignore-installed -r "${PIP_REQUIREMENTS_FILE}"
fi
set -e
.ci/pytorch/macos-test.sh
${CONDA_RUN} .ci/pytorch/macos-test.sh
- name: Print remaining test logs
shell: bash
@ -231,7 +239,11 @@ jobs:
shell: bash
if: ${{ contains(steps.get-job-id.outputs.job-name, 'mps') }}
run: |
python3 test/bench_mps_ops.py
if [[ -n "$CONDA_ENV" ]]; then
# Use binaries under conda environment
export PATH="$CONDA_ENV/bin":$PATH
fi
${CONDA_RUN} python3 test/bench_mps_ops.py
- name: Stop monitoring script

View File

@ -74,10 +74,6 @@ class TestCppExtensionOpenRgistration(common.TestCase):
torch.utils.generate_methods_for_privateuse1_backend(for_storage=True)
@unittest.skipIf(
common.IS_MACOS,
"Hangs on shutdown, see https://github.com/pytorch/pytorch/issues/155759",
)
def test_base_device_registration(self):
self.assertFalse(self.module.custom_add_called())
# create a tensor using our custom device object

View File

@ -451,10 +451,6 @@ class TestMultiprocessing(TestCase):
TEST_WITH_ASAN,
"seems to hang with ASAN, see https://github.com/pytorch/pytorch/issues/5326",
)
@unittest.skipIf(
IS_MACOS,
"seems to hang after completion on MacOS",
)
def test_fs_sharing(self):
with fs_sharing():
# The test works but is very slow on MacOS, see https://github.com/pytorch/pytorch/pull/93183,