diff --git a/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0-foss-2023b.eb b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0-foss-2023b.eb new file mode 100644 index 000000000000..ca28c8dcea6f --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0-foss-2023b.eb @@ -0,0 +1,191 @@ +name = 'PyTorch' +version = '2.3.0' + +homepage = 'https://pytorch.org/' +description = """Tensors and Dynamic neural networks in Python with strong GPU acceleration. +PyTorch is a deep learning framework that puts Python first.""" + +toolchain = {'name': 'foss', 'version': '2023b'} + +source_urls = [GITHUB_RELEASE] +sources = ['%(namelower)s-v%(version)s.tar.gz'] +patches = [ + 'PyTorch-1.7.0_disable-dev-shm-test.patch', + 'PyTorch-1.12.1_add-hypothesis-suppression.patch', + 'PyTorch-1.12.1_fix-test_cpp_extensions_jit.patch', + 'PyTorch-1.12.1_fix-TestTorch.test_to.patch', + 'PyTorch-1.12.1_skip-test_round_robin.patch', + 'PyTorch-1.13.1_fix-gcc-12-warning-in-fbgemm.patch', + 'PyTorch-1.13.1_fix-protobuf-dependency.patch', + 'PyTorch-1.13.1_fix-warning-in-test-cpp-api.patch', + 'PyTorch-1.13.1_skip-failing-singular-grad-test.patch', + 'PyTorch-1.13.1_skip-tests-without-fbgemm.patch', + 'PyTorch-2.0.1_avoid-test_quantization-failures.patch', + 'PyTorch-2.0.1_fix-skip-decorators.patch', + 'PyTorch-2.0.1_fix-vsx-loadu.patch', + 'PyTorch-2.0.1_skip-failing-gradtest.patch', + 'PyTorch-2.0.1_skip-test_shuffle_reproducibility.patch', + 'PyTorch-2.0.1_skip-tests-skipped-in-subprocess.patch', + 'PyTorch-2.1.0_fix-vsx-vector-shift-functions.patch', + 'PyTorch-2.1.0_increase-tolerance-functorch-test_vmapvjpvjp.patch', + 'PyTorch-2.1.0_remove-test-requiring-online-access.patch', + 'PyTorch-2.1.0_skip-diff-test-on-ppc.patch', + 'PyTorch-2.1.0_skip-dynamo-test_predispatch.patch', + 'PyTorch-2.1.0_skip-test_jvp_linalg_det_singular.patch', + 'PyTorch-2.1.2_skip-cpu_repro-test-without-vectorization.patch', + 'PyTorch-2.1.2_workaround_dynamo_failure_without_nnpack.patch', + 'PyTorch-2.3.0_disable_test_linear_package_if_no_half_types_are_available.patch', + 'PyTorch-2.3.0_disable_DataType_dependent_test_if_tensorboard_is_not_available.patch', + 'PyTorch-2.3.0_skip-test_init_from_local_shards.patch', + 'PyTorch-2.3.0_no-cuda-stubs-rpath.patch', + 'PyTorch-2.3.0_disable-gcc12-warning.patch', + 'PyTorch-2.3.0_fix-test_extension_backend-without-vectorization.patch', + 'PyTorch-2.3.0_disable_tests_which_need_network_download.patch', + 'PyTorch-2.3.0_avoid_caffe2_test_cpp_jit.patch', + 'PyTorch-2.3.0_fix_missing_masked_load_for_int_type.patch', + 'PyTorch-2.3.0_skip_test_var_mean_differentiable.patch', + 'PyTorch-2.3.0_skip_test_sdpa_nn_functional_scaled_dot_product_attention_cpu.patch', + 'PyTorch-2.3.0_fix-mkldnn-avx512-f32-bias.patch', +] +checksums = [ + {'pytorch-v2.3.0.tar.gz': '69579513b26261bbab32e13b7efc99ad287fcf3103087f2d4fdf1adacd25316f'}, + {'PyTorch-1.7.0_disable-dev-shm-test.patch': '622cb1eaeadc06e13128a862d9946bcc1f1edd3d02b259c56a9aecc4d5406b8a'}, + {'PyTorch-1.12.1_add-hypothesis-suppression.patch': + 'e71ffb94ebe69f580fa70e0de84017058325fdff944866d6bd03463626edc32c'}, + {'PyTorch-1.12.1_fix-test_cpp_extensions_jit.patch': + '1efc9850c431d702e9117d4766277d3f88c5c8b3870997c9974971bce7f2ab83'}, + {'PyTorch-1.12.1_fix-TestTorch.test_to.patch': '75f27987c3f25c501e719bd2b1c70a029ae0ee28514a97fe447516aee02b1535'}, + {'PyTorch-1.12.1_skip-test_round_robin.patch': '63d4849b78605aa088fdff695637d9473ea60dee603a3ff7f788690d70c55349'}, + {'PyTorch-1.13.1_fix-gcc-12-warning-in-fbgemm.patch': + '5c7be91a6096083a0b1315efe0001537499c600f1f569953c6a2c7f4cc1d0910'}, + {'PyTorch-1.13.1_fix-protobuf-dependency.patch': + '8bd755a0cab7233a243bc65ca57c9630dfccdc9bf8c9792f0de4e07a644fcb00'}, + {'PyTorch-1.13.1_fix-warning-in-test-cpp-api.patch': + 'bdde0f2105215c95a54de64ec4b1a4520528510663174fef6d5b900eb1db3937'}, + {'PyTorch-1.13.1_skip-failing-singular-grad-test.patch': + '72688a57b2bb617665ad1a1d5e362c5111ae912c10936bb38a089c0204729f48'}, + {'PyTorch-1.13.1_skip-tests-without-fbgemm.patch': + '481e595f673baf8ae58b41697a6792b83048b0264aa79b422f48cd8c22948bb7'}, + {'PyTorch-2.0.1_avoid-test_quantization-failures.patch': + '02e3f47e4ed1d7d6077e26f1ae50073dc2b20426269930b505f4aefe5d2f33cd'}, + {'PyTorch-2.0.1_fix-skip-decorators.patch': '2039012cef45446065e1a2097839fe20bb29fe3c1dcc926c3695ebf29832e920'}, + {'PyTorch-2.0.1_fix-vsx-loadu.patch': 'a0ffa61da2d47c6acd09aaf6d4791e527d8919a6f4f1aa7ed38454cdcadb1f72'}, + {'PyTorch-2.0.1_skip-failing-gradtest.patch': '8030bdec6ba49b057ab232d19a7f1a5e542e47e2ec340653a246ec9ed59f8bc1'}, + {'PyTorch-2.0.1_skip-test_shuffle_reproducibility.patch': + '7047862abc1abaff62954da59700f36d4f39fcf83167a638183b1b7f8fec78ae'}, + {'PyTorch-2.0.1_skip-tests-skipped-in-subprocess.patch': + '166c134573a95230e39b9ea09ece3ad8072f39d370c9a88fb2a1e24f6aaac2b5'}, + {'PyTorch-2.1.0_fix-vsx-vector-shift-functions.patch': + '3793b4b878be1abe7791efcbd534774b87862cfe7dc4774ca8729b6cabb39e7e'}, + {'PyTorch-2.1.0_increase-tolerance-functorch-test_vmapvjpvjp.patch': + 'aef38adf1210d0c5455e91d7c7a9d9e5caad3ae568301e0ba9fc204309438e7b'}, + {'PyTorch-2.1.0_remove-test-requiring-online-access.patch': + '35184b8c5a1b10f79e511cc25db3b8a5585a5d58b5d1aa25dd3d250200b14fd7'}, + {'PyTorch-2.1.0_skip-diff-test-on-ppc.patch': '394157dbe565ffcbc1821cd63d05930957412156cc01e949ef3d3524176a1dda'}, + {'PyTorch-2.1.0_skip-dynamo-test_predispatch.patch': + '6298daf9ddaa8542850eee9ea005f28594ab65b1f87af43d8aeca1579a8c4354'}, + {'PyTorch-2.1.0_skip-test_jvp_linalg_det_singular.patch': + '5229ca88a71db7667a90ddc0b809b2c817698bd6e9c5aaabd73d3173cf9b99fe'}, + {'PyTorch-2.1.2_skip-cpu_repro-test-without-vectorization.patch': + '7ace835af60c58d9e0754a34c19d4b9a0c3a531f19e5d0eba8e2e49206eaa7eb'}, + {'PyTorch-2.1.2_workaround_dynamo_failure_without_nnpack.patch': + 'fb96eefabf394617bbb3fbd3a7a7c1aa5991b3836edc2e5d2a30e708bfe49ba1'}, + {'PyTorch-2.3.0_disable_test_linear_package_if_no_half_types_are_available.patch': + '23416f2d9d5226695ec3fbea0671e3650c655c19deefd3f0f8ddab5afa50f485'}, + {'PyTorch-2.3.0_disable_DataType_dependent_test_if_tensorboard_is_not_available.patch': + '0dcbdfde6752c3ff54c5376f521b4a742167669feb7f0f1d4e1d4d55f72b664f'}, + {'PyTorch-2.3.0_skip-test_init_from_local_shards.patch': + '90ed9c2870f57ee6dc032d00873a37e2217a2b92a13035ded1c25ad5306455f2'}, + {'PyTorch-2.3.0_no-cuda-stubs-rpath.patch': + '7ba26824b5def7379cff02ae821a080698e6affea0da45bc846e9ecb89939cb1'}, + {'PyTorch-2.3.0_disable-gcc12-warning.patch': + 'a8a624e1a2a5f4c82610173e50bd0f853e49bd5621b432f5aac689f9f6eb1514'}, + {'PyTorch-2.3.0_fix-test_extension_backend-without-vectorization.patch': + '36aa2d5ba175be17f4e996f4fb2d544fe477d4a0bd0644cd59a85063779afc8e'}, + {'PyTorch-2.3.0_disable_tests_which_need_network_download.patch': + 'b7fd1a5135dfd4098cdc054182f7bf84a23ac98462a00477712182b5442da855'}, + {'PyTorch-2.3.0_avoid_caffe2_test_cpp_jit.patch': + '041adcd91d994b8c2ab57d227f081cd57e572c157117b37171e1eb8eb576f8fc'}, + {'PyTorch-2.3.0_fix_missing_masked_load_for_int_type.patch': + 'aa6ff764f3f7bf84372a8a257fe1b4ae6dc4b9744ad35f0f9015f2696c62a41e'}, + {'PyTorch-2.3.0_skip_test_var_mean_differentiable.patch': + '9703fd0f1fca8916f6d79d83e9a7efe8e3f717362a5fdaa8f5d9da90d0c75018'}, + {'PyTorch-2.3.0_skip_test_sdpa_nn_functional_scaled_dot_product_attention_cpu.patch': + '7955f2655db3da18606574fdcbc5990be24098f49ad1db5e86ea756ea1cc506f'}, + {'PyTorch-2.3.0_fix-mkldnn-avx512-f32-bias.patch': + 'ee07d21c3ac7aeb0bd0e39507b18a417b9125284a529102929c4b5c6727c2976'}, +] + +osdependencies = [OS_PKG_IBVERBS_DEV] + +builddependencies = [ + ('CMake', '3.27.6'), + ('hypothesis', '6.90.0'), + # For tests + ('pytest-flakefinder', '1.1.0'), + ('pytest-rerunfailures', '14.0'), + ('pytest-shard', '0.1.2'), + ('tlparse', '0.3.5'), + ('optree', '0.13.0'), + ('unittest-xml-reporting', '3.1.0'), +] + +dependencies = [ + ('Ninja', '1.11.1'), # Required for JIT compilation of C++ extensions + ('Python', '3.11.5'), + ('Python-bundle-PyPI', '2023.10'), + ('protobuf', '25.3'), + ('protobuf-python', '4.25.3'), + ('pybind11', '2.11.1'), + ('SciPy-bundle', '2023.11'), + ('PyYAML', '6.0.1'), + ('MPFR', '4.2.1'), + ('GMP', '6.3.0'), + ('numactl', '2.0.16'), + ('FFmpeg', '6.0'), + ('Pillow', '10.2.0'), + ('expecttest', '0.2.1'), + ('networkx', '3.2.1'), + ('sympy', '1.12'), + ('Z3', '4.13.0',), +] + +use_pip = True +buildcmd = '%(python)s setup.py build' # Run the (long) build in the build step + +excluded_tests = { + '': [ + # This test seems to take too long on NVIDIA Ampere at least. + 'distributed/test_distributed_spawn', + # Broken on CUDA 11.6/11.7: https://github.com/pytorch/pytorch/issues/75375 + 'distributions/test_constraints', + # no xdoctest + 'doctests', + # failing on broadwell + # See https://github.com/easybuilders/easybuild-easyconfigs/issues/17712 + 'test_native_mha', + # intermittent failures on various systems + # See https://github.com/easybuilders/easybuild-easyconfigs/issues/17712 + 'distributed/rpc/test_tensorpipe_agent', + # This test is expected to fail when run in their CI, but won't in our case. + # It just checks for a "CI" env variable + 'test_ci_sanity_check_fail', + # This fails consistently and is disabled upstream + # See https://github.com/pytorch/pytorch/issues/100152 and + # https://github.com/pytorch/pytorch/pull/124712 + 'test_cpp_extensions_open_device_registration', + + ] +} + +local_test_opts = '--continue-through-error --pipe-logs --verbose %(excluded_tests)s' +runtest = 'cd test && PYTHONUNBUFFERED=1 %(python)s run_test.py ' + local_test_opts + +# Especially test_quantization has a few corner cases that are triggered by the random input values, +# those cannot be easily avoided, see https://github.com/pytorch/pytorch/issues/107030 +# So allow a low number of tests to fail as the tests "usually" succeed +max_failed_tests = 6 + +tests = ['PyTorch-check-cpp-extension.py'] + +moduleclass = 'ai' diff --git a/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_avoid_caffe2_test_cpp_jit.patch b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_avoid_caffe2_test_cpp_jit.patch new file mode 100644 index 000000000000..7e322c371074 --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_avoid_caffe2_test_cpp_jit.patch @@ -0,0 +1,106 @@ +commit 9e09454cdefc14397c57b2435d3da0c0413dbb8e +Author: Ake Sandgren +Date: Thu Feb 27 15:18:52 2025 +0100 + + Avoid IS_SANDCASTLE tripping on //caffe2/test/cpp/jit:test_custom_class_registrations + +diff --git a/test/export/test_export.py b/test/export/test_export.py +index 9d1006745b4..b7ee8c1d451 100644 +--- a/test/export/test_export.py ++++ b/test/export/test_export.py +@@ -3917,7 +3917,7 @@ class TestExportCustomClass(TorchTestCase): + def setUp(self): + if IS_FBCODE: + lib_file_path = "//caffe2/test/cpp/jit:test_custom_class_registrations" +- elif IS_SANDCASTLE or IS_MACOS: ++ elif False or IS_MACOS: + raise unittest.SkipTest("non-portable load_library call used in test") + elif IS_WINDOWS: + lib_file_path = find_library_location('torchbind_test.dll') +diff --git a/test/export/test_lift_unlift.py b/test/export/test_lift_unlift.py +index edbfa0803d4..a93728f8bd3 100644 +--- a/test/export/test_lift_unlift.py ++++ b/test/export/test_lift_unlift.py +@@ -146,7 +146,7 @@ class TestLift(TestCase): + def setUp(self): + if IS_MACOS: + raise unittest.SkipTest("non-portable load_library call used in test") +- elif IS_SANDCASTLE or IS_FBCODE: ++ elif False or IS_FBCODE: + torch.ops.load_library( + "//caffe2/test/cpp/jit:test_custom_class_registrations" + ) +@@ -379,7 +379,7 @@ class ConstantAttrMapTest(TestCase): + def setUp(self): + if IS_MACOS: + raise unittest.SkipTest("non-portable load_library call used in test") +- elif IS_SANDCASTLE or IS_FBCODE: ++ elif False or IS_FBCODE: + torch.ops.load_library( + "//caffe2/test/cpp/jit:test_custom_class_registrations" + ) +diff --git a/test/export/test_serialize.py b/test/export/test_serialize.py +index 08381d95b44..59016a874ad 100644 +--- a/test/export/test_serialize.py ++++ b/test/export/test_serialize.py +@@ -823,7 +823,7 @@ class TestSaveLoad(TestCase): + @unittest.skipIf(not torchdynamo.is_dynamo_supported(), "dynamo doesn't support") + class TestSerializeCustomClass(TestCase): + def setUp(self): +- if IS_SANDCASTLE or IS_FBCODE: ++ if False or IS_FBCODE: + torch.ops.load_library( + "//caffe2/test/cpp/jit:test_custom_class_registrations" + ) +diff --git a/test/export/test_torchbind.py b/test/export/test_torchbind.py +index 362064812d4..e5b2f4ae511 100644 +--- a/test/export/test_torchbind.py ++++ b/test/export/test_torchbind.py +@@ -21,7 +21,7 @@ class TestExportTorchbind(TestCase): + def setUp(self): + if IS_MACOS: + raise unittest.SkipTest("non-portable load_library call used in test") +- elif IS_SANDCASTLE or IS_FBCODE: ++ elif False or IS_FBCODE: + torch.ops.load_library( + "//caffe2/test/cpp/jit:test_custom_class_registrations" + ) +diff --git a/test/export/test_unflatten.py b/test/export/test_unflatten.py +index 64f123136ba..d0baef3777c 100644 +--- a/test/export/test_unflatten.py ++++ b/test/export/test_unflatten.py +@@ -552,7 +552,7 @@ class TestUnflatten(TestCase): + def test_unflatten_constant_obj(self): + if IS_MACOS: + raise unittest.SkipTest("non-portable load_library call used in test") +- elif IS_SANDCASTLE or IS_FBCODE: ++ elif False or IS_FBCODE: + torch.ops.load_library( + "//caffe2/test/cpp/jit:test_custom_class_registrations" + ) +diff --git a/test/higher_order_ops/test_with_effects.py b/test/higher_order_ops/test_with_effects.py +index 0c8f12a1058..3347b6ca1fc 100644 +--- a/test/higher_order_ops/test_with_effects.py ++++ b/test/higher_order_ops/test_with_effects.py +@@ -27,7 +27,7 @@ class TestWithEffects(TestCase): + def setUp(self): + if IS_MACOS: + raise unittest.SkipTest("non-portable load_library call used in test") +- elif IS_SANDCASTLE or IS_FBCODE: ++ elif False or IS_FBCODE: + torch.ops.load_library( + "//caffe2/test/cpp/jit:test_custom_class_registrations" + ) +diff --git a/test/test_weak.py b/test/test_weak.py +index cc9ff6f58ee..54ee73a6dae 100644 +--- a/test/test_weak.py ++++ b/test/test_weak.py +@@ -600,7 +600,7 @@ class WeakKeyDictionaryScriptObjectTestCase(TestCase): + + def __init__(self, *args, **kw): + unittest.TestCase.__init__(self, *args, **kw) +- if IS_SANDCASTLE or IS_FBCODE: ++ if False or IS_FBCODE: + torch.ops.load_library( + "//caffe2/test/cpp/jit:test_custom_class_registrations" + ) diff --git a/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_disable-gcc12-warning.patch b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_disable-gcc12-warning.patch new file mode 100644 index 000000000000..03b951b924be --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_disable-gcc12-warning.patch @@ -0,0 +1,20 @@ +GCC 12 has a false positive warning when compiled for some architectures, e.g. Intel Sapphire Rapids. +See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112370 + +Suppress this warning such that the build doesn't error. + +Author: Alexander Grund (TU Dresden) + +Ported to 2.3.0, Åke Sandgren +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b74bf4536f4..bb062fa843a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -573,6 +573,7 @@ if(MSVC) + string(APPEND CMAKE_CXX_FLAGS " /FS") + string(APPEND CMAKE_CUDA_FLAGS " -Xcompiler /FS") + endif(MSVC) ++append_cxx_flag_if_supported("-Wno-free-nonheap-object" CMAKE_CXX_FLAGS) + + string(APPEND CMAKE_CUDA_FLAGS " -Xfatbin -compress-all") + diff --git a/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_disable_DataType_dependent_test_if_tensorboard_is_not_available.patch b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_disable_DataType_dependent_test_if_tensorboard_is_not_available.patch new file mode 100644 index 000000000000..b08d67aaeb49 --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_disable_DataType_dependent_test_if_tensorboard_is_not_available.patch @@ -0,0 +1,126 @@ +Disable use of DataType in test when tensorboard module is not available +The corresponding import is already protected + +Åke Sandgren, 2024-05-07 +diff --git a/test/test_tensorboard.py b/test/test_tensorboard.py +index 3ce2ab2a172..141f09dc220 100644 +--- a/test/test_tensorboard.py ++++ b/test/test_tensorboard.py +@@ -829,64 +829,65 @@ class TestTensorBoardNumpy(BaseTestCase): + ) + compare_proto(graph, self) + +-class TestTensorProtoSummary(BaseTestCase): +- @parametrize( +- "tensor_type,proto_type", +- [ +- (torch.float16, DataType.DT_HALF), +- (torch.bfloat16, DataType.DT_BFLOAT16), +- ], +- ) +- def test_half_tensor_proto(self, tensor_type, proto_type): +- float_values = [1.0, 2.0, 3.0] +- actual_proto = tensor_proto( +- "dummy", +- torch.tensor(float_values, dtype=tensor_type), +- ).value[0].tensor +- self.assertSequenceEqual( +- [int_to_half(x) for x in actual_proto.half_val], +- float_values, ++if TEST_TENSORBOARD: ++ class TestTensorProtoSummary(BaseTestCase): ++ @parametrize( ++ "tensor_type,proto_type", ++ [ ++ (torch.float16, DataType.DT_HALF), ++ (torch.bfloat16, DataType.DT_BFLOAT16), ++ ], + ) +- self.assertTrue(actual_proto.dtype == proto_type) ++ def test_half_tensor_proto(self, tensor_type, proto_type): ++ float_values = [1.0, 2.0, 3.0] ++ actual_proto = tensor_proto( ++ "dummy", ++ torch.tensor(float_values, dtype=tensor_type), ++ ).value[0].tensor ++ self.assertSequenceEqual( ++ [int_to_half(x) for x in actual_proto.half_val], ++ float_values, ++ ) ++ self.assertTrue(actual_proto.dtype == proto_type) + +- def test_float_tensor_proto(self): +- float_values = [1.0, 2.0, 3.0] +- actual_proto = ( +- tensor_proto("dummy", torch.tensor(float_values)).value[0].tensor +- ) +- self.assertEqual(actual_proto.float_val, float_values) +- self.assertTrue(actual_proto.dtype == DataType.DT_FLOAT) +- +- def test_int_tensor_proto(self): +- int_values = [1, 2, 3] +- actual_proto = ( +- tensor_proto("dummy", torch.tensor(int_values, dtype=torch.int32)) +- .value[0] +- .tensor +- ) +- self.assertEqual(actual_proto.int_val, int_values) +- self.assertTrue(actual_proto.dtype == DataType.DT_INT32) ++ def test_float_tensor_proto(self): ++ float_values = [1.0, 2.0, 3.0] ++ actual_proto = ( ++ tensor_proto("dummy", torch.tensor(float_values)).value[0].tensor ++ ) ++ self.assertEqual(actual_proto.float_val, float_values) ++ self.assertTrue(actual_proto.dtype == DataType.DT_FLOAT) ++ ++ def test_int_tensor_proto(self): ++ int_values = [1, 2, 3] ++ actual_proto = ( ++ tensor_proto("dummy", torch.tensor(int_values, dtype=torch.int32)) ++ .value[0] ++ .tensor ++ ) ++ self.assertEqual(actual_proto.int_val, int_values) ++ self.assertTrue(actual_proto.dtype == DataType.DT_INT32) + +- def test_scalar_tensor_proto(self): +- scalar_value = 0.1 +- actual_proto = ( +- tensor_proto("dummy", torch.tensor(scalar_value)).value[0].tensor +- ) +- self.assertAlmostEqual(actual_proto.float_val[0], scalar_value) ++ def test_scalar_tensor_proto(self): ++ scalar_value = 0.1 ++ actual_proto = ( ++ tensor_proto("dummy", torch.tensor(scalar_value)).value[0].tensor ++ ) ++ self.assertAlmostEqual(actual_proto.float_val[0], scalar_value) + +- def test_complex_tensor_proto(self): +- real = torch.tensor([1.0, 2.0]) +- imag = torch.tensor([3.0, 4.0]) +- actual_proto = ( +- tensor_proto("dummy", torch.complex(real, imag)).value[0].tensor +- ) +- self.assertEqual(actual_proto.scomplex_val, [1.0, 3.0, 2.0, 4.0]) ++ def test_complex_tensor_proto(self): ++ real = torch.tensor([1.0, 2.0]) ++ imag = torch.tensor([3.0, 4.0]) ++ actual_proto = ( ++ tensor_proto("dummy", torch.complex(real, imag)).value[0].tensor ++ ) ++ self.assertEqual(actual_proto.scomplex_val, [1.0, 3.0, 2.0, 4.0]) + +- def test_empty_tensor_proto(self): +- actual_proto = tensor_proto("dummy", torch.empty(0)).value[0].tensor +- self.assertEqual(actual_proto.float_val, []) ++ def test_empty_tensor_proto(self): ++ actual_proto = tensor_proto("dummy", torch.empty(0)).value[0].tensor ++ self.assertEqual(actual_proto.float_val, []) + +-instantiate_parametrized_tests(TestTensorProtoSummary) ++ instantiate_parametrized_tests(TestTensorProtoSummary) + + if __name__ == '__main__': + run_tests() diff --git a/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_disable_test_linear_package_if_no_half_types_are_available.patch b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_disable_test_linear_package_if_no_half_types_are_available.patch new file mode 100644 index 000000000000..f6b08659c647 --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_disable_test_linear_package_if_no_half_types_are_available.patch @@ -0,0 +1,15 @@ +Disable test_linear_package if neither bf16 nor fp16 are available on the CPU + +Åke Sandgren, 2024-05-06 +diff --git a/test/inductor/test_cpu_repro.py b/test/inductor/test_cpu_repro.py +index dfc453220a9..ae1613ad62e 100644 +--- a/test/inductor/test_cpu_repro.py ++++ b/test/inductor/test_cpu_repro.py +@@ -362,6 +362,7 @@ class CPUReproTests(TestCase): + self.common(Model(), example_inputs) + + @unittest.skipIf(not torch.backends.mkldnn.is_available(), "MKLDNN is not enabled") ++ @unittest.skipIf(not (torch.ops.mkldnn._is_mkldnn_bf16_supported() or torch.ops.mkldnn._is_mkldnn_fp16_supported()), "MKLDNN neither fp16 nor bf16 are available") + @patch("torch.cuda.is_available", lambda: False) + def test_linear_packed(self): + dtypes = [] diff --git a/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_disable_tests_which_need_network_download.patch b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_disable_tests_which_need_network_download.patch new file mode 100644 index 000000000000..550733683825 --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_disable_tests_which_need_network_download.patch @@ -0,0 +1,27 @@ +Disable tests that requires external downloads + +Åke Sandgren, 2024-05-14 +diff --git a/test/test_hub.py b/test/test_hub.py +index a0c0c315c4e..6427d02045f 100644 +--- a/test/test_hub.py ++++ b/test/test_hub.py +@@ -23,6 +23,7 @@ TORCHHUB_EXAMPLE_RELEASE_URL = 'https://github.com/ailzhang/torchhub_example/rel + + + @unittest.skipIf(IS_SANDCASTLE, 'Sandcastle cannot ping external') ++@unittest.skipIf(True, 'EasyBuild: do not want tests to depend on downloading') + class TestHub(TestCase): + + def setUp(self): +diff --git a/test/test_nn.py b/test/test_nn.py +index 66fc4cdc466..ed5d1ecc765 100644 +--- a/test/test_nn.py ++++ b/test/test_nn.py +@@ -151,6 +151,7 @@ class TestNN(NNTestCase): + for b in m.buffers(): + self.assertFalse(b.requires_grad) + ++ @unittest.skipIf(True, 'EasyBuild: do not want tests to depend on downloading') + def test_module_backcompat(self): + from torch.serialization import SourceChangeWarning + path = download_file('https://download.pytorch.org/test_data/linear.pt') diff --git a/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_fix-mkldnn-avx512-f32-bias.patch b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_fix-mkldnn-avx512-f32-bias.patch new file mode 100644 index 000000000000..312c900be477 --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_fix-mkldnn-avx512-f32-bias.patch @@ -0,0 +1,19 @@ +Fix a bug in MKLDNN that leads to e.g. a failure in +test_conv_deconv_1d_lower_precision_cpu_bfloat16, test_conv_deconv_2d_lower_precision_cpu_bfloat16, test_conv_deconv_3d_lower_precision_cpu_bfloat16 + +From: https://github.com/uxlfoundation/oneDNN/commit/c145daecbfb285a876a689e665ef0f2875638a60 +From: Dmitrii Zarukin +Subject: [PATCH] cpu: x64: avx512_core_amx: kernel: fix f32 bias application + +diff -ur a/third_party/ideep/mkl-dnn/src/cpu/x64/jit_avx512_core_amx_conv_kernel.cpp b/third_party/ideep/mkl-dnn/src/cpu/x64/jit_avx512_core_amx_conv_kernel.cpp +--- a/third_party/ideep/mkl-dnn/src/cpu/x64/jit_avx512_core_amx_conv_kernel.cpp ++++ b/third_party/ideep/mkl-dnn/src/cpu/x64/jit_avx512_core_amx_conv_kernel.cpp +@@ -3205,7 +3205,7 @@ + vpslld(zmm_in, zmm_in, 16); + break; + case data_type::f16: vcvtph2ps(zmm_in_k, addr); break; +- case data_type::f32: vaddps(zmm_in_k, addr); return; ++ case data_type::f32: vmovups(zmm_in_k, addr); break; + default: assert(!"Unsupported data type in xf16 conv"); + } + vaddps(zmm_out, zmm_in); diff --git a/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_fix-test_extension_backend-without-vectorization.patch b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_fix-test_extension_backend-without-vectorization.patch new file mode 100644 index 000000000000..c5d78f181d4c --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_fix-test_extension_backend-without-vectorization.patch @@ -0,0 +1,40 @@ +The test checks for a substring "loadu" in generated code. +On AVX systems that line is: +> auto tmp0 = at::vec::Vectorized::loadu(in_ptr0 + static_cast(i0)) +however on non-AVX systems it is +> auto tmp0 = in_ptr0[static_cast(i0)]; + +the difference depends on `codecache.valid_vec_isa_list()` being non-empty. +See torch/_inductor/codegen/cpp.py:2639 + +Modify the test to account for that. + +Author: Alexander Grund (TU Dresden) + +Ported to 2.3.0, Åke Sandgren +diff --git a/test/inductor/test_extension_backend.py b/test/inductor/test_extension_backend.py +index 54f020907a5..a4b1ce88d99 100644 +--- a/test/inductor/test_extension_backend.py ++++ b/test/inductor/test_extension_backend.py +@@ -20,7 +20,7 @@ except ImportError: + ) + + from torch._C import FileCheck +-from torch._inductor import metrics ++from torch._inductor import codecache, metrics + from torch._inductor.codegen.common import ( + get_scheduling_for_device, + get_wrapper_codegen_for_device, +@@ -131,7 +131,11 @@ class ExtensionBackendTests(TestCase): + metrics.reset() + opt_fn = torch.compile()(fn) + _, code = run_and_get_cpp_code(opt_fn, x, y, z) +- FileCheck().check("void kernel").check("loadu").check("extension_device").run( ++ if codecache.valid_vec_isa_list(): ++ load_expr = 'loadu' ++ else: ++ load_expr = ' = in_ptr0[static_cast(i0)];' ++ FileCheck().check("void kernel").check(load_expr).check("extension_device").run( + code + ) + opt_fn(x, y, z) diff --git a/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_fix_missing_masked_load_for_int_type.patch b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_fix_missing_masked_load_for_int_type.patch new file mode 100644 index 000000000000..790436918fa9 --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_fix_missing_masked_load_for_int_type.patch @@ -0,0 +1,122 @@ +commit eda279c99771de314d8b82aa8389c9e972f9b855 +Author: Nikita Shulga +Date: Mon Mar 25 12:33:59 2024 -0700 + + [CpuInductor] Implement masked_load for integral types (#122608) + + Use `if constexpr` to separate float vs integral masked load for avx512 + Discovered while looking at `test_comprehensive_fft_ihfft2_cpu_int64` on + non-AVX512 capable CPUs where (5, 6, 7) shape were big enough to start a vectorized loop + + Added `test_pad_cast` regression test + + Fixes https://github.com/pytorch/pytorch/issues/122606 + + Pull Request resolved: https://github.com/pytorch/pytorch/pull/122608 + Approved by: https://github.com/jansel + ghstack dependencies: #122607 + +diff --git a/test/inductor/test_torchinductor.py b/test/inductor/test_torchinductor.py +index 303cc44dd7a..552763e84ae 100644 +--- a/test/inductor/test_torchinductor.py ++++ b/test/inductor/test_torchinductor.py +@@ -8497,6 +8497,13 @@ class CommonTemplate: + x = torch.rand(48, 3, 512, 512) + self.common(fn, (x,)) + ++ def test_pad_cast(self): ++ def fn(x): ++ return torch.nn.functional.pad(x.to(torch.float32), (0, 3, 0, 0)) ++ ++ for dtype in [torch.int32, torch.int64]: ++ self.common(fn, (torch.ones(1, 1, 13, dtype=dtype),)) ++ + @unittest.skipIf(not HAS_CPU or not RUN_CPU, "requires C++ compiler") + def test_data_type_propogation(self): + from torch._dynamo.utils import detect_fake_mode +diff --git a/torch/_inductor/codegen/cpp_prefix.h b/torch/_inductor/codegen/cpp_prefix.h +index 9bec9d5a90e..c922274d655 100644 +--- a/torch/_inductor/codegen/cpp_prefix.h ++++ b/torch/_inductor/codegen/cpp_prefix.h +@@ -280,19 +280,36 @@ inline float flag_to_float_scalar(T src) { + + #if defined(CPU_CAPABILITY_AVX512) || defined(CPU_CAPABILITY_AVX2) || defined(CPU_CAPABILITY_ZVECTOR) + +-inline at::vec::Vectorized masked_load(const float* src, at::vec::Vectorized mask) { ++template ++typename std::enable_if_t || std::is_same_v || std::is_same_v, at::vec::Vectorized> ++inline masked_load(const T* src, at::vec::Vectorized mask) { + # if defined(CPU_CAPABILITY_AVX512) +- at::vec::Vectorized zero_vec(0); ++ at::vec::Vectorized zero_vec(0); + auto all_ones = _mm512_set1_epi32(0xFFFFFFFF); + auto mmask = _mm512_cmp_epi32_mask(_mm512_castps_si512(mask), all_ones, _MM_CMPINT_EQ); +- return _mm512_mask_loadu_ps(zero_vec, mmask, src); ++ ++ if constexpr (std::is_same_v) { ++ return _mm512_mask_loadu_ps(zero_vec, mmask, src); ++ } else { ++ return _mm512_mask_loadu_epi32(zero_vec, mmask, src); ++ } + # elif defined(CPU_CAPABILITY_AVX2) + auto all_ones = _mm256_set1_epi32(0xFFFFFFFF); + auto mmask = _mm256_cmpeq_epi32(_mm256_castps_si256(mask), all_ones); +- return _mm256_maskload_ps(src, mmask); ++ if constexpr (std::is_same_v) { ++ return _mm256_maskload_ps(src, mmask); ++ } else { ++ return _mm256_maskload_epi32(src, mmask); ++ } + # elif defined(CPU_CAPABILITY_ZVECTOR) +- auto result = at::vec::Vectorized::loadu(src); +- return (result & mask); ++ auto result = at::vec::Vectorized::loadu(src); ++ if constexpr (std::is_same_v) { ++ return result & mask; ++ } else { ++ T maskdata[at::vec::Vectorized::size()]; ++ mask.store(maskdata); ++ return result & at::vec::Vectorized::loadu(maskdata); ++ } + # else + # error Unsupported vectorization CPU capability + # endif +@@ -326,7 +343,7 @@ inline masked_load(const T* src, at::vec::Vectorized mask) { + maskdata_dest[i] = (maskdata[i] == 0xFFFFFFFF) ? 0xFFFF: 0; + } + auto maskvector = at::vec::Vectorized::loadu(maskdata_dest); +- return (result & maskvector); ++ return result & maskvector; + # else + # error Unsupported vectorization CPU capability + # endif +@@ -360,12 +377,28 @@ inline masked_load(const T* src, at::vec::Vectorized mask) { + maskdata_dest[i] = (maskdata[i] == 0xFFFFFFFF) ? 0xFF: 0; + } + auto maskvector = at::vec::Vectorized::loadu(maskdata_dest); +- return (result & maskvector); ++ return result & maskvector; + # else + # error Unsupported vectorization CPU capability + # endif + } + ++template ++typename std::enable_if_t || std::is_same_v, at::vec::VectorizedN> ++inline masked_load(const T* src, at::vec::Vectorized mask) { ++ // TODO: Add vectorized variants for the load ++ constexpr auto vec_size = decltype(mask)::size(); ++ __at_align__ uint32_t maskdata[vec_size]; ++ __at_align__ uint64_t mask_res[vec_size]; ++ mask.store(maskdata); ++ #pragma unroll ++ for(auto i = 0; i < vec_size; ++i) { ++ mask_res[i] = maskdata[i] ? std::numeric_limits::max() : 0; ++ } ++ auto result = at::vec::VectorizedN::loadu(src); ++ return result & at::vec::VectorizedN::loadu(mask_res); ++} ++ + template + inline at::vec::Vectorized flag_to_float_vec(const T* src) { + __at_align__ float dst_tmp[at::vec::Vectorized::size()]; diff --git a/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_no-cuda-stubs-rpath.patch b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_no-cuda-stubs-rpath.patch new file mode 100644 index 000000000000..20d6ed8a80dc --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_no-cuda-stubs-rpath.patch @@ -0,0 +1,150 @@ +# PyTorch's CMAKE configuration by default sets RUNPATH on libraries if they link other libraries +# that are outside the build tree, which is done because of the CMAKE config on +# https://github.com/pytorch/pytorch/blob/v1.10.0/cmake/Dependencies.cmake#L10. +# This provides problems, since the cuda stubs library path then also gets added to the RUNPATH. +# As a result, at runtime, the stub version of things like libcuda.so.1 gets picked up, instead of the real drivers +# See https://github.com/easybuilders/easybuild-easyconfigs/issues/14359 +# This line https://github.com/pytorch/pytorch/blob/v1.10.0/cmake/Dependencies.cmake#L16 +# Makes sure that any path that is linked, is also added to the RUNPATH. +# This has been reported upstream in https://github.com/pytorch/pytorch/issues/35418 +# and a fix was attempted in https://github.com/pytorch/pytorch/pull/37737 but it was reverted +# +# This EasyBuild patch changes behavior for the libraries that were failing, i.e. the ones in this list: +# https://github.com/easybuilders/easybuild-easyconfigs/issues/14359#issuecomment-970479904 +# This is done by setting INSTALL_RPATH_USE_LINK_PATH to false, and instead, specifying the RPATH +# explicitely by defining INSTALL_RPATH, but only adding directories that do not match to the "stubs" regex +# +# Original patch: Caspar van Leeuwen +# Updated: Alexander Grund (TU Dresden) +# +# See https://github.com/pytorch/pytorch/pull/122318 + +diff --git a/binaries/CMakeLists.txt b/binaries/CMakeLists.txt +index 15f47bf52ae..edf1ab26149 100644 +--- a/binaries/CMakeLists.txt ++++ b/binaries/CMakeLists.txt +@@ -56,7 +56,8 @@ endif() + + if(USE_CUDA) + caffe2_binary_target("inspect_gpu.cc") +- target_link_libraries(inspect_gpu ${CUDA_LIBRARIES}) ++ include(${Torch_SOURCE_DIR}/cmake/LinkCudaLibraries.cmake) ++ link_cuda_libraries(inspect_gpu ${CUDA_LIBRARIES}) + caffe2_binary_target("print_core_object_sizes_gpu.cc") + + if(BUILD_TEST) +diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt +index 5a68e225155..bb87d973d1a 100644 +--- a/caffe2/CMakeLists.txt ++++ b/caffe2/CMakeLists.txt +@@ -651,14 +651,13 @@ endif() + if(USE_CUDA) + list(APPEND Caffe2_GPU_CU_SRCS ${Caffe2_GPU_HIP_JIT_FUSERS_SRCS}) + add_library(caffe2_nvrtc SHARED ${ATen_NVRTC_STUB_SRCS}) ++ include(${Torch_SOURCE_DIR}/cmake/LinkCudaLibraries.cmake) ++ link_cuda_libraries(caffe2_nvrtc ${CUDA_CUDA_LIB} ${CUDA_NVRTC_LIB}) + if(MSVC) + # Delay load nvcuda.dll so we can import torch compiled with cuda on a CPU-only machine +- set(DELAY_LOAD_FLAGS "-DELAYLOAD:nvcuda.dll;delayimp.lib") +- else() +- set(DELAY_LOAD_FLAGS "") ++ target_link_libraries(caffe2_nvrtc "-DELAYLOAD:nvcuda.dll;delayimp.lib") + endif() + +- target_link_libraries(caffe2_nvrtc ${CUDA_CUDA_LIB} ${CUDA_NVRTC_LIB} ${DELAY_LOAD_FLAGS}) + install(TARGETS caffe2_nvrtc DESTINATION "${TORCH_INSTALL_LIB_DIR}") + if(USE_NCCL) + list(APPEND Caffe2_GPU_SRCS +@@ -1607,6 +1606,7 @@ endif() + + # ---[ CUDA library. + if(USE_CUDA) ++ include(${Torch_SOURCE_DIR}/cmake/LinkCudaLibraries.cmake) + # FIXME: If kineto is linked with CUPTI it pollutes torch_cpu with CUDA dependencies + # Even worse, it never declares that it depends on cudart, but calls the API, see + # https://github.com/pytorch/kineto/blob/aef2f5c0f15e3be52406ac0b885e8689de6bc9f6/libkineto/src/CudaDeviceProperties.cpp#L24 +@@ -1620,13 +1620,13 @@ if(USE_CUDA) + torch_cuda INTERFACE $) + target_include_directories( + torch_cuda PRIVATE ${Caffe2_GPU_INCLUDE}) +- target_link_libraries( ++ link_cuda_libraries( + torch_cuda PRIVATE ${Caffe2_CUDA_DEPENDENCY_LIBS}) + + # These public dependencies must go after the previous dependencies, as the + # order of the libraries in the linker call matters here when statically + # linking; libculibos and cublas must be last. +- target_link_libraries(torch_cuda PUBLIC torch_cpu_library ${Caffe2_PUBLIC_CUDA_DEPENDENCY_LIBS}) ++ link_cuda_libraries(torch_cuda PUBLIC torch_cpu_library ${Caffe2_PUBLIC_CUDA_DEPENDENCY_LIBS}) + endif() + + # ---[ XPU library. +diff --git a/cmake/LinkCudaLibraries.cmake b/cmake/LinkCudaLibraries.cmake +new file mode 100644 +index 00000000000..e09d1186f6d +--- /dev/null ++++ b/cmake/LinkCudaLibraries.cmake +@@ -0,0 +1,33 @@ ++# Link CUDA libraries to the given target, i.e.: `target_link_libraries(target )` ++# ++# Additionally makes sure CUDA stub libs don't end up being in RPath ++# ++# Example: link_cuda_libraries(mytarget PRIVATE ${CUDA_LIBRARIES}) ++function(link_cuda_libraries target) ++ set(libs ${ARGN}) ++ set(install_rpath "$ORIGIN") ++ set(filtered FALSE) ++ foreach(lib IN LISTS libs) ++ # CUDA stub libs are in form /prefix/lib/stubs/libcuda.so ++ # So extract the name of the parent folder, to check against "stubs" ++ # And the parent path which we need to add to the INSTALL_RPATH for non-stubs ++ get_filename_component(parent_path "${lib}" DIRECTORY) ++ get_filename_component(parent_name "${parent_path}" NAME) ++ if(parent_name STREQUAL "stubs") ++ message(STATUS "Filtering ${lib} from being set in ${target}'s RPATH, " ++ "because it appears to point to the CUDA stubs directory.") ++ set(filtered TRUE) ++ elseif(parent_path) ++ list(APPEND install_rpath ${parent_path}) ++ endif() ++ endforeach() ++ ++ # Regular link command ++ target_link_libraries(${target} ${libs}) ++ # Manually set INSTALL_RPATH when there were any stub libs ++ if(filtered) ++ list(REMOVE_DUPLICATES install_rpath) ++ set_target_properties(${target} PROPERTIES INSTALL_RPATH_USE_LINK_PATH FALSE) ++ set_target_properties(${target} PROPERTIES INSTALL_RPATH "${install_rpath}") ++ endif() ++endfunction() +diff --git a/test/test_torch.py b/test/test_torch.py +index 9a1b6199032..f15dbc7b9a4 100644 +--- a/test/test_torch.py ++++ b/test/test_torch.py +@@ -10730,6 +10730,25 @@ def add_neg_dim_tests(): + assert not hasattr(TestTorch, test_name), "Duplicated test name: " + test_name + setattr(TestTorch, test_name, make_neg_dim_test(name, tensor_arg, arg_constr, types, extra_dim)) + ++class TestRPATH(TestCase): ++ @unittest.skipIf(not sys.platform.startswith('linux'), "linux-only test") ++ def test_rpath(self): ++ """ ++ Make sure RPATH (or RUNPATH) in nvrtc does not contain a cuda stubs directory ++ issue gh-35418 ++ """ ++ libdir = os.path.join(os.path.dirname(torch._C.__file__), 'lib') ++ caffe2_nvrtc = os.path.join(libdir, 'libcaffe2_nvrtc.so') ++ if os.path.exists(caffe2_nvrtc): ++ output = subprocess.check_output(['objdump', '-x', caffe2_nvrtc]) ++ for line in output.split(b'\n'): ++ if b'RPATH' in line or b'RUNPATH' in line: ++ # Catch paths like: ++ # $ORIGIN:/usr/local/cuda-10.2/lib64/stubs:/usr/local/cuda-10.2/lib64 ++ self.assertFalse(b'/stubs:' in line) ++ # $ORIGIN:/usr/local/cuda-10.2/lib64:/usr/local/cuda-10.2/lib64/stubs ++ self.assertFalse(line.endswith(b'/stubs')) ++ + # TODO: these empy classes are temporarily instantiated for XLA compatibility + # once XLA updates their test suite it should be removed + class TestViewOps(TestCase): diff --git a/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_skip-test_init_from_local_shards.patch b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_skip-test_init_from_local_shards.patch new file mode 100644 index 000000000000..6da0ec670202 --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_skip-test_init_from_local_shards.patch @@ -0,0 +1,26 @@ +The test often times out and seems to be considered flaky by PyTorch: +https://github.com/pytorch/pytorch/issues/78068 + +Author: Alexander Grund (TU Dresden) + +Ported to 2.3.0, Åke Sandgren +diff --git a/test/distributed/_shard/sharded_tensor/test_sharded_tensor.py b/test/distributed/_shard/sharded_tensor/test_sharded_tensor.py +index f2abc1e92d6..f32a298e813 100644 +--- a/test/distributed/_shard/sharded_tensor/test_sharded_tensor.py ++++ b/test/distributed/_shard/sharded_tensor/test_sharded_tensor.py +@@ -7,6 +7,7 @@ import itertools + import pickle + import sys + from typing import List ++from unittest import skip + import torch + import torch.distributed as dist + from torch.distributed import rpc +@@ -2267,6 +2268,7 @@ class TestShardedTensorFromLocalShards(ShardedTensorTestBase): + @with_comms + @skip_if_lt_x_gpu(4) + @requires_nccl() ++ @skip("Times out often") + def test_init_from_local_shards(self): + local_shard_metadata = ShardMetadata( + shard_offsets=[(self.rank // 2) * 5, (self.rank % 2) * 5], diff --git a/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_skip_test_sdpa_nn_functional_scaled_dot_product_attention_cpu.patch b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_skip_test_sdpa_nn_functional_scaled_dot_product_attention_cpu.patch new file mode 100644 index 000000000000..a1e29ddd8715 --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_skip_test_sdpa_nn_functional_scaled_dot_product_attention_cpu.patch @@ -0,0 +1,20 @@ +commit 8839fc56214ff6154ae181fb8122989752f270b3 +Author: Ake Sandgren +Date: Thu Mar 13 07:22:52 2025 +0100 + + Skip test_sdpa_nn_functional_scaled_dot_product_attention_cpu_half/bfloat16 + It fails consistently on Rapids and Rome + +diff --git a/test/test_decomp.py b/test/test_decomp.py +index 4361895e15a..d18c201c360 100644 +--- a/test/test_decomp.py ++++ b/test/test_decomp.py +@@ -932,7 +932,7 @@ class DecompOneOffTests(TestCase): + @onlyCPU + @skipIfCrossRef + @skipOps('DecompOneOffTests', 'test_sdpa', [ +- xfail("nn.functional.scaled_dot_product_attention", dtypes=[torch.half] + ([torch.bfloat16] if IS_MACOS else [])), ++ skip("nn.functional.scaled_dot_product_attention", dtypes=[torch.half, torch.bfloat16]), + ]) + @ops(_sdpa_op_info) + def test_sdpa(self, device, dtype, op): diff --git a/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_skip_test_var_mean_differentiable.patch b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_skip_test_var_mean_differentiable.patch new file mode 100644 index 000000000000..c7c2c408be06 --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch/PyTorch-2.3.0_skip_test_var_mean_differentiable.patch @@ -0,0 +1,19 @@ +commit 46010b9d50aed454e9c9e5347df10e6cbb6eac39 +Author: Ake Sandgren +Date: Mon Mar 10 11:13:33 2025 +0100 + + Skip test_var_mean_differentiable + It sometimoes gets a segfault during garbage collection causing problems in PASS/FAIL reporting + +diff --git a/test/test_autograd.py b/test/test_autograd.py +index 791510e4cc4..94a826c11ec 100644 +--- a/test/test_autograd.py ++++ b/test/test_autograd.py +@@ -3881,6 +3881,7 @@ class TestAutograd(TestCase): + with self.assertRaisesRegex(Exception, 'Simulate error'): + d.sum().backward() + ++ @unittest.skip("Occasionally gets a segfault during garbage collection") + def test_var_mean_differentiable(self): + dim = [2, 4] + keepdim = False diff --git a/easybuild/easyconfigs/t/tlparse/tlparse-0.3.5-GCCcore-13.2.0.eb b/easybuild/easyconfigs/t/tlparse/tlparse-0.3.5-GCCcore-13.2.0.eb new file mode 100644 index 000000000000..c233755fa537 --- /dev/null +++ b/easybuild/easyconfigs/t/tlparse/tlparse-0.3.5-GCCcore-13.2.0.eb @@ -0,0 +1,185 @@ +easyblock = 'CargoPythonPackage' + +name = 'tlparse' +version = '0.3.5' + +homepage = 'https://github.com/ezyang/tlparse' +description = "Parse structured PT2 (PyTorch 2) logs" + +toolchain = {'name': 'GCCcore', 'version': '13.2.0'} + +github_account = 'ezyang' +source_urls = [GITHUB_SOURCE] +sources = ['v%(version)s.tar.gz'] +checksums = [ + {'v0.3.5.tar.gz': '256eb651bc435c75ff33ad4a31695db99e7e8441d45d2a3124c66fbe2a4b1d30'}, + {'aho-corasick-1.1.2.tar.gz': 'b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0'}, + {'anstream-0.6.13.tar.gz': 'd96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb'}, + {'anstyle-1.0.6.tar.gz': '8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc'}, + {'anstyle-parse-0.2.3.tar.gz': 'c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c'}, + {'anstyle-query-1.0.2.tar.gz': 'e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648'}, + {'anstyle-wincon-3.0.2.tar.gz': '1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7'}, + {'base16ct-0.2.0.tar.gz': '4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf'}, + {'block-buffer-0.10.4.tar.gz': '3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71'}, + {'bstr-1.9.1.tar.gz': '05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706'}, + {'byteorder-1.5.0.tar.gz': '1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b'}, + {'cfg-if-1.0.0.tar.gz': 'baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd'}, + {'clap-4.5.1.tar.gz': 'c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da'}, + {'clap_builder-4.5.1.tar.gz': '9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb'}, + {'clap_derive-4.5.0.tar.gz': '307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47'}, + {'clap_lex-0.7.0.tar.gz': '98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce'}, + {'colorchoice-1.0.0.tar.gz': 'acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7'}, + {'console-0.15.8.tar.gz': '0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb'}, + {'crypto-common-0.1.6.tar.gz': '1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3'}, + {'digest-0.10.7.tar.gz': '9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292'}, + {'encode_unicode-0.3.6.tar.gz': 'a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f'}, + {'equivalent-1.0.1.tar.gz': '5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5'}, + {'fxhash-0.2.1.tar.gz': 'c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c'}, + {'generic-array-0.14.7.tar.gz': '85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a'}, + {'hashbrown-0.14.3.tar.gz': '290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604'}, + {'heck-0.4.1.tar.gz': '95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8'}, + {'html-escape-0.2.13.tar.gz': '6d1ad449764d627e22bfd7cd5e8868264fc9236e07c752972b4080cd351cb476'}, + {'indexmap-2.2.3.tar.gz': '233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177'}, + {'indicatif-0.17.8.tar.gz': '763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3'}, + {'instant-0.1.12.tar.gz': '7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c'}, + {'itoa-1.0.10.tar.gz': 'b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c'}, + {'lazy_static-1.4.0.tar.gz': 'e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646'}, + {'libc-0.2.153.tar.gz': '9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd'}, + {'md-5-0.10.6.tar.gz': 'd89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf'}, + {'memchr-2.7.1.tar.gz': '523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149'}, + {'normpath-1.2.0.tar.gz': '5831952a9476f2fed74b77d74182fa5ddc4d21c72ec45a333b250e3ed0272804'}, + {'number_prefix-0.4.0.tar.gz': '830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3'}, + {'once_cell-1.19.0.tar.gz': '3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92'}, + {'opener-0.6.1.tar.gz': '6c62dcb6174f9cb326eac248f07e955d5d559c272730b6c03e396b443b562788'}, + {'portable-atomic-1.6.0.tar.gz': '7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0'}, + {'proc-macro2-1.0.78.tar.gz': 'e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae'}, + {'quote-1.0.35.tar.gz': '291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef'}, + {'regex-1.10.3.tar.gz': 'b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15'}, + {'regex-automata-0.4.5.tar.gz': '5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd'}, + {'regex-syntax-0.8.2.tar.gz': 'c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f'}, + {'ryu-1.0.17.tar.gz': 'e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1'}, + {'serde-1.0.197.tar.gz': '3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2'}, + {'serde_derive-1.0.197.tar.gz': '7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b'}, + {'serde_json-1.0.114.tar.gz': 'c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0'}, + {'strsim-0.11.0.tar.gz': '5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01'}, + {'syn-2.0.51.tar.gz': '6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c'}, + {'tinytemplate-1.2.1.tar.gz': 'be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc'}, + {'typenum-1.17.0.tar.gz': '42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825'}, + {'unicode-ident-1.0.12.tar.gz': '3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b'}, + {'unicode-width-0.1.11.tar.gz': 'e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85'}, + {'utf8-width-0.1.7.tar.gz': '86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3'}, + {'utf8parse-0.2.1.tar.gz': '711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a'}, + {'version_check-0.9.4.tar.gz': '49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f'}, + {'winapi-0.3.9.tar.gz': '5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419'}, + {'winapi-i686-pc-windows-gnu-0.4.0.tar.gz': 'ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6'}, + {'winapi-x86_64-pc-windows-gnu-0.4.0.tar.gz': '712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f'}, + {'windows-sys-0.52.0.tar.gz': '282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d'}, + {'windows-targets-0.52.3.tar.gz': 'd380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f'}, + {'windows_aarch64_gnullvm-0.52.3.tar.gz': '68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6'}, + {'windows_aarch64_msvc-0.52.3.tar.gz': '8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f'}, + {'windows_i686_gnu-0.52.3.tar.gz': '2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb'}, + {'windows_i686_msvc-0.52.3.tar.gz': '28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58'}, + {'windows_x86_64_gnu-0.52.3.tar.gz': '704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614'}, + {'windows_x86_64_gnullvm-0.52.3.tar.gz': '42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c'}, + {'windows_x86_64_msvc-0.52.3.tar.gz': '0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6'}, +] + +builddependencies = [ + ('binutils', '2.40'), + ('maturin', '1.5.0', '-Rust-1.76.0'), +] + +dependencies = [ + ('Python', '3.11.5'), +] + +use_pip = True +sanity_pip_check = True +download_dep_fail = True + +options = { + 'modulename': False, +} + +crates = [ + ('aho-corasick', '1.1.2'), + ('anstream', '0.6.13'), + ('anstyle', '1.0.6'), + ('anstyle-parse', '0.2.3'), + ('anstyle-query', '1.0.2'), + ('anstyle-wincon', '3.0.2'), + ('base16ct', '0.2.0'), + ('block-buffer', '0.10.4'), + ('bstr', '1.9.1'), + ('byteorder', '1.5.0'), + ('cfg-if', '1.0.0'), + ('clap', '4.5.1'), + ('clap_builder', '4.5.1'), + ('clap_derive', '4.5.0'), + ('clap_lex', '0.7.0'), + ('colorchoice', '1.0.0'), + ('console', '0.15.8'), + ('crypto-common', '0.1.6'), + ('digest', '0.10.7'), + ('encode_unicode', '0.3.6'), + ('equivalent', '1.0.1'), + ('fxhash', '0.2.1'), + ('generic-array', '0.14.7'), + ('hashbrown', '0.14.3'), + ('heck', '0.4.1'), + ('html-escape', '0.2.13'), + ('indexmap', '2.2.3'), + ('indicatif', '0.17.8'), + ('instant', '0.1.12'), + ('itoa', '1.0.10'), + ('lazy_static', '1.4.0'), + ('libc', '0.2.153'), + ('md-5', '0.10.6'), + ('memchr', '2.7.1'), + ('normpath', '1.2.0'), + ('number_prefix', '0.4.0'), + ('once_cell', '1.19.0'), + ('opener', '0.6.1'), + ('portable-atomic', '1.6.0'), + ('proc-macro2', '1.0.78'), + ('quote', '1.0.35'), + ('regex', '1.10.3'), + ('regex-automata', '0.4.5'), + ('regex-syntax', '0.8.2'), + ('ryu', '1.0.17'), + ('serde', '1.0.197'), + ('serde_derive', '1.0.197'), + ('serde_json', '1.0.114'), + ('strsim', '0.11.0'), + ('syn', '2.0.51'), + ('tinytemplate', '1.2.1'), + ('typenum', '1.17.0'), + ('unicode-ident', '1.0.12'), + ('unicode-width', '0.1.11'), + ('utf8-width', '0.1.7'), + ('utf8parse', '0.2.1'), + ('version_check', '0.9.4'), + ('winapi', '0.3.9'), + ('winapi-i686-pc-windows-gnu', '0.4.0'), + ('winapi-x86_64-pc-windows-gnu', '0.4.0'), + ('windows-sys', '0.52.0'), + ('windows-targets', '0.52.3'), + ('windows_aarch64_gnullvm', '0.52.3'), + ('windows_aarch64_msvc', '0.52.3'), + ('windows_i686_gnu', '0.52.3'), + ('windows_i686_msvc', '0.52.3'), + ('windows_x86_64_gnu', '0.52.3'), + ('windows_x86_64_gnullvm', '0.52.3'), + ('windows_x86_64_msvc', '0.52.3'), +] + +sanity_check_paths = { + 'files': ['bin/tlparse'], + 'dirs': [], +} + +sanity_check_commands = [ + 'tlparse --version', +] + +moduleclass = 'tools'