aboutsummaryrefslogtreecommitdiff
path: root/science/py-tensorflow
diff options
context:
space:
mode:
authorPiotr Kubaj <pkubaj@FreeBSD.org>2021-10-12 18:37:07 +0000
committerPiotr Kubaj <pkubaj@FreeBSD.org>2021-10-12 18:37:07 +0000
commitb3ab9cf93726f7219c60161b8da3d091704093da (patch)
tree9c9e2968a688f68eddfa7766dd938bc680342ad5 /science/py-tensorflow
parent9386a8c6ea0098798aa16f72acbb87bb89106ca1 (diff)
downloadports-b3ab9cf93726f7219c60161b8da3d091704093da.tar.gz
ports-b3ab9cf93726f7219c60161b8da3d091704093da.zip
Diffstat (limited to 'science/py-tensorflow')
-rw-r--r--science/py-tensorflow/Makefile3
-rw-r--r--science/py-tensorflow/files/extra-patch-absl_base_internal_unscaledcycleclock.cc47
-rw-r--r--science/py-tensorflow/files/patch-tensorflow_workspace.bzl12
3 files changed, 59 insertions, 3 deletions
diff --git a/science/py-tensorflow/Makefile b/science/py-tensorflow/Makefile
index d8a810ed5057..75b162628505 100644
--- a/science/py-tensorflow/Makefile
+++ b/science/py-tensorflow/Makefile
@@ -13,7 +13,7 @@ COMMENT= Computation using data flow graphs for scalable machine learning
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
-ONLY_FOR_ARCHS= amd64
+ONLY_FOR_ARCHS= amd64 powerpc64
BUILD_DEPENDS= ${RUN_DEPENDS} \
${PYTHON_PKGNAMEPREFIX}grpcio-tools>=1.22.0:devel/py-grpcio-tools@${PY_FLAVOR} \
@@ -75,6 +75,7 @@ post-patch:
# the bzl files.
@${MKDIR} ${WRKDIR}/bazel-cache
@${MKDIR} ${WRKDIR}/bazel-distdir
+ @${CP} ${FILESDIR}/extra-patch-absl_base_internal_unscaledcycleclock.cc ${WRKSRC}/third_party/
.for file in ${DISTFILES:C/\:(.*)//}
@${ECHO} "Moving ${file} to ${WRKDIR}/bazel-cache"
diff --git a/science/py-tensorflow/files/extra-patch-absl_base_internal_unscaledcycleclock.cc b/science/py-tensorflow/files/extra-patch-absl_base_internal_unscaledcycleclock.cc
new file mode 100644
index 000000000000..43bbada5c4bb
--- /dev/null
+++ b/science/py-tensorflow/files/extra-patch-absl_base_internal_unscaledcycleclock.cc
@@ -0,0 +1,47 @@
+--- a/absl/base/internal/unscaledcycleclock.cc.orig 2021-10-11 21:53:31.946215000 +0200
++++ b/absl/base/internal/unscaledcycleclock.cc 2021-10-11 21:57:54.536557000 +0200
+@@ -21,8 +21,15 @@
+ #endif
+
+ #if defined(__powerpc__) || defined(__ppc__)
++#ifdef __linux__
+ #include <sys/platform/ppc.h>
++#else
++#include "absl/base/call_once.h"
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#include <threads.h>
+ #endif
++#endif
+
+ #include "absl/base/internal/sysinfo.h"
+
+@@ -56,11 +63,28 @@
+ #elif defined(__powerpc__) || defined(__ppc__)
+
+ int64_t UnscaledCycleClock::Now() {
++#ifdef __linux__
+ return __ppc_get_timebase();
++#else
++ int64_t tbr;
++ asm volatile("mfspr %0, 268" : "=r"(tbr));
++ return tbr;
++#endif
+ }
+
+ double UnscaledCycleClock::Frequency() {
++#ifdef __linux__
+ return __ppc_get_timebase_freq();
++#else
++ static once_flag init_timebase_frequency_once;
++ static double timebase_frequency = 0.0;
++ base_internal::LowLevelCallOnce(&init_timebase_frequency_once, [&]() {
++ size_t length = sizeof(timebase_frequency);
++ sysctlbyname("kern.timecounter.tc.timebase.frequency", &timebase_frequency,
++ &length, nullptr, 0);
++ });
++ return timebase_frequency;
++#endif
+ }
+
+ #elif defined(__aarch64__)
diff --git a/science/py-tensorflow/files/patch-tensorflow_workspace.bzl b/science/py-tensorflow/files/patch-tensorflow_workspace.bzl
index d25f9d632e8e..45a4a12c3d2b 100644
--- a/science/py-tensorflow/files/patch-tensorflow_workspace.bzl
+++ b/science/py-tensorflow/files/patch-tensorflow_workspace.bzl
@@ -1,6 +1,14 @@
---- tensorflow/workspace.bzl.orig 2021-07-08 11:05:27 UTC
+--- tensorflow/workspace.bzl.orig 2021-01-04 20:18:42 UTC
+++ tensorflow/workspace.bzl
-@@ -324,6 +324,7 @@ def tf_repositories(path_prefix = "", tf_repo_name = "
+@@ -157,6 +157,7 @@ def tf_repositories(path_prefix = "", tf_repo_name = "
+ tf_http_archive(
+ name = "com_google_absl",
+ build_file = clean_dep("//third_party:com_google_absl.BUILD"),
++ patch_file = clean_dep("//third_party:extra-patch-absl_base_internal_unscaledcycleclock.cc"),
+ sha256 = "acd93f6baaedc4414ebd08b33bebca7c7a46888916101d8c0b8083573526d070",
+ strip_prefix = "abseil-cpp-43ef2148c0936ebf7cb4be6b19927a9d9d145b8f",
+ urls = [
+@@ -324,6 +325,7 @@ def tf_repositories(path_prefix = "", tf_repo_name = "
build_file = clean_dep("//third_party:functools32.BUILD"),
sha256 = "f6253dfbe0538ad2e387bd8fdfd9293c925d63553f5813c4e587745416501e6d",
strip_prefix = "functools32-3.2.3-2",