summaryrefslogtreecommitdiffstats
path: root/libraries
diff options
context:
space:
mode:
author Johannes Schoepfer2024-05-24 15:47:36 +0200
committer Willy Sudiarto Raharjo2024-05-24 18:28:20 +0200
commitfa7504ba35ccd06d6649d31101f9ef8222eb13a9 (patch)
tree83d73529ef69423fe4f599fdccdc030cf00e1a3e /libraries
parent539ecd59a9305de63d6e1b9568966baf2d7b0a38 (diff)
downloadslackbuilds-fa7504ba35ccd06d6649d31101f9ef8222eb13a9.tar.gz
libraries/pytorch: Update script.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'libraries')
-rw-r--r--libraries/pytorch/README6
-rw-r--r--libraries/pytorch/pytorch.SlackBuild51
-rw-r--r--libraries/pytorch/pytorch.info2
3 files changed, 30 insertions, 29 deletions
diff --git a/libraries/pytorch/README b/libraries/pytorch/README
index a27962167a..34bcd6aac5 100644
--- a/libraries/pytorch/README
+++ b/libraries/pytorch/README
@@ -1,3 +1,7 @@
Deep neural networks built on a tape-based autograd system.
-This package is a library build, supporting CPU(not GPU).
+CUDA(nvidia GPU) support is untested, but might be picked up
+at buildtime if the environment is present.
+
+Optional autodetected dependencies:
+OpenBLAS || blas
diff --git a/libraries/pytorch/pytorch.SlackBuild b/libraries/pytorch/pytorch.SlackBuild
index 76967ea5c5..30ac0a2b9f 100644
--- a/libraries/pytorch/pytorch.SlackBuild
+++ b/libraries/pytorch/pytorch.SlackBuild
@@ -26,7 +26,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=pytorch
VERSION=${VERSION:-2.3.0}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -68,7 +68,7 @@ set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
-rm -rf v$PRGNAM-$VERSION
+rm -rf $PRGNAM-v$VERSION
tar xvf $CWD/$PRGNAM-v$VERSION.tar.gz
cd $PRGNAM-v$VERSION
chown -R root:root .
@@ -78,50 +78,47 @@ chmod -R u+w,go-w,a+rX-st $PKG
sed -i c10/CMakeLists.txt \
-e "s;DESTINATION lib;DESTINATION lib$LIBDIRSUFFIX;g"
-mkdir -p build
+# Make Vulkan Warnings not to make the build fail
+sed -i "/Werror=return-type/d" CMakeLists.txt
+
+# When compiled with icecream, building dnnl-mkl outputs errors like "unspellable token PRAGMA_EOL".
+# This seems harmless as these get recompiled again locally, but it slows down the building process.
+# See https://github.com/icecc/icecream/issues/336
+
+export USE_NNPACK=0
+python3 setup.py build --cmake-only
+
cd build
unshare -n cmake \
+ -G Ninja \
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
+ -DCMAKE_CXX_STANDARD=17 \
-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 \
+ -DBUILD_TEST=OFF \
-DUSE_FFMPEG=ON \
- -DUSE_KINETO=OFF \
- -DUSE_MKLDNN=OFF \
- -DUSE_MPI=OFF \
- -DUSE_NCCL=OFF \
+ -DUSE_GOLD_LINKER=ON \
-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 \
+ -DUSE_VULKAN=ON \
-DCMAKE_BUILD_TYPE=Release ..
- make
- make install/strip DESTDIR=tmpxxx
+ "${NINJA:=ninja}"
+ DESTDIR=tmpxxx $NINJA install/strip
mkdir -p $PKG/usr
- mv tmpxxx/usr/include $PKG/usr
- mkdir -p $PKG/usr/share
- mv tmpxxx/usr/share/cmake $PKG/usr/share
+ mv tmpxxx/usr/bin $PKG/usr
mkdir -p $PKG/usr/lib$LIBDIRSUFFIX
mv tmpxxx/usr/lib$LIBDIRSUFFIX/*.so $PKG/usr/lib$LIBDIRSUFFIX
cd ..
+python3 setup.py install --root=$PKG
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a LICENSE NOTICE README.md RELEASE.md $PKG/usr/doc/$PRGNAM-$VERSION
diff --git a/libraries/pytorch/pytorch.info b/libraries/pytorch/pytorch.info
index f8cd244420..175aa944be 100644
--- a/libraries/pytorch/pytorch.info
+++ b/libraries/pytorch/pytorch.info
@@ -5,6 +5,6 @@ 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"
+REQUIRES="protobuf3 typing-extensions"
MAINTAINER="Johannes Schoepfer"
EMAIL="slackbuilds@schoepfer.info"