<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/1c003e9a9f540adc6b16d9e44bfea5a1059150d0">https://github.com/macports/macports-ports/commit/1c003e9a9f540adc6b16d9e44bfea5a1059150d0</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 1c003e9a9f540adc6b16d9e44bfea5a1059150d0
</span>Author: Chris Jones <jonesc@macports.org>
AuthorDate: Sat May 23 10:08:33 2020 +0100

<span style='display:block; white-space:pre;color:#404040;'>    py-tensorflow{1}: Add build options to limit machine utilisation
</span>---
 python/py-tensorflow/Portfile  | 10 +++++++++-
 python/py-tensorflow1/Portfile | 10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

<span style='display:block; white-space:pre;color:#808080;'>diff --git a/python/py-tensorflow/Portfile b/python/py-tensorflow/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 5d75577..25116a0 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/python/py-tensorflow/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/python/py-tensorflow/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -76,7 +76,10 @@ variant mkl description {Enable Intel Math Kernel Library support} {
</span> #    default_variants-append +mkl
 #}
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-variant native description {Build from source for best native platform support} { }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+variant native description {Build from source for best native platform support} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # Prevent precompiled binaries to let compilation optimise the library for the user processor
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    archive_sites
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span> 
 # Support python versions
 python.versions        37 38
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -160,6 +163,9 @@ if {${name} ne ${subport}} {
</span>         }
     }
 
<span style='display:block; white-space:pre;background:#e0ffe0;'>+    # Limit the number of parallel jobs to the number of physical, not logical, cpus.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    build.jobs [sysctl hw.physicalcpu]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>     build {
         # tensorflow(via bazel) cannot be built if gcc is 'port selected'
         # https://trac.macports.org/ticket/58569
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -175,6 +181,8 @@ if {${name} ne ${subport}} {
</span>         # Build using the wonderful bazel build system ...
         set tf_bazel_cmd "bazel --max_idle_secs=60 --output_user_root=${workpath}"
         set tf_bazel_build_opts "-s -c opt --verbose_failures --config=opt"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+        # Limit bazel resource utilisation
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        set tf_bazel_build_opts "${tf_bazel_build_opts} --jobs ${build.jobs} --local_ram_resources=HOST_RAM*0.75 --local_cpu_resources=HOST_CPUS*.75"
</span>         # Explicitly pass SDK https://github.com/bazelbuild/rules_go/issues/1554
         # Check SDK actually exists... https://trac.macports.org/ticket/60317
         if {[file exists ${configure.sdkroot}]} {
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/python/py-tensorflow1/Portfile b/python/py-tensorflow1/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 2a76fbb..bf0f782 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/python/py-tensorflow1/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/python/py-tensorflow1/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -71,7 +71,10 @@ if {${os.major} >= 16} {
</span>     default_variants-append +mkl
 }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-variant native description {Build from source for best native platform support} { }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+variant native description {Build from source for best native platform support} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # Prevent precompiled binaries to let compilation optimise the library for the user processor
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    archive_sites
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span> 
 # Support python versions
 python.versions        27 36 37 38
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -160,6 +163,9 @@ if {${name} ne ${subport}} {
</span>         }
     }
 
<span style='display:block; white-space:pre;background:#e0ffe0;'>+    # Limit the number of parallel jobs to the number of physical, not logical, cpus.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    build.jobs [sysctl hw.physicalcpu]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>     build {
         # tensorflow(via bazel) cannot be built if gcc is 'port selected'
         # https://trac.macports.org/ticket/58569
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -175,6 +181,8 @@ if {${name} ne ${subport}} {
</span>         # Build using the wonderful bazel build system ...
         set tf_bazel_cmd "bazel --max_idle_secs=60 --output_user_root=${workpath}"
         set tf_bazel_build_opts "-s -c opt --config=opt"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+        # Limit bazel resource utilisation
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        set tf_bazel_build_opts "${tf_bazel_build_opts} --jobs ${build.jobs} --local_ram_resources=HOST_RAM*0.75 --local_cpu_resources=HOST_CPUS*.75"
</span>         # Explicitly pass SDK https://github.com/bazelbuild/rules_go/issues/1554
         # Check SDK actually exists... https://trac.macports.org/ticket/60317
         if {[file exists ${configure.sdkroot}]} {
</pre><pre style='margin:0'>

</pre>