add pytorch pkg to mariner (#4757)

* Add pytorch package with version 1.13.1

---------

Co-authored-by: Pawel Winogrodzki <pawelwi@microsoft.com>
This commit is contained in:
Mandeep Plaha 2023-02-14 08:52:10 -08:00 committed by GitHub
parent c365fa8e7e
commit 06ef5aa4c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 220 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -2323,6 +2323,12 @@
"perftest"
]
},
"OpenEuler": {
"license": "[BSD-3 License](https://github.com/pytorch/pytorch/blob/master/LICENSE)",
"specs": [
"pytorch"
]
},
"OpenMamba": {
"license": "[Openmamba GPLv2 License](https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)",
"specs": [

View File

@ -0,0 +1,102 @@
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
set -e
SRC_TARBALL=""
OUT_FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PKG_VERSION=""
# parameters:
#
# --srcTarball : src tarball file
# this file contains the 'initial' source code of the component
# and should be replaced with the new/modified src code
# --outFolder : folder where to copy the new tarball(s)
# --pkgVersion : package version
#
PARAMS=""
while (( "$#" )); do
case "$1" in
--srcTarball)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
SRC_TARBALL=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
--outFolder)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
OUT_FOLDER=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
--pkgVersion)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
PKG_VERSION=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
-*|--*=) # unsupported flags
echo "Error: Unsupported flag $1" >&2
exit 1
;;
*) # preserve positional arguments
PARAMS="$PARAMS $1"
shift
;;
esac
done
echo "--srcTarball -> $SRC_TARBALL"
echo "--outFolder -> $OUT_FOLDER"
echo "--pkgVersion -> $PKG_VERSION"
if [ -z "$PKG_VERSION" ]; then
echo "--pkgVersion parameter cannot be empty"
exit 1
fi
echo "-- create temp folder"
TEMPDIR=$(mktemp -d)
function cleanup {
echo "+++ cleanup -> remove $TEMPDIR"
rm -rf $TEMPDIR
}
trap cleanup EXIT
echo 'Starting pytorch source tarball creation'
cd $TEMPDIR
git clone --depth 1 https://github.com/pytorch/pytorch.git
pushd pytorch
git fetch --all --tags
git checkout tags/v$PKG_VERSION -b pytorch-$PKG_VERSION
git submodule update --init --recursive
popd
mv pytorch/third_party third_party
mkdir -pv android
mv pytorch/android/libs android
TARBALL_NAME="pytorch-$PKG_VERSION-submodules.tar.gz"
NEW_TARBALL="$OUT_FOLDER/$TARBALL_NAME"
# Create a reproducible tarball
# Credit to https://reproducible-builds.org/docs/archives/ for instructions
# Do not update mtime value for new versions- keep the same value for ease of
# reproducing old tarball versions in the future if necessary
tar --sort=name --mtime="2021-11-10 00:00Z" \
--owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
-zcf $NEW_TARBALL third_party android
echo "Source tarball $NEW_TARBALL successfully created!"

View File

@ -0,0 +1,6 @@
{
"Signatures": {
"pytorch-1.13.1-submodules.tar.gz": "04966e5e38c3479d1ed6eb5267326eca8c0ee3812b0e444fa026b848829e1660",
"pytorch-1.13.1.tar.gz": "c54427bdd371c76176e69d5ef74770b515c8a61e9bc0541bdabafae8d93b6cdf"
}
}

View File

@ -0,0 +1,94 @@
%global _empty_manifest_terminate_build 0
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration.
Name: pytorch
Version: 1.13.1
Release: 1%{?dist}
License: BSD-3-Clause
Vendor: Microsoft Corporation
Distribution: Mariner
Group: Development/Languages/Python
URL: https://pytorch.org/
Source0: https://github.com/pytorch/pytorch/releases/download/v%{version}/%{name}-v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# Use the generate_source_tarball.sh script to create a tarball of submodules during version updates.
Source1: %{name}-%{version}-submodules.tar.gz
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: python3-PyYAML
BuildRequires: python3-devel
BuildRequires: python3-filelock
BuildRequires: python3-hypothesis
BuildRequires: python3-jinja2
BuildRequires: python3-numpy
BuildRequires: python3-setuptools
BuildRequires: python3-typing-extensions
%description
PyTorch is a Python package that provides two high-level features:
- Tensor computation (like NumPy) with strong GPU acceleration
- Deep neural networks built on a tape-based autograd system
You can reuse your favorite Python packages such as NumPy, SciPy and Cython to extend PyTorch when needed.
%package -n python3-pytorch
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration.
Requires: python3-filelock
Requires: python3-numpy
Requires: python3-typing-extensions
%description -n python3-pytorch
PyTorch is a Python package that provides two high-level features:
- Tensor computation (like NumPy) with strong GPU acceleration
- Deep neural networks built on a tape-based autograd system
You can reuse your favorite Python packages such as NumPy, SciPy and Cython to extend PyTorch when needed.
%package -n python3-pytorch-doc
Summary: Development documents and examples for torch
%description -n python3-pytorch-doc
PyTorch is a Python package that provides two high-level features:
- Tensor computation (like NumPy) with strong GPU acceleration
- Deep neural networks built on a tape-based autograd system
You can reuse your favorite Python packages such as NumPy, SciPy and Cython to extend PyTorch when needed.
%prep
%autosetup -a 1
%build
export USE_CUDA=0
export BUILD_CAFFE2=0
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
cp -arf docs %{buildroot}/%{_pkgdocdir}
%files -n python3-pytorch
%license LICENSE
%{_bindir}/convert-caffe2-to-onnx
%{_bindir}/convert-onnx-to-caffe2
%{_bindir}/torchrun
%{python3_sitearch}/*
%files -n python3-pytorch-doc
%license LICENSE
%{_docdir}/*
%changelog
* Thu Feb 02 2023 Mandeep Plaha <mandeepplaha@microsoft.com> - 1.13.1-1
- Initial CBL-Mariner import from OpenEuler (license: BSD)
- License verified
- Upgrade version to 1.13.1
* Mon Jun 13 2022 Zhipeng Xie <xiezhipeng1@huawei.com> - 1.11.0-1
- upgrade to 1.11.0
* Mon Jun 28 2021 wulei <wulei80@huawei.com> - 1.6.0-3
- fixes: error: the CXX compiler identification is unknown
* Thu Feb 4 2021 Zhipeng Xie<xiezhipeng1@huawei.com> - 1.6.0-2
- disable SVE to fix compile error in gcc 9
* Sun Sep 27 2020 Zhipeng Xie<xiezhipeng1@huawei.com> - 1.6.0-1
- Package init

View File

@ -23859,6 +23859,16 @@
}
}
},
{
"component": {
"type": "other",
"other": {
"name": "pytorch",
"version": "1.13.1",
"downloadUrl": "https://github.com/pytorch/pytorch/releases/download/v1.13.1/pytorch-v1.13.1.tar.gz"
}
}
},
{
"component": {
"type": "other",

View File

@ -16,6 +16,7 @@ VALID_SOURCE_ATTRIBUTIONS = {
"Fedora (Copyright Remi Collet)": r'\n-\s+Initial CBL-Mariner import from Fedora \d+ \(license: CC-BY-SA\)(\.|\n|$)',
"Magnus Edenhill Open Source": r'\n-\s+Initial CBL-Mariner import from Magnus Edenhill Open Source \(license: BSD\)(\.|\n|$)',
"NVIDIA": r'\n-\s+Initial CBL-Mariner import from NVIDIA \(license: (ASL 2\.0|GPLv2)\)(\.|\n|$)',
"OpenEuler": r'\n-\s+Initial CBL-Mariner import from OpenEuler \(license: BSD\)(\.|\n|$)',
"OpenMamba": r'\n-\s+Initial CBL-Mariner import from OpenMamba(\.|\n|$)',
"OpenSUSE": r'\n-\s+Initial CBL-Mariner import from openSUSE \w+ \(license: same as "License" tag\)(\.|\n|$)',
"Photon": r'\n-\s+Initial CBL-Mariner import from Photon \(license: Apache2\)(\.|\n|$)',