about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEfraim Flashner2020-05-31 12:51:45 -0500
committerEfraim Flashner2020-05-31 12:51:45 -0500
commitc43d167ecdfe83de6c81f5718ccf21380f40c3b7 (patch)
tree7108819b8d0ee140a6074a2de37a488e7667a2f4
parentc2cbcf1d42e547fa90b4ca3555a696b73d99ef9d (diff)
downloadguix-bioinformatics-c43d167ecdfe83de6c81f5718ccf21380f40c3b7.tar.gz
gn: ratspub: Use optimized tensorflow library
-rw-r--r--gn/packages/machine-learning.scm33
-rw-r--r--gn/packages/ratspub.scm7
2 files changed, 40 insertions, 0 deletions
diff --git a/gn/packages/machine-learning.scm b/gn/packages/machine-learning.scm
new file mode 100644
index 0000000..dc9156a
--- /dev/null
+++ b/gn/packages/machine-learning.scm
@@ -0,0 +1,33 @@
+(define-module (gn packages machine-learning)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module (guix utils)
+  #:use-module (gnu packages machine-learning))
+
+(define-public tensorflow-native
+  (package
+    (inherit tensorflow)
+    (name "tensorflow-native")
+    (arguments
+     (substitute-keyword-arguments (package-arguments tensorflow)
+       ;((#:substitutable? _ #f) #f)
+       ;((#:phases phases)
+       ; `(modify-phases ,phases
+       ;    (add-after 'unpack 'hardcode-multicore-usage
+       ;      (lambda _
+       ;        (substitute* "tensorflow/core/protobuf/config.proto"
+       ;          ;(("num_threads = 1") "num_threads = 28") ; 56/2 for penguin2
+       ;          ;(("intra_op_parallelism_threads = 2")
+       ;          ; "intra_op_parallelism_threads = 0")
+       ;          ;(("inter_op_parallelism_threads = 5")
+       ;          ; "inter_op_parallelism_threads = 0")
+       ;          )
+       ;        #t))))
+       ((#:configure-flags flags)
+        `(cons
+           "-Dtensorflow_OPTIMIZE_FOR_NATIVE_ARCH=ON"
+           (delete "-Dtensorflow_OPTIMIZE_FOR_NATIVE_ARCH=OFF"
+                   ,flags)))))))
+
+(define-public tensowflow-native-instead-of-tensorflow
+  (package-input-rewriting/spec `(("tensorflow" . ,(const tensorflow-native)))))
diff --git a/gn/packages/ratspub.scm b/gn/packages/ratspub.scm
index bd82efc..6cf4802 100644
--- a/gn/packages/ratspub.scm
+++ b/gn/packages/ratspub.scm
@@ -8,6 +8,7 @@
   #:use-module (gnu packages admin)
   #:use-module (gnu packages bioinformatics)
   #:use-module (gn packages javascript)
+  #:use-module (gn packages machine-learning)
   #:use-module (gnu packages machine-learning)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-crypto)
@@ -138,6 +139,12 @@ Studies} catalog are also included in the search to better answer this
 question.")
     (license license:expat)))
 
+(define-public ratspub-with-tensorflow-native
+  (package
+    (inherit
+      (tensowflow-native-instead-of-tensorflow ratspub))
+    (name "ratspub-with-tensorflow-native")))
+
 ;; We want a copy of python-keras with the AUC optimizer backported.
 ;; We skip the tests because we "test in production".
 ;; That's a lie. The test suite just takes a long time to run.