diff options
author | Johannes Schoepfer <slackbuilds@schoepfer.info> | 2024-04-29 21:03:35 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2024-05-04 21:45:01 +0700 |
commit | aefd74929953000668ba5908f73cfda746b1e981 (patch) | |
tree | f43ce802e73fd2706a7c5931d94a7bd1b1192a72 /libraries | |
parent | b2f7b66ed9705265dc82a1055642690baad94939 (diff) |
libraries/pytorch: Added (machine learning library).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/pytorch/README | 3 | ||||
-rw-r--r-- | libraries/pytorch/pytorch.SlackBuild | 134 | ||||
-rw-r--r-- | libraries/pytorch/pytorch.info | 10 | ||||
-rw-r--r-- | libraries/pytorch/slack-desc | 19 |
4 files changed, 166 insertions, 0 deletions
diff --git a/libraries/pytorch/README b/libraries/pytorch/README new file mode 100644 index 000000000000..a27962167abd --- /dev/null +++ b/libraries/pytorch/README @@ -0,0 +1,3 @@ +Deep neural networks built on a tape-based autograd system. + +This package is a library build, supporting CPU(not GPU). diff --git a/libraries/pytorch/pytorch.SlackBuild b/libraries/pytorch/pytorch.SlackBuild new file mode 100644 index 000000000000..76967ea5c509 --- /dev/null +++ b/libraries/pytorch/pytorch.SlackBuild @@ -0,0 +1,134 @@ +#!/bin/bash + +# Slackware build script for pytorch + +# Copyright 2024 Johannes Schoepfer, Germany +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=pytorch +VERSION=${VERSION:-2.3.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +elif [ "$ARCH" = "aarch64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "arm" ]; then + SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard" +else + SLKCFLAGS="-O2" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf v$PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-v$VERSION.tar.gz +cd $PRGNAM-v$VERSION +chown -R root:root . +chmod -R u+w,go-w,a+rX-st $PKG + +# Fix cmake libdir location +sed -i c10/CMakeLists.txt \ + -e "s;DESTINATION lib;DESTINATION lib$LIBDIRSUFFIX;g" + +mkdir -p build +cd build + unshare -n cmake \ + -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_INSTALL_PREFIX="/usr" \ + -DLIBSHM_INSTALL_LIB_SUBDIR="lib$LIBDIRSUFFIX" \ + -DTORCH_INSTALL_LIB_DIR="lib$LIBDIRSUFFIX" \ + -DPYTHON_EXECUTABLE=$(which python3) \ + -DBUILD_TEST=OFF \ + -DBUILD_CAFFE2=OFF \ + -DBUILD_CAFFE2_OPS=OFF \ + -DBUILD_PYTHON=OFF \ + -DBUILD_CUSTOM_PROTOBUF=OFF \ + -DUSE_CUDA=OFF \ + -DUSE_CUDNN=OFF \ + -DUSE_FBGEMM=OFF \ + -DUSE_FFMPEG=ON \ + -DUSE_KINETO=OFF \ + -DUSE_MKLDNN=OFF \ + -DUSE_MPI=OFF \ + -DUSE_NCCL=OFF \ + -DUSE_NNPACK=OFF \ + -DUSE_OPENMP=OFF \ + -DUSE_OPENCL=ON \ + -DUSE_OPENCV=ON \ + -DUSE_PTHREADPOOL=OFF \ + -DUSE_PYTORCH_QNNPACK=OFF \ + -DUSE_QNNPACK=OFF \ + -DUSE_SYSTEM_TBB=ON \ + -DUSE_XNNPACK=OFF \ + -Wno-dev \ + -DUSE_DISTRIBUTED=OFF \ + -DCMAKE_BUILD_TYPE=Release .. + make + make install/strip DESTDIR=tmpxxx + + mkdir -p $PKG/usr + mv tmpxxx/usr/include $PKG/usr + mkdir -p $PKG/usr/share + mv tmpxxx/usr/share/cmake $PKG/usr/share + mkdir -p $PKG/usr/lib$LIBDIRSUFFIX + mv tmpxxx/usr/lib$LIBDIRSUFFIX/*.so $PKG/usr/lib$LIBDIRSUFFIX +cd .. + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE NOTICE README.md RELEASE.md $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/libraries/pytorch/pytorch.info b/libraries/pytorch/pytorch.info new file mode 100644 index 000000000000..f8cd24442009 --- /dev/null +++ b/libraries/pytorch/pytorch.info @@ -0,0 +1,10 @@ +PRGNAM="pytorch" +VERSION="2.3.0" +HOMEPAGE="https://pytorch.org/" +DOWNLOAD="UNSUPPORTED" +MD5SUM="" +DOWNLOAD_x86_64="https://github.com/pytorch/pytorch/releases/download/v2.3.0/pytorch-v2.3.0.tar.gz" +MD5SUM_x86_64="786047d07da744410eb41493a1cd0687" +REQUIRES="oneTBB protobuf3 OpenBLAS typing-extensions" +MAINTAINER="Johannes Schoepfer" +EMAIL="slackbuilds@schoepfer.info" diff --git a/libraries/pytorch/slack-desc b/libraries/pytorch/slack-desc new file mode 100644 index 000000000000..72ee22b5247b --- /dev/null +++ b/libraries/pytorch/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +pytorch: pytorch (Tensors and Dynamic neural networks in Python) +pytorch: +pytorch: Deep neural networks built on a tape-based autograd system. +pytorch: +pytorch: This package is a library build, supporting CPU(not GPU). +pytorch: +pytorch: +pytorch: +pytorch: +pytorch: https://pytorch.org +pytorch: |