diff --git a/misc/py-pytorch/Makefile b/misc/py-pytorch/Makefile index 116c8e22bde7..74e8043f8e79 100644 --- a/misc/py-pytorch/Makefile +++ b/misc/py-pytorch/Makefile @@ -1,128 +1,129 @@ PORTNAME= pytorch DISTVERSIONPREFIX= v -DISTVERSION= 2.12.0 +DISTVERSION= 2.12.1 CATEGORIES= misc # machine-learning MASTER_SITES= https://github.com/pytorch/pytorch/releases/download/v${DISTVERSION}/ PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} DISTFILES= ${PORTNAME}-${DISTVERSIONFULL}${EXTRACT_SUFX} # the main tarball disappears when GH_xx tags are added w/out this line DIST_SUBDIR= ${PORTNAME} MAINTAINER= yuri@FreeBSD.org COMMENT= PyTorch: Tensors and dynamic neural networks in Python WWW= https://pytorch.org/ \ https://github.com/pytorch/pytorch LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE BROKEN_aarch64= build fails: CMake Error at third_party/QNNPACK/CMakeLists.txt:47 (MESSAGE): Unrecognized CMAKE_SYSTEM_NAME = FreeBSD, see https://github.com/pytorch/pytorch/issues/144608 BROKEN_armv7= build fails: CMake Error at third_party/QNNPACK/CMakeLists.txt:47 (MESSAGE): Unrecognized CMAKE_SYSTEM_NAME = FreeBSD, see https://github.com/pytorch/pytorch/issues/144608 BROKEN_i386= build fails: DispatchStub.cpp:162:29: [0m[0;1;31merror: [0m[1muse of undeclared identifier 'AVX2'[0m BUILD_DEPENDS= ${PY_SETUPTOOLS} \ cmake:devel/cmake-core \ gmake:devel/gmake \ pybind11>0:devel/pybind11 \ ${PYTHON_PKGNAMEPREFIX}numpy>=1.16:math/py-numpy@${PY_FLAVOR} \ ${LOCALBASE}/include/fxdiv.h:devel/fxdiv \ ${PYTHON_PKGNAMEPREFIX}filelock>0:sysutils/py-filelock@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}fsspec>0:filesystems/py-fsspec@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}hypothesis>0:devel/py-hypothesis@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}optree>0:devel/py-optree@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}packaging>0:devel/py-packaging@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}psutil>0:sysutils/py-psutil@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pyyaml>0:devel/py-pyyaml@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}requests>0:www/py-requests@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}sympy>=1.13.3:math/py-sympy@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}typing-extensions>0:devel/py-typing-extensions@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR} LIB_DEPENDS= libabsl_base.so:devel/abseil \ libonnx.so:misc/onnx \ libopenblas.so:math/openblas \ libprotobuf.so:devel/protobuf \ libsleef.so:math/sleef RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}filelock>0:sysutils/py-filelock@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}fsspec>0:filesystems/py-fsspec@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}networkx>0:math/py-networkx@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}numpy>=1.16:math/py-numpy@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}sympy>=1.13.3:math/py-sympy@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}typing-extensions>=4.10.0:devel/py-typing-extensions@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pyyaml>0:devel/py-pyyaml@${PY_FLAVOR} RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}astunparse>0:devel/py-astunparse@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}dill>0:devel/py-dill@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}protobuf>0:devel/py-protobuf@${PY_FLAVOR} # optional dependencies TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest-rerunfailures>0:devel/py-pytest-rerunfailures@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pytest-xdist>0:devel/py-pytest-xdist@${PY_FLAVOR} USES= compiler:c++17-lang localbase:ldflags mpi:openmpi python USE_PYTHON= pep517 autoplist USE_LDCONFIG= ${PYTHON_SITELIBDIR}/torch/lib # The Python package is named "torch" not "pytorch" PYDISTUTILS_PKGNAME= torch PEP517_INSTALL_CMD= ${PYTHON_CMD} -m installer --destdir ${STAGEDIR} --prefix ${PREFIX} ${BUILD_WRKSRC}/dist/torch-${DISTVERSION}*.whl USE_GITHUB= nodefault GH_TUPLE= pytorch:cpuinfo:bc3c01e:cpuinfo/cpuinfo-with-freebsd-support # https://github.com/pytorch/cpuinfo/pull/230/commits 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 MAKE_ENV+= USE_QNNPACK=0 MAKE_ENV+= USE_DISTRIBUTED=1 LDFLAGS+= -lexecinfo LDFLAGS_powerpc64le= -pthread BINARY_ALIAS= make=${GMAKE} TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} \ TORCHINDUCTOR_CACHE_DIR=${WRKDIR}/torchinductor_cache TEST_WRKSRC= ${WRKSRC}/test OPTIONS_DEFINE= VULKAN OPTIONS_DEFAULT= VULKAN # VULKAN is experimental in PyTorch and only simple computations work VULKAN_MAKE_ENV= USE_VULKAN=1 USE_VULKAN_SHADERC_RUNTIME=1 USE_VULKAN_WRAPPER=0 # see https://docs.pytorch.org/tutorials/unstable/vulkan_workflow.html VULKAN_BUILD_DEPENDS= glslc:graphics/shaderc \ vulkan-headers>0:graphics/vulkan-headers VULKAN_LIB_DEPENDS= libvulkan.so:graphics/vulkan-loader .include post-patch: @cd ${WRKSRC} && \ ${RM} -r third_party/cpuinfo third_party/fbgemm/external/cpuinfo && \ ${CP} -r cpuinfo-with-freebsd-support third_party/cpuinfo && \ ${CP} -r cpuinfo-with-freebsd-support third_party/fbgemm/external/cpuinfo # change hardcoded compiler in torch/_inductor/config.py @${REINPLACE_CMD} -e 's|"g++"|"${CXX}"|' \ ${WRKSRC}/torch/_inductor/config.py do-install: # port should be moved to 'torch', but keep this for now with the hardcoded 'torch' name @${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} @cd ${INSTALL_WRKSRC} && ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${PEP517_INSTALL_CMD} @${PYTHON_CMD} -B ${PORTSDIR}/Mk/Scripts/strip_RECORD.py \ ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/torch-${DISTVERSION}*.dist-info/RECORD >> ${_PYTHONPKGLIST} @${REINPLACE_CMD} \ -e '/\.pyc$$/d' \ -e 's|^|${PYTHONPREFIX_SITELIBDIR}/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../etc/|etc/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../bin/|bin/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../include/|include/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../lib/|lib/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../libdata/|libdata/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../libexec/|libexec/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../man/|man/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../sbin/|sbin/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../share/|share/|' \ ${_PYTHONPKGLIST} @cd ${STAGEDIR}${PREFIX} && ${FIND} lib -name '*.pyc' >> ${_PYTHONPKGLIST} do-test: @cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} run_test.py .include diff --git a/misc/py-pytorch/distinfo b/misc/py-pytorch/distinfo index 9a21ad097936..d0c3dc8e367f 100644 --- a/misc/py-pytorch/distinfo +++ b/misc/py-pytorch/distinfo @@ -1,5 +1,5 @@ -TIMESTAMP = 1778898276 -SHA256 (pytorch/pytorch-v2.12.0.tar.gz) = 7cc1deb309f402ad67e9f45bbe311a40def4db19d66fddb9b01950f9bfc5ccb1 -SIZE (pytorch/pytorch-v2.12.0.tar.gz) = 430864016 +TIMESTAMP = 1783290452 +SHA256 (pytorch/pytorch-v2.12.1.tar.gz) = 757145cfd55c7c8c01f58c959f76230641cc67fdd1d8b6a130f93ad1bc116f5f +SIZE (pytorch/pytorch-v2.12.1.tar.gz) = 430918199 SHA256 (pytorch/pytorch-cpuinfo-bc3c01e_GH0.tar.gz) = 09459e830a588fee730feb19d8a32fedf2d36d48db7bd9b18c3159c7e74ea0ce SIZE (pytorch/pytorch-cpuinfo-bc3c01e_GH0.tar.gz) = 3547453 diff --git a/misc/pytorch/Makefile b/misc/pytorch/Makefile index 5d2ffd1193a8..c77ec051e08d 100644 --- a/misc/pytorch/Makefile +++ b/misc/pytorch/Makefile @@ -1,83 +1,83 @@ PORTNAME= pytorch DISTVERSIONPREFIX= v -DISTVERSION= 2.12.0 +DISTVERSION= 2.12.1 CATEGORIES= misc # machine-learning MASTER_SITES= https://github.com/pytorch/pytorch/releases/download/v${DISTVERSION}/ DIST_SUBDIR= ${PORTNAME} MAINTAINER= yuri@FreeBSD.org COMMENT= Tensors and dynamic neural networks in Python (C++ library) WWW= https://pytorch.org/ LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE BROKEN_aarch64= compilation fails: clang crashes, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294067 BROKEN_i386= compilation fails: error: use of undeclared identifier 'AVX2' BUILD_DEPENDS= ${LOCALBASE}/include/fxdiv.h:devel/fxdiv \ ${PYTHON_PKGNAMEPREFIX}packaging>=0:devel/py-packaging@${PY_FLAVOR} \ ${PY_SETUPTOOLS} LIB_DEPENDS= libabsl_base.so:devel/abseil \ libblis.so:math/blis \ libopenblas.so:math/openblas \ libmpi_cxx.so:net/openmpi4 \ libonnx.so:misc/onnx \ libpthreadpool.so:devel/pthreadpool \ libprotobuf.so:devel/protobuf \ libsleef.so:math/sleef USES= compiler:c++17-lang cmake:noninja gmake localbase:ldflags python # requires python even with PYTHON=off CMAKE_OFF= BUILD_CUSTOM_PROTOBUF USE_CUDA USE_ROCM USE_NNPACK USE_QNNPACK USE_PYTORCH_QNNPACK \ USE_FBGEMM # workaround recommended by the upstream here: https://github.com/pytorch/pytorch/issues/28337 CMAKE_OFF+= BUILD_TEST BUILD_AOT_INDUCTOR_TEST CMAKE_ON= USE_SYSTEM_PYBIND11 \ USE_SYSTEM_SLEEF \ USE_SYSTEM_ONNX # see other USE_SYSTEM_xx in CMakeLists.txt CMAKE_ON+= ONNX_USE_LITE_PROTO # workaround for the protobuf-related failure described here: https://github.com/onnx/optimizer/issues/38 CMAKE_ARGS= -DPSIMD_SOURCE_DIR=${WRKSRC}/third_party/psimd \ -DPYTHON_EXECUTABLE=${PYTHON_CMD} MAKE_ENV= USE_NINJA=no # ninja breaks for some reason LDFLAGS+= -lexecinfo \ -pthread BINARY_ALIAS= make=${GMAKE} git=true OPTIONS_DEFINE= PYTHON # PYTHON only provides python support for the py-PyTorch port - it's not a python binding OPTIONS_DEFAULT= PYTHON OPTIONS_SUB= yes PYTHON_CMAKE_BOOL= BUILD_PYTHON PYTHON_PY_DEPENDS= ${PYTHON_PKGNAMEPREFIX}numpy>=1.16:math/py-numpy@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}typing-extensions>0:devel/py-typing-extensions@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pyyaml>=0:devel/py-pyyaml@${PY_FLAVOR} PYTHON_BUILD_DEPENDS= ${PYTHON_PY_DEPENDS} \ ${PY_SETUPTOOLS} \ pybind11>0:devel/pybind11 PYTHON_RUN_DEPENDS= ${PYTHON_PY_DEPENDS} .include .if ${ARCH} == "amd64" PLIST_SUB+= AMD64="" .else PLIST_SUB+= AMD64="@comment " .endif post-patch: # replace malloc.h -> stdlib.h in many places @cd ${WRKSRC} && for f in $$(${GREP} -rl "include " * | ${GREP} -E "\.(c|cpp|h|hpp)$$"); do \ ${REINPLACE_CMD} -i'' -E "s|include |include |" $$f; \ done # remove bundled fmt @${RM} -r ${WRKSRC}/third_party/fmt post-install: # functorch.so is installed back into the source directory, see https://github.com/pytorch/pytorch/issues/91524 @${RM} $$(${FIND} ${STAGEDIR} -name functorch.so) # https://github.com/pytorch/pytorch/issues/24417 @${FIND} ${STAGEDIR} -type d -empty -delete .include diff --git a/misc/pytorch/distinfo b/misc/pytorch/distinfo index 7c59e11d0a11..8ca7d7923c5f 100644 --- a/misc/pytorch/distinfo +++ b/misc/pytorch/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1778907831 -SHA256 (pytorch/pytorch-v2.12.0.tar.gz) = 7cc1deb309f402ad67e9f45bbe311a40def4db19d66fddb9b01950f9bfc5ccb1 -SIZE (pytorch/pytorch-v2.12.0.tar.gz) = 430864016 +TIMESTAMP = 1783290451 +SHA256 (pytorch/pytorch-v2.12.1.tar.gz) = 757145cfd55c7c8c01f58c959f76230641cc67fdd1d8b6a130f93ad1bc116f5f +SIZE (pytorch/pytorch-v2.12.1.tar.gz) = 430918199