about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEfraim Flashner2023-09-26 11:36:44 +0300
committerEfraim Flashner2023-09-26 11:36:44 +0300
commit65a7e2f8a9308ca171013c8533f41e3c8bdba71a (patch)
tree9f396a0c7725b509c4ce965ecb2321b9bd59e96f
parent6ee7dfd989d93a083b13a0463e486b5c85ca1ac9 (diff)
downloadguix-bioinformatics-65a7e2f8a9308ca171013c8533f41e3c8bdba71a.tar.gz
seqwish: Provide glibc-hwcaps version
-rw-r--r--gn/packages/bioinformatics.scm119
1 files changed, 119 insertions, 0 deletions
diff --git a/gn/packages/bioinformatics.scm b/gn/packages/bioinformatics.scm
index 50c207d..15d8811 100644
--- a/gn/packages/bioinformatics.scm
+++ b/gn/packages/bioinformatics.scm
@@ -1687,6 +1687,124 @@ dictionaries to record a queryable version of the graph.")
     (properties `((tunable? . #t)))
     (license license:expat)))
 
+(define-public seqwish-x86-64-v2
+  (package/inherit seqwish
+    (name "seqwish-x86-64-v2")
+    (outputs '("out" "static"))
+    (arguments
+     (substitute-keyword-arguments (package-arguments seqwish)
+       ((#:configure-flags flags #~'())
+        #~(append (list "-DEXTRA_FLAGS=-march=x86-64-v2"
+                        "-DCMAKE_INSTALL_LIBDIR=lib/glibc-hwcaps/x86-64-v2"
+                        (string-append "-DCMAKE_INSTALL_RPATH=" #$output
+                                       "/lib/glibc-hwcaps/x86-64-v2"))
+                  #$flags))
+       ;; The building machine can't necessarily run the code produced.
+       ((#:tests? _ #t) #f)
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (add-after 'install 'remove-extra-files
+              (lambda _
+                (delete-file-recursively (string-append #$output "/bin"))))
+            (add-after 'install 'move-static-library
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let ((lib "/lib/glibc-hwcaps/x86-64-v2/libseqwish.a"))
+                  (mkdir-p (dirname (string-append #$output:static lib)))
+                  (rename-file (string-append #$output lib)
+                               (string-append #$output:static lib)))))))))
+    (supported-systems '("x86_64-linux"))
+    (properties `((hidden? . #t)
+                  (tunable? . #f)))))
+
+(define-public seqwish-x86-64-v3
+  (package/inherit seqwish
+    (name "seqwish-x86-64-v3")
+    (outputs '("out" "static"))
+    (arguments
+     (substitute-keyword-arguments (package-arguments seqwish)
+       ((#:configure-flags flags #~'())
+        #~(append (list "-DEXTRA_FLAGS=-march=x86-64-v3"
+                        "-DCMAKE_INSTALL_LIBDIR=lib/glibc-hwcaps/x86-64-v3"
+                        (string-append "-DCMAKE_INSTALL_RPATH=" #$output
+                                       "/lib/glibc-hwcaps/x86-64-v3"))
+                  #$flags))
+       ;; The building machine can't necessarily run the code produced.
+       ((#:tests? _ #t) #f)
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (add-after 'install 'remove-extra-files
+              (lambda _
+                (delete-file-recursively (string-append #$output "/bin"))))
+            (add-after 'install 'move-static-library
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let ((lib "/lib/glibc-hwcaps/x86-64-v3/libseqwish.a"))
+                  (mkdir-p (dirname (string-append #$output:static lib)))
+                  (rename-file (string-append #$output lib)
+                               (string-append #$output:static lib)))))))))
+    (supported-systems '("x86_64-linux"))
+    (properties `((hidden? . #t)
+                  (tunable? . #f)))))
+
+(define-public seqwish-x86-64-v4
+  (package/inherit seqwish
+    (name "seqwish-x86-64-v4")
+    (outputs '("out" "static"))
+    (arguments
+     (substitute-keyword-arguments (package-arguments seqwish)
+       ((#:configure-flags flags #~'())
+        #~(append (list "-DEXTRA_FLAGS=-march=x86-64-v4"
+                        "-DCMAKE_INSTALL_LIBDIR=lib/glibc-hwcaps/x86-64-v4"
+                        (string-append "-DCMAKE_INSTALL_RPATH=" #$output
+                                       "/lib/glibc-hwcaps/x86-64-v4"))
+                  #$flags))
+       ;; The building machine can't necessarily run the code produced.
+       ((#:tests? _ #t) #f)
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (add-after 'install 'remove-extra-files
+              (lambda _
+                (delete-file-recursively (string-append #$output "/bin"))))
+            (add-after 'install 'move-static-library
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let ((lib "/lib/glibc-hwcaps/x86-64-v4/libseqwish.a"))
+                  (mkdir-p (dirname (string-append #$output:static lib)))
+                  (rename-file (string-append #$output lib)
+                               (string-append #$output:static lib)))))))))
+    (supported-systems '("x86_64-linux"))
+    (properties `((hidden? . #t)
+                  (tunable? . #f)))))
+
+;; This copy of seqwish will automatically use the libraries that target the
+;; x86_64 psABI which the hardware supports.
+(define-public seqwish-hwcaps
+  (package/inherit seqwish
+    (name "seqwish-hwcaps")
+    (arguments
+     (substitute-keyword-arguments (package-arguments seqwish)
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (add-after 'install 'install-optimized-libraries
+              (lambda* (#:key inputs outputs #:allow-other-keys)
+                (let ((hwcaps "/lib/glibc-hwcaps"))
+                  (copy-recursively
+                    (string-append (assoc-ref inputs "seqwish-x86-64-v2")
+                                   hwcaps "/x86-64-v2")
+                    (string-append #$output hwcaps "/x86-64-v2"))
+                  (copy-recursively
+                    (string-append (assoc-ref inputs "seqwish-x86-64-v3")
+                                   hwcaps "/x86-64-v3")
+                    (string-append #$output hwcaps "/x86-64-v3"))
+                  (copy-recursively
+                    (string-append (assoc-ref inputs "seqwish-x86-64-v4")
+                                   hwcaps "/x86-64-v4")
+                    (string-append #$output hwcaps "/x86-64-v4")))))))))
+    (native-inputs
+     (modify-inputs (package-native-inputs seqwish)
+                    (append seqwish-x86-64-v2
+                            seqwish-x86-64-v3
+                            seqwish-x86-64-v4)))
+    (properties `((tunable? . #f)))))
+
 (define-public smoothxg
   (package
     (name "smoothxg")
@@ -2675,6 +2793,7 @@ Reference Consortium, HPRC} as a method to build a graph from the
     ;; Replace some packages with ones built targeting custom packages build
     ;; with glibc-hwcaps support.
     `(("sdsl-lite" . ,(const sdsl-lite-hwcaps))
+      ("seqwish" . ,(const seqwish-hwcaps))
       ("odgi" . ,(const odgi-hwcaps))
       ("wfmash" . ,(const wfmash-hwcaps)))))