View | Details | Raw Unified | Return to bug 259082
Collapse All | Expand All

(-)science/py-tensorflow/Makefile (-1 / +2 lines)
Lines 13-19 COMMENT= Computation using data flow graphs for scalab Link Here
13
LICENSE=	APACHE20
13
LICENSE=	APACHE20
14
LICENSE_FILE=	${WRKSRC}/LICENSE
14
LICENSE_FILE=	${WRKSRC}/LICENSE
15
15
16
ONLY_FOR_ARCHS=	amd64
16
ONLY_FOR_ARCHS=	amd64 powerpc64
17
17
18
BUILD_DEPENDS=	${RUN_DEPENDS} \
18
BUILD_DEPENDS=	${RUN_DEPENDS} \
19
		${PYTHON_PKGNAMEPREFIX}grpcio-tools>=1.22.0:devel/py-grpcio-tools@${PY_FLAVOR} \
19
		${PYTHON_PKGNAMEPREFIX}grpcio-tools>=1.22.0:devel/py-grpcio-tools@${PY_FLAVOR} \
Lines 75-80 post-patch: Link Here
75
	# the bzl files.
75
	# the bzl files.
76
	@${MKDIR} ${WRKDIR}/bazel-cache
76
	@${MKDIR} ${WRKDIR}/bazel-cache
77
	@${MKDIR} ${WRKDIR}/bazel-distdir
77
	@${MKDIR} ${WRKDIR}/bazel-distdir
78
	@${CP} ${FILESDIR}/extra-patch-absl_base_internal_unscaledcycleclock.cc ${WRKSRC}/third_party/
78
79
79
.for file in ${DISTFILES:C/\:(.*)//}
80
.for file in ${DISTFILES:C/\:(.*)//}
80
	@${ECHO} "Moving ${file} to ${WRKDIR}/bazel-cache"
81
	@${ECHO} "Moving ${file} to ${WRKDIR}/bazel-cache"
(-)science/py-tensorflow/files/extra-patch-absl_base_internal_unscaledcycleclock.cc (+47 lines)
Added Link Here
1
--- a/absl/base/internal/unscaledcycleclock.cc.orig	2021-10-11 21:53:31.946215000 +0200
2
+++ b/absl/base/internal/unscaledcycleclock.cc	2021-10-11 21:57:54.536557000 +0200
3
@@ -21,8 +21,15 @@
4
 #endif
5
 
6
 #if defined(__powerpc__) || defined(__ppc__)
7
+#ifdef __linux__
8
 #include <sys/platform/ppc.h>
9
+#else
10
+#include "absl/base/call_once.h"
11
+#include <sys/types.h>
12
+#include <sys/sysctl.h>
13
+#include <threads.h>
14
 #endif
15
+#endif
16
 
17
 #include "absl/base/internal/sysinfo.h"
18
 
19
@@ -56,11 +63,28 @@
20
 #elif defined(__powerpc__) || defined(__ppc__)
21
 
22
 int64_t UnscaledCycleClock::Now() {
23
+#ifdef __linux__
24
   return __ppc_get_timebase();
25
+#else
26
+  int64_t tbr;
27
+  asm volatile("mfspr %0, 268" : "=r"(tbr));
28
+  return tbr;
29
+#endif
30
 }
31
 
32
 double UnscaledCycleClock::Frequency() {
33
+#ifdef __linux__
34
   return __ppc_get_timebase_freq();
35
+#else
36
+  static once_flag init_timebase_frequency_once;
37
+  static double timebase_frequency = 0.0;
38
+  base_internal::LowLevelCallOnce(&init_timebase_frequency_once, [&]() {
39
+    size_t length = sizeof(timebase_frequency);
40
+    sysctlbyname("kern.timecounter.tc.timebase.frequency", &timebase_frequency,
41
+                 &length, nullptr, 0);
42
+  });
43
+  return timebase_frequency;
44
+#endif
45
 }
46
 
47
 #elif defined(__aarch64__)
(-)science/py-tensorflow/files/patch-tensorflow_workspace.bzl (-2 / +10 lines)
Lines 1-6 Link Here
1
--- tensorflow/workspace.bzl.orig	2021-07-08 11:05:27 UTC
1
--- tensorflow/workspace.bzl.orig	2021-01-04 20:18:42 UTC
2
+++ tensorflow/workspace.bzl
2
+++ tensorflow/workspace.bzl
3
@@ -324,6 +324,7 @@ def tf_repositories(path_prefix = "", tf_repo_name = "
3
@@ -157,6 +157,7 @@ def tf_repositories(path_prefix = "", tf_repo_name = "
4
     tf_http_archive(
5
         name = "com_google_absl",
6
         build_file = clean_dep("//third_party:com_google_absl.BUILD"),
7
+        patch_file = clean_dep("//third_party:extra-patch-absl_base_internal_unscaledcycleclock.cc"),
8
         sha256 = "acd93f6baaedc4414ebd08b33bebca7c7a46888916101d8c0b8083573526d070",
9
         strip_prefix = "abseil-cpp-43ef2148c0936ebf7cb4be6b19927a9d9d145b8f",
10
         urls = [
11
@@ -324,6 +325,7 @@ def tf_repositories(path_prefix = "", tf_repo_name = "
4
         build_file = clean_dep("//third_party:functools32.BUILD"),
12
         build_file = clean_dep("//third_party:functools32.BUILD"),
5
         sha256 = "f6253dfbe0538ad2e387bd8fdfd9293c925d63553f5813c4e587745416501e6d",
13
         sha256 = "f6253dfbe0538ad2e387bd8fdfd9293c925d63553f5813c4e587745416501e6d",
6
         strip_prefix = "functools32-3.2.3-2",
14
         strip_prefix = "functools32-3.2.3-2",

Return to bug 259082