From 0500a3cec05c353efc01e147d140901b2f638d51 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Mon, 20 Feb 2023 02:12:20 -0700 Subject: py-torchbenchmark: add new package (#35443) --- .../builtin/packages/py-accelerate/package.py | 22 ++++++++ .../repos/builtin/packages/py-iopath/package.py | 20 +++++++ .../repos/builtin/packages/py-libcst/package.py | 22 ++++++++ .../builtin/packages/py-monkeytype/package.py | 19 +++++++ .../repos/builtin/packages/py-patch/package.py | 17 ++++++ .../builtin/packages/py-torchbenchmark/package.py | 65 ++++++++++++++++++++++ .../builtin/packages/py-typing-inspect/package.py | 19 +++++++ 7 files changed, 184 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-accelerate/package.py create mode 100644 var/spack/repos/builtin/packages/py-iopath/package.py create mode 100644 var/spack/repos/builtin/packages/py-libcst/package.py create mode 100644 var/spack/repos/builtin/packages/py-monkeytype/package.py create mode 100644 var/spack/repos/builtin/packages/py-patch/package.py create mode 100644 var/spack/repos/builtin/packages/py-torchbenchmark/package.py create mode 100644 var/spack/repos/builtin/packages/py-typing-inspect/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/py-accelerate/package.py b/var/spack/repos/builtin/packages/py-accelerate/package.py new file mode 100644 index 0000000000..3456c55ac2 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-accelerate/package.py @@ -0,0 +1,22 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class PyAccelerate(PythonPackage): + """A simple way to train and use PyTorch models with multi-GPU, TPU, mixed-precision.""" + + homepage = "https://github.com/huggingface/accelerate" + pypi = "accelerate/accelerate-0.16.0.tar.gz" + + version("0.16.0", sha256="d13e30f3e6debfb46cada7b931af85560619b6a6a839d0cafeeab6ed7c6a498d") + + depends_on("py-setuptools", type="build") + depends_on("py-numpy@1.17:", type=("build", "run")) + depends_on("py-packaging@20:", type=("build", "run")) + depends_on("py-psutil", type=("build", "run")) + depends_on("py-pyyaml", type=("build", "run")) + depends_on("py-torch@1.4:", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/py-iopath/package.py b/var/spack/repos/builtin/packages/py-iopath/package.py new file mode 100644 index 0000000000..576454c6fa --- /dev/null +++ b/var/spack/repos/builtin/packages/py-iopath/package.py @@ -0,0 +1,20 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class PyIopath(PythonPackage): + """A library for providing I/O abstraction.""" + + homepage = "https://github.com/facebookresearch/iopath" + pypi = "iopath/iopath-0.1.10.tar.gz" + + version("0.1.10", sha256="3311c16a4d9137223e20f141655759933e1eda24f8bff166af834af3c645ef01") + + depends_on("py-setuptools", type="build") + depends_on("py-tqdm", type=("build", "run")) + depends_on("py-typing-extensions", type=("build", "run")) + depends_on("py-portalocker", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/py-libcst/package.py b/var/spack/repos/builtin/packages/py-libcst/package.py new file mode 100644 index 0000000000..0978f4067a --- /dev/null +++ b/var/spack/repos/builtin/packages/py-libcst/package.py @@ -0,0 +1,22 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class PyLibcst(PythonPackage): + """A Concrete Syntax Tree (CST) parser and serializer library for Python.""" + + homepage = "https://github.com/Instagram/LibCST" + pypi = "libcst/libcst-0.4.9.tar.gz" + + version("0.4.9", sha256="01786c403348f76f274dbaf3888ae237ffb73e6ed6973e65eba5c1fc389861dd") + + depends_on("py-setuptools", type="build") + depends_on("py-setuptools-rust", type="build") + depends_on("py-setuptools-scm", type="build") + depends_on("py-typing-extensions@3.7.4.2:", type=("build", "run")) + depends_on("py-typing-inspect@0.4:", type=("build", "run")) + depends_on("py-pyyaml@5.2:", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/py-monkeytype/package.py b/var/spack/repos/builtin/packages/py-monkeytype/package.py new file mode 100644 index 0000000000..fc4e8d9733 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-monkeytype/package.py @@ -0,0 +1,19 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class PyMonkeytype(PythonPackage): + """Generating type annotations from sampled production types.""" + + homepage = "https://github.com/instagram/MonkeyType" + pypi = "MonkeyType/MonkeyType-22.2.0.tar.gz" + + version("22.2.0", sha256="6b0c00b49dcc5095a2c08d28246cf005e05673fc51f64d203f9a6bca2036dfab") + + depends_on("py-setuptools", type="build") + depends_on("py-mypy-extensions", type=("build", "run")) + depends_on("py-libcst@0.3.7:", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/py-patch/package.py b/var/spack/repos/builtin/packages/py-patch/package.py new file mode 100644 index 0000000000..379eb390b0 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-patch/package.py @@ -0,0 +1,17 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class PyPatch(PythonPackage): + """Library to parse and apply unified diffs.""" + + homepage = "https://github.com/techtonik/python-patch" + pypi = "patch/patch-1.16.zip" + + version("1.16", sha256="c62073f356cff054c8ac24496f1a3d7cfa137835c31e9af39a9f5292fd75bd9f") + + depends_on("py-setuptools", type="build") diff --git a/var/spack/repos/builtin/packages/py-torchbenchmark/package.py b/var/spack/repos/builtin/packages/py-torchbenchmark/package.py new file mode 100644 index 0000000000..f7bc42f99b --- /dev/null +++ b/var/spack/repos/builtin/packages/py-torchbenchmark/package.py @@ -0,0 +1,65 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class PyTorchbenchmark(Package): + """A collection of open source benchmarks used to evaluate PyTorch performance.""" + + homepage = "https://github.com/pytorch/benchmark" + git = "https://github.com/pytorch/benchmark.git" + + maintainers("adamjstewart") + + version("main", branch="main") + + # README.md + depends_on("python@3.8:+pythoncmd", type=("build", "run")) + depends_on("git-lfs", type=("build", "run")) + depends_on("py-torch", type=("build", "run")) + depends_on("py-torchaudio", type=("build", "run")) + depends_on("py-torchtext", type=("build", "run")) + depends_on("py-torchvision", type=("build", "run")) + + # requirements.txt + depends_on("py-accelerate", type=("build", "run")) + depends_on("py-beautifulsoup4", type=("build", "run")) + depends_on("py-patch", type=("build", "run")) + depends_on("py-py-cpuinfo", type=("build", "run")) + depends_on("py-distro", type=("build", "run")) + depends_on("py-iopath", type=("build", "run")) + depends_on("py-pytest", type=("build", "run")) + depends_on("py-pytest-benchmark", type=("build", "run")) + depends_on("py-requests", type=("build", "run")) + depends_on("py-tabulate", type=("build", "run")) + depends_on("py-timm", type=("build", "run")) + depends_on("py-transformers", type=("build", "run")) + depends_on("py-monkeytype", type=("build", "run")) + depends_on("py-psutil", type=("build", "run")) + depends_on("py-pyyaml", type=("build", "run")) + depends_on("py-numpy", type=("build", "run")) + depends_on("py-kornia", type=("build", "run")) + depends_on("py-scipy", type=("build", "run")) + depends_on("py-submitit", type=("build", "run")) + + # torchbenchmark/models/BERT_pytorch/setup.py + depends_on("py-setuptools", type="build") + + def patch(self): + # Avoid attempts to install dependencies + filter_file(r" = pip_install_requirements\(.*\)", " = True, 'skip'", "install.py") + filter_file( + r" = _install_deps\(.*\)", + " = (True, None, None)", + join_path("torchbenchmark", "__init__.py"), + ) + + def install(self, spec, prefix): + # Downloads datasets and models + python("install.py", "--verbose") + + # Copy to installation prefix + install_tree(".", prefix) diff --git a/var/spack/repos/builtin/packages/py-typing-inspect/package.py b/var/spack/repos/builtin/packages/py-typing-inspect/package.py new file mode 100644 index 0000000000..921a390477 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-typing-inspect/package.py @@ -0,0 +1,19 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class PyTypingInspect(PythonPackage): + """Runtime inspection utilities for typing module.""" + + homepage = "https://github.com/ilevkivskyi/typing_inspect" + pypi = "typing_inspect/typing_inspect-0.8.0.tar.gz" + + version("0.8.0", sha256="8b1ff0c400943b6145df8119c41c244ca8207f1f10c9c057aeed1560e4806e3d") + + depends_on("py-setuptools", type="build") + depends_on("py-mypy-extensions@0.3:", type=("build", "run")) + depends_on("py-typing-extensions@3.7.4:", type=("build", "run")) -- cgit v1.2.3-60-g2f50