8000 Add linux cpu test for 3.12 (#117853) · pytorch/pytorch@244b124 · GitHub
[go: up one dir, main page]

Skip to content

Commit 244b124

Browse files
atalmanalbanD
authored andcommitted
Add linux cpu test for 3.12 (#117853)
This is continuation of work: #113987 Co-authored-by: albanD <desmaison.alban@gmail.com> Pull Request resolved: #117853 Approved by: https://github.com/albanD
1 parent bb67a28 commit 244b124

38 files changed

+205
-21
lines changed

.ci/docker/common/install_conda.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ if [ -n "$ANACONDA_PYTHON_VERSION" ]; then
5252

5353
# Install PyTorch conda deps, as per https://github.com/pytorch/pytorch README
5454
CONDA_COMMON_DEPS="astunparse pyyaml mkl=2021.4.0 mkl-include=2021.4.0 setuptools"
55-
if [ "$ANACONDA_PYTHON_VERSION" = "3.11" ]; then
56-
conda_install numpy=1.23.5 ${CONDA_COMMON_DEPS}
55+
if [ "$ANACONDA_PYTHON_VERSION" = "3.11" ] || [ "$ANACONDA_PYTHON_VERSION" = "3.12" ]; then
56+
conda_install numpy=1.26.0 ${CONDA_COMMON_DEPS}
5757
else
58+
5859
conda_install numpy=1.21.2 ${CONDA_COMMON_DEPS}
5960
fi
6061

.ci/docker/common/install_triton.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,6 @@ if [ -n "${CONDA_CMAKE}" ]; then
6464
# latest numpy version, which fails ASAN tests with the following import error: Numba
6565
# needs NumPy 1.20 or less.
6666
conda_reinstall cmake="${CMAKE_VERSION}"
67-
conda_reinstall numpy="${NUMPY_VERSION}"
67+
# Note that we install numpy with pip as conda might not have the version we want
68+
pip_install --force-reinstall numpy=="${NUMPY_VERSION}"
6869
fi

.ci/docker/requirements-ci.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ click
1515
#Pinned versions:
1616
#test that import:
1717

18-
coremltools==5.0b5
18+
coremltools==5.0b5 ; python_version < "3.12"
1919
#Description: Apple framework for ML integration
2020
#Pinned versions: 5.0b5
2121
#test that import:
@@ -273,9 +273,9 @@ rockset==1.0.3
273273
#Pinned versions: 1.0.3
274274
#test that import:
275275

276-
ghstack==0.7.1
276+
ghstack==0.8.0
277277
#Description: ghstack tool
278-
#Pinned versions: 0.7.1
278+
#Pinned versions: 0.8.0
279279
#test that import:
280280

281281
jinja2==3.1.3
@@ -298,7 +298,8 @@ tensorboard==2.13.0
298298
#Pinned versions:
299299
#test that import: test_tensorboard
300300

301-
pywavelets==1.4.1
301+
pywavelets==1.4.1 ; python_version < "3.12"
302+
pywavelets==1.5.0 ; python_version >= "3.12"
302303
#Description: This is a requirement of scikit-image, we need to pin
303304
# it here because 1.5.0 conflicts with numpy 1.21.2 used in CI
304305
#Pinned versions: 1.4.1

.ci/pytorch/build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ if ! which conda; then
8282
fi
8383
else
8484
export CMAKE_PREFIX_PATH=/opt/conda
85+
86+
# Workaround required for MKL library linkage
87+
# https://github.com/pytorch/pytorch/issues/119557
88+
if [ "$ANACONDA_PYTHON_VERSION" = "3.12" ]; then
89+
export CMAKE_LIBRARY_PATH="/opt/conda/envs/py_$ANACONDA_PYTHON_VERSION/lib/"
90+
export CMAKE_INCLUDE_PATH="/opt/conda/envs/py_$ANACONDA_PYTHON_VERSION/include/"
91+
fi
8592
fi
8693

8794
if [[ "$BUILD_ENVIRONMENT" == *libtorch* ]]; then

.github/workflows/docker-builds.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
- docker-image-name: pytorch-linux-focal-cuda11.8-cudnn8-py3-gcc9
4444
- docker-image-name: pytorch-linux-focal-py3.8-clang10
4545
- docker-image-name: pytorch-linux-focal-py3.11-clang10
46+
- docker-image-name: pytorch-linux-focal-py3 F987 .12-clang10
4647
- docker-image-name: pytorch-linux-focal-rocm-n-1-py3
4748
- docker-image-name: pytorch-linux-focal-rocm-n-py3
4849
- docker-image-name: pytorch-linux-jammy-cuda11.8-cudnn8-py3.8-clang12

.github/workflows/pull.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,29 @@ jobs:
179179
docker-image: ${{ needs.linux-focal-py3_11-clang10-build.outputs.docker-image }}
180180
test-matrix: ${{ needs.linux-focal-py3_11-clang10-build.outputs.test-matrix }}
181181

182+
linux-focal-py3_12-clang10-build:
183+
name: linux-focal-py3.12-clang10
184+
uses: ./.github/workflows/_linux-build.yml
185+
with:
186+
build-environment: linux-focal-py3.12-clang10
187+
docker-image-name: pytorch-linux-focal-py3.12-clang10
188+
test-matrix: |
189+
{ include: [
190+
{ config: "default", shard: 1, num_shards: 3, runner: "linux.2xlarge" },
191+
{ config: "default", shard: 2, num_shards: 3, runner: "linux.2xlarge" },
192+
{ config: "default", shard: 3, num_shards: 3, runner: "linux.2xlarge" },
193+
]}
194+
195+
linux-focal-py3_12-clang10-test:
196+
name: linux-focal-py3.12-clang10
197+
uses: ./.github/workflows/_linux-test.yml
198+
needs: linux-focal-py3_12-clang10-build
199+
with:
200+
build-environment: linux-focal-py3.12-clang10
201+
docker-image: ${{ needs.linux-focal-py3_12-clang10-build.outputs.docker-image }}
202+
test-matrix: ${{ needs.linux-focal-py3_12-clang10-build.outputs.test-matrix }}
203+
timeout-minutes: 600
204+
182205
linux-focal-cuda11_8-py3_10-gcc9-build:
183206
name: linux-focal-cuda11.8-py3.10-gcc9
184207
uses: ./.github/workflows/_linux-build.yml

test/ao/sparsity/test_structured_sparsifier.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def _check_pruner_valid_after_step(self, model, pruner, mask, device) 1241 :
204204
def _test_constructor_on_device(self, model, device):
205205
self.assertRaisesRegex(
206206
TypeError,
207-
"BaseStructuredSparsifier.* update_mask",
207+
"BaseStructuredSparsifier.*update_mask",
208208
BaseStructuredSparsifier,
209209
)
210210
model1 = copy.deepcopy(model).to(device)

test/custom_operator/test_custom_ops.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ def test_op_with_incorrect_abstract_impl_pystub(self):
3232
torch.ops.custom.cos(x)
3333

3434
@unittest.skipIf(IS_WINDOWS, "torch.compile not supported on windows")
35+
@unittest.skipIf(
36+
sys.version_info >= (3, 12), "torch.compile is not supported on python 3.12+"
37+
)
3538
def test_dynamo_pystub_suggestion(self):
3639
x = torch.randn(3)
3740

test/dynamo/test_activation_checkpointing.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Owner(s): ["module: dynamo"]
22
import functools
33
import math
4-
import unittest
4+
import sys
5+
import unittest # noqa: F811
56
from importlib import import_module
67

78
import torch
@@ -492,6 +493,9 @@ def fn(x, y):
492493

493494
@requires_cuda
494495
@unittest.skipIf(IS_WINDOWS, "torch.compile doesn't work with windows")
496+
@unittest.skipIf(
497+
sys.version_info >= (3, 12), "torch.compile is not supported on python 3.12+"
498+
)
495499
@torch._dynamo.config.patch(
496500
"_experimental_support_context_fn_in_torch_utils_checkpoint", True
497501
)
@@ -542,6 +546,9 @@ def fn(x, y):
542546

543547
@requires_cuda
544548
@unittest.skipIf(IS_WINDOWS, "torch.compile doesn't work with windows")
549+
@unittest.skipIf(
550+
sys.version_info >= (3, 12), "torch.compile is not supported on python 3.12+"
551+
)
545552
@torch._dynamo.config.patch(
546553
"_experimental_support_context_fn_in_torch_utils_checkpoint", True
547554
)
@@ -595,6 +602,9 @@ def fn(x, y):
595602

596603
@requires_cuda
597604
@unittest.skipIf(IS_WINDOWS, "torch.compile doesn't work with windows")
605+
@unittest.skipIf(
606+
sys.version_info >= (3, 12), "torch.compile is not supported on python 3.12+"
607+
)
598608
@torch._dynamo.config.patch(
599609
"_experimental_support_context_fn_in_torch_utils_checkpoint", True
600610
)
@@ -663,6 +673,9 @@ def fn(x, y):
663673

664674
@requires_cuda
665675
@unittest.skipIf(IS_WINDOWS, "torch.compile doesn't work with windows")
676+
@unittest.skipIf(
677+
sys.version_info >= (3, 12), "torch.compile is not supported on python 3.12+"
678+
)
666679
@torch._dynamo.config.patch(
667680
"_experimental_support_context_fn_in_torch_utils_checkpoint", True
668681
)
@@ -712,6 +725,9 @@ def fn(x, y):
712725

713726
@requires_cuda
714727
@unittest.skipIf(IS_WINDOWS, "torch.compile doesn't work with windows")
728+
@unittest.skipIf(
729+
sys.version_info >= (3, 12), "torch.compile is not supported on python 3.12+"
730+
)
715731
@torch._dynamo.config.patch(
716732
"_experimental_support_context_fn_in_torch_utils_checkpoint", True
717733
)
@@ -760,6 +776,9 @@ def fn(x, y):
760776

761777
@requires_cuda
762778
@unittest.skipIf(IS_WINDOWS, "torch.compile doesn't work with windows")
779+
@unittest.skipIf(
780+
sys.version_info >= (3, 12), "torch.compile is not supported on python 3.12+"
781+
)
763782
@unittest.skip(
764783
"In-place op support in selective checkpointing + torch.compile "
765784
"requires TorchDispatchMode + torch.compile work to complete"
@@ -814,6 +833,9 @@ def fn(x, y):
814833

815834
@requires_cuda
816835
@unittest.skipIf(IS_WINDOWS, "torch.compile doesn't work with windows")
836+
@unittest.skipIf(
837+
sys.version_info >= (3, 12), "torch.compile is not supported on python 3.12+"
838+
)
817839
@torch._dynamo.config.patch(
818840
"_experimental_support_context_fn_in_torch_utils_checkpoint", True
819841
)
@@ -875,6 +897,9 @@ def fn(x):
875897
self._compare_orig_and_checkpointed_fns(gn, fn, x)
876898

877899
@unittest.skipIf(IS_WINDOWS, "torch.compile doesn't work with windows")
900+
@unittest.skipIf(
901+
sys.version_info >= (3, 12), "torch.compile is not supported on python 3.12+"
902+
)
878903
@torch._dynamo.config.patch(
879904
"_experimental_support_context_fn_in_torch_utils_checkpoint", True
880905
)

test/functorch/test_eager_transforms.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4760,7 +4760,10 @@ class TestCompileTransforms(TestCase):
47604760
@skipIfRocm(msg="test leaks memory on ROCm")
47614761
# torch.compile is not supported on Windows
47624762
# Triton only supports GPU with SM70 or later.
4763-
@expectedFailureIf((IS_ARM64 and not IS_MACOS) or IS_WINDOWS or (TEST_CUDA and not SM70OrLater))
4763+
@expectedFailureIf((IS_ARM64 and not IS_MACOS) or
4764+
IS_WINDOWS or
4765+
(TEST_CUDA and not SM70OrLater) or
4766+
(sys.version_info >= (3, 12)))
47644767
def test_compile_vmap_hessian(self, device):
47654768
# The model and inputs are a smaller version
47664769
# of code at benchmark repo:
@@ -4789,8 +4792,8 @@ def predict(params_and_buffers, x):
47894792
actual = opt_fn(params_and_buffers, x)
47904793
self.assertEqual(actual, expected)
47914794

4792-
# torch.compile is not supported on Windows
4793-
@expectedFailureIf(IS_WINDOWS)
4795+
# torch.compile is not supported on Windows or on Python 3.12+
4796+
@expectedFailureIf(IS_WINDOWS or (sys.version_info >= (3, 12)))
47944797
@torch._dynamo.config.patch(suppress_errors=False)
47954798
@torch._dynamo.config.patch(capture_func_transforms=True)
47964799
@skipIfTorchDynamo("Do not test torch.compile on top of torch.compile")

0 commit comments

Comments
 (0)
0