<pre style='margin:0'>
Chris Jones (cjones051073) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/822a4c7c90024038da8fd1130910f80a975c54a8">https://github.com/macports/macports-ports/commit/822a4c7c90024038da8fd1130910f80a975c54a8</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 822a4c7c90024038da8fd1130910f80a975c54a8
</span>Author: Steven Thomas Smith <s.t.smith@ieee.org>
AuthorDate: Thu Jan 2 19:54:42 2020 -0500
<span style='display:block; white-space:pre;color:#404040;'> py-pytorch: Use opencv4, USE_METAL, add test
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> * Use opencv4 ,not opencv (v. 3)
</span><span style='display:block; white-space:pre;color:#404040;'> * Compile with USE_METAL
</span><span style='display:block; white-space:pre;color:#404040;'> * Add a test
</span><span style='display:block; white-space:pre;color:#404040;'> * Add necessary dependencies
</span>---
python/py-pytorch/Portfile | 101 +++++++++++++++++++++++++++++++++------------
1 file changed, 75 insertions(+), 26 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/python/py-pytorch/Portfile b/python/py-pytorch/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index d198596..98e5201 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/python/py-pytorch/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/python/py-pytorch/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1,15 +1,14 @@
</span> # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
<span style='display:block; white-space:pre;background:#ffe0e0;'>-PortSystem 1.0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-PortGroup python 1.0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-PortGroup cxx11 1.1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-PortGroup github 1.0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-PortGroup mpi 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortSystem 1.0
</span> PortGroup compiler_blacklist_versions 1.0
<span style='display:block; white-space:pre;background:#e0ffe0;'>+PortGroup github 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortGroup mpi 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortGroup python 1.0
</span>
name py-pytorch
version 1.3.1
<span style='display:block; white-space:pre;background:#ffe0e0;'>-revision 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision 1
</span> github.setup pytorch pytorch ${version} v
fetch.type git
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -20,20 +19,28 @@ license BSD
</span>
maintainers {jonesc @cjones051073} openmaintainer
<span style='display:block; white-space:pre;background:#ffe0e0;'>-description Tensors and dynamic neural networks in Python with strong GPU acceleration
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-long_description ${description}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+description Tensors and dynamic neural networks in Python\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ with strong GPU acceleration
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+long_description PyTorch is a Python package that provides two\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ high-level features: Tensor computation (like\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ NumPy) with strong GPU acceleration\; Deep neural\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ networks built on a tape-based autograd\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ system. You can reuse your favorite Python\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ packages such as NumPy, SciPy and Cython to extend\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ PyTorch when needed.
</span>
homepage https://pytorch.org/
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# Supported python versions.
</span> python.versions 36 37
<span style='display:block; white-space:pre;background:#ffe0e0;'>-python.default_version 37
</span>
patch.pre_args -p1
mpi.setup -gcc44 -gcc45 -clang33 -clang34 -clang37 -gfortran -g95
# Compiler selection
<span style='display:block; white-space:pre;background:#e0ffe0;'>+compiler.cxx_standard 2011
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> compiler.blacklist-append *gcc* {clang < 800} {macports-clang-3.[0-9]} macports-clang-4.0
variant mkl description {Enable Intel Math Kernel Library support} { }
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -56,7 +63,7 @@ if {${name} ne ${subport}} {
</span> port:gmp \
port:mpfr \
port:OpenBLAS \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- port:opencv \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:opencv4 \
</span> port:zmq \
port:zstd \
port:tbb \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -73,43 +80,85 @@ if {${name} ne ${subport}} {
</span> port:py${python.version}-yaml \
port:py${python.version}-torchtext
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_run-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:py${python.version}-onnx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> if {${python.version} < 35} {
depends_lib-append \
port:py${python.version}-typing
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- post-fetch { system -W ${worksrcpath} "git submodule update --init --recursive" }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # ZSTD support broke with 1.2.0. check with future releases.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set t_build_env "USE_ROCM=ON USE_NCCL=ON USE_LMDB=ON USE_LITE_PROTO=ON USE_LEVELDB=ON USE_GFLAGS=ON USE_GLOG=ON USE_OPENCV=ON USE_OPENMP=ON USE_CUDA=OFF USE_ZSTD=OFF USE_ZMQ=ON USE_TBB=ON CMAKE_LIBRARY_PATH=${prefix}:${prefix}/lib/libomp LIBRARY_PATH=${prefix}:${prefix}/lib/libomp"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set PythonVersionWithDot [join [split ${python.version} ""] "."]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set py_lib_root ${prefix}/Library/Frameworks/Python.framework/Versions/${PythonVersionWithDot}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ post-fetch {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ system -W ${worksrcpath} "git submodule update --init --recursive"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # Use Intel Math kernel Library
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Use Intel Math kernel Library
</span> if {[variant_isset mkl]} {
patchfiles-append FindMKL-OMP.patch
pre-build {
# Hacks to get search paths into builds
<span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace "s|/opt/intel/mkl|${py_lib_root}|g" cmake/Modules/FindMKL.cmake
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace "s|mklvers \"intel64\"|mklvers \"\"|g" cmake/Modules/FindMKL.cmake
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- reinplace "s|MACPORTS_PREFIX|${prefix}|g" cmake/Modules/FindMKL.cmake
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|/opt/intel/mkl|${python.prefix}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cmake/Modules/FindMKL.cmake
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|mklvers \"intel64\"|mklvers \"\"|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cmake/Modules/FindMKL.cmake
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|MACPORTS_PREFIX|${prefix}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cmake/Modules/FindMKL.cmake
</span> }
depends_lib-append port:py${python.version}-mkl
depends_build-append port:py${python.version}-mkl-include
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- build.cmd "${t_build_env} ${python.bin} setup.py"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- destroot.cmd "${t_build_env} ${python.bin} setup.py install"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # ZSTD support broke with 1.2.0-1.3.1. Check with future releases.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ build.env-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ CMAKE_LIBRARY_PATH=${prefix}/lib:${prefix}/lib/libomp \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ LIBRARY_PATH=${prefix}/lib:${prefix}/lib/libomp \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_CUDA=OFF \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_GFLAGS=ON \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_GLOG=ON \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_LEVELDB=ON \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_LITE_PROTO=ON \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_LMDB=ON \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_METAL=ON \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_NCCL=ON \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_OPENCV=ON \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_OPENMP=ON \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_ROCM=ON \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_TBB=ON \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_ZMQ=ON \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ USE_ZSTD=OFF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ build.dir ${worksrcpath}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ build.post_args
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ destroot.dir ${worksrcpath}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ destroot.target install
</span>
post-destroot {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set py_torch_root ${py_lib_root}/lib/python${PythonVersionWithDot}/site-packages/torch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set py_torch_root ${python.pkgd}/torch
</span> foreach slib [glob -directory ${destroot}${py_torch_root} *.so] {
system "install_name_tool -add_rpath ${py_torch_root}/lib ${slib}"
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set docdir ${prefix}/share/doc/${subport}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -d ${destroot}${docdir}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0644 -W ${worksrcpath} LICENSE README.md \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${docdir}
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- livecheck.type none
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # pytorch's tests all use GPU compilation
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { [lsearch build.env {USE_CUDA=OFF}] != -1 } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_test-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:py${python.version}-pytest
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pre-test {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ test.env \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ PYTHONPATH=[glob -nocomplain ${worksrcpath}/build/lib*]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ test.run yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ test.cmd py.test-${python.branch}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ test.target test/run_test.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ livecheck.type none
</span>
} else {
</pre><pre style='margin:0'>
</pre>