git: 69026a954ab5 - main - misc/py-pytorch: Build with LAPACK

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Thu, 20 Jun 2024 10:24:30 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=69026a954ab5d65d19a416e6f30423c900b3190f

commit 69026a954ab5d65d19a416e6f30423c900b3190f
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-06-20 10:13:06 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-06-20 10:24:27 +0000

    misc/py-pytorch: Build with LAPACK
    
    Some operations require LAPACK when no GPU is present.
---
 misc/py-pytorch/Makefile                                 |  2 ++
 misc/py-pytorch/files/patch-cmake_Modules_FindBLAS.cmake | 13 +++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/misc/py-pytorch/Makefile b/misc/py-pytorch/Makefile
index b669c5870d2b..9ce91f587ace 100644
--- a/misc/py-pytorch/Makefile
+++ b/misc/py-pytorch/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	pytorch
 DISTVERSIONPREFIX=	v
 DISTVERSION=	2.3.1
+PORTREVISION=	1
 CATEGORIES=	misc # machine-learning
 MASTER_SITES=	https://github.com/pytorch/pytorch/releases/download/v${DISTVERSION}/
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -50,6 +51,7 @@ MAKE_ENV=	USE_NINJA=no # ninja breaks for some reason
 MAKE_ENV+=	BUILD_TEST=0 # ninja breaks for some reason
 MAKE_ENV+=	USE_MKLDNN=0 # disable MKLDNN that doesn't exist, see https://github.com/pytorch/pytorch/issues/100957
 MAKE_ENV+=	USE_CUDNN=0
+MAKE_ENV+=	USE_LAPACK=1 # needed on FreeBSD to run w/out GPU
 LDFLAGS+=	-lexecinfo
 
 BINARY_ALIAS=	make=${GMAKE}
diff --git a/misc/py-pytorch/files/patch-cmake_Modules_FindBLAS.cmake b/misc/py-pytorch/files/patch-cmake_Modules_FindBLAS.cmake
new file mode 100644
index 000000000000..8a4568a38522
--- /dev/null
+++ b/misc/py-pytorch/files/patch-cmake_Modules_FindBLAS.cmake
@@ -0,0 +1,13 @@
+- otherwise USE_LAPACK=1 fails to find lapack
+
+--- cmake/Modules/FindBLAS.cmake.orig	2024-06-20 08:11:50 UTC
++++ cmake/Modules/FindBLAS.cmake
+@@ -20,7 +20,7 @@ SET(BLAS_F2C)
+ SET(BLAS_INFO)
+ SET(BLAS_F2C)
+ 
+-SET(WITH_BLAS "" CACHE STRING "Blas type [accelerate/acml/atlas/blis/generic/goto/mkl/open/veclib]")
++SET(WITH_BLAS "open" CACHE STRING "Blas type [accelerate/acml/atlas/blis/generic/goto/mkl/open/veclib]")
+ 
+ # Old FindBlas
+ INCLUDE(CheckCSourceRuns)