diff --git a/easybuild/easyconfigs/p/PyTorch-bundle/PyTorch-bundle-1.12.1-foss-2022a-CUDA-11.7.0.eb b/easybuild/easyconfigs/p/PyTorch-bundle/PyTorch-bundle-1.12.1-foss-2022a-CUDA-11.7.0.eb new file mode 100644 index 00000000000..17069b4ee78 --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch-bundle/PyTorch-bundle-1.12.1-foss-2022a-CUDA-11.7.0.eb @@ -0,0 +1,76 @@ +easyblock = 'PythonBundle' + +name = 'PyTorch-bundle' +version = '1.12.1' +versionsuffix = '-CUDA-%(cudaver)s' + +homepage = 'https://pytorch.org/' +description = """PyTorch with compatible versions of official Torch extensions.""" + +toolchain = {'name': 'foss', 'version': '2022a'} + +builddependencies = [ + ('CMake', '3.23.1'), + ('RE2', '2022-06-01'), # for torchtext +] + +dependencies = [ + ('CUDA', '11.7.0', '', SYSTEM), + ('Python', '3.10.4'), + ('PyTorch', version, versionsuffix), + ('Pillow-SIMD', '9.2.0'), # for torchvision + ('SentencePiece', '0.1.97'), # for torchtext + ('tqdm', '4.64.0'), # for torchtext + ('double-conversion', '3.2.0'), # for torchtext + ('utf8proc', '2.7.0'), # for torchtext + ('tensorboard', '2.10.0'), # for torch-tb-profiler +] + +use_pip = True + +exts_list = [ + ('portalocker', '2.7.0', { + 'checksums': ['032e81d534a88ec1736d03f780ba073f047a06c478b06e2937486f334e955c51'], + }), + ('torchdata', '0.4.1', { + 'preinstallopts': "USE_SYSTEM_LIBS=1 ", + 'source_urls': ['https://github.com/pytorch/data/archive'], + 'sources': [{'download_filename': 'v%(version)s.tar.gz', 'filename': '%(name)s-%(version)s.tar.gz'}], + 'checksums': ['71c0aa3aca3b04a986a2cd4cc2e0be114984ca836dc4def2c700bf1bd1ff087e'], + }), + ('torchtext', '0.13.1', { + 'source_urls': ['https://github.com/pytorch/text/archive'], + 'sources': [{'download_filename': 'v%(version)s.tar.gz', 'filename': '%(name)s-%(version)s.tar.gz'}], + 'patches': [ + 'torchtext-0.13.1_use-system-libs.patch', + 'torchtext-0.13.1_cxx_17.patch', + ], + 'checksums': [ + {'torchtext-0.13.1.tar.gz': '1f7de1fd8c6303ea13ef2aed48a6df67df5f92d1c4a6918253be7decd93753be'}, + {'torchtext-0.13.1_use-system-libs.patch': + '3e2f170a2870ac274f452b53862f65e5e94f6da1c3af488aeb3001e0500cb0e5'}, + {'torchtext-0.13.1_cxx_17.patch': 'fd242c139baa27352d1065cece4658a3ede76f46ffec08ac04a554301e547f22'}, + ], + }), + ('torchvision', '0.13.1', { + 'source_urls': ['https://github.com/pytorch/vision/archive'], + 'sources': [{'download_filename': 'v%(version)s.tar.gz', 'filename': '%(name)s-%(version)s.tar.gz'}], + 'checksums': ['c32fab734e62c7744dadeb82f7510ff58cc3bca1189d17b16aa99b08afc42249'], + }), + ('pytorch-ignite', '0.4.11', { + 'modulename': 'ignite', + 'source_urls': ['https://github.com/pytorch/ignite/archive'], + 'sources': [{'download_filename': 'v%(version)s.tar.gz', 'filename': '%(name)s-%(version)s.tar.gz'}], + 'checksums': ['33e7485cea3cac08d7a49a3a01d3013e1156128867602bff0a8e32b2c5ebd4e9'], + }), + ('torch-tb-profiler', '0.4.1', { + 'modulename': 'torch.profiler', + 'sources': ['torch_tb_profiler-%(version)s.tar.gz'], + 'checksums': ['f2c7fb27d420be443ffde50ada655c19f76a245d21e7772de753196fd0967685'], + }), + # torchaudio-0.12.1 needs more work before it can be added +] + +sanity_pip_check = True + +moduleclass = 'ai' diff --git a/easybuild/easyconfigs/p/PyTorch-bundle/torchtext-0.13.1_cxx_17.patch b/easybuild/easyconfigs/p/PyTorch-bundle/torchtext-0.13.1_cxx_17.patch new file mode 100644 index 00000000000..c980e7c2ebf --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch-bundle/torchtext-0.13.1_cxx_17.patch @@ -0,0 +1,19 @@ +The error "string_view has not been declared in std" appears when not using C++17 +Split from "deps_fix" patch from torchtext +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1ead15d46..879118c60 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -24,10 +24,10 @@ string(FIND "${CMAKE_CXX_FLAGS}" "-std=c++" env_cxx_standard) + if(env_cxx_standard GREATER -1) + message( + WARNING "C++ standard version definition detected in environment variable." +- "PyTorch requires -std=c++14. Please remove -std=c++ settings in your environment.") ++ "PyTorch requires -std=c++17. Please remove -std=c++ settings in your environment.") + endif() + +-set(CMAKE_CXX_STANDARD 14) ++set(CMAKE_CXX_STANDARD 17) + set(CMAKE_C_STANDARD 11) + + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/easybuild/easyconfigs/p/PyTorch-bundle/torchtext-0.13.1_use-system-libs.patch b/easybuild/easyconfigs/p/PyTorch-bundle/torchtext-0.13.1_use-system-libs.patch new file mode 100644 index 00000000000..d0902da8c9e --- /dev/null +++ b/easybuild/easyconfigs/p/PyTorch-bundle/torchtext-0.13.1_use-system-libs.patch @@ -0,0 +1,67 @@ +Use external deps for third party libraries +Split from "deps_fix" patch from torchtext +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1ead15d46..21f85e555 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,5 +63,9 @@ endif() + # TORCH_CXX_FLAGS contains the same -D_GLIBCXX_USE_CXX11_ABI value as PyTorch + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ${TORCH_CXX_FLAGS}") + +-add_subdirectory(third_party) ++find_package(double-conversion) ++find_package(re2) ++find_library(SENTENCEPIECE_LIBRARY sentencepiece PATHS $ENV{EBROOTSENTENCEPIECE}/lib64) ++find_library(SENTENCEPIECE_TRAIN_LIBRARY sentencepiece_train PATHS $ENV{EBROOTSENTENCEPIECE}/lib64) ++find_library(UTF8PROC_LIBRARY utf8proc PATHS $ENV{UTF8PROC}/lib64) + add_subdirectory(torchtext/csrc) +diff --git a/packaging/build_wheel.sh b/packaging/build_wheel.sh +index 9882cb1b2..43e2a05d8 100755 +--- a/packaging/build_wheel.sh ++++ b/packaging/build_wheel.sh +@@ -10,7 +10,6 @@ setup_env + setup_wheel_python + pip_install numpy future cmake>=3.18.0 ninja + setup_pip_pytorch_version +-git submodule update --init --recursive + python setup.py clean + if [[ "$OSTYPE" == "msys" ]]; then + "$script_dir/vc_env_helper.bat" python setup.py bdist_wheel +diff --git a/setup.py b/setup.py +index 080415f7e..bd84405be 100644 +--- a/setup.py ++++ b/setup.py +@@ -68,7 +68,6 @@ class clean(distutils.command.clean.clean): + # Remove build directory + build_dirs = [ + ROOT_DIR / "build", +- ROOT_DIR / "third_party" / "build", + ] + for path in build_dirs: + if path.exists(): +diff --git a/torchtext/csrc/CMakeLists.txt b/torchtext/csrc/CMakeLists.txt +index 037f814dc..658b90342 100644 +--- a/torchtext/csrc/CMakeLists.txt ++++ b/torchtext/csrc/CMakeLists.txt +@@ -24,10 +24,6 @@ set( + set( + LIBTORCHTEXT_INCLUDE_DIRS + ${PROJECT_SOURCE_DIR} +- ${PROJECT_SOURCE_DIR}/third_party/sentencepiece/src +- $ +- $ +- $ + ${TORCH_INSTALL_PREFIX}/include + ${TORCH_INSTALL_PREFIX}/include/torch/csrc/api/include + ) +@@ -123,10 +119,6 @@ if (BUILD_TORCHTEXT_PYTHON_EXTENSION) + set( + EXTENSION_INCLUDE_DIRS + ${PROJECT_SOURCE_DIR} +- ${PROJECT_SOURCE_DIR}/third_party/sentencepiece/src +- $ +- $ +- $ + ${TORCH_INSTALL_PREFIX}/include + ${TORCH_INSTALL_PREFIX}/include/torch/csrc/api/include + )