diff mbox series

[bug#55565] gnu: Add python-blis

Message ID 87pmjfxywd.fsf@gmail.com
State New
Headers show
Series [bug#55565] gnu: Add python-blis | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Artyom V. Poptsov June 11, 2022, 10:44 a.m. UTC
Hello Ludovic,

thanks for the feedback.

I tried to fix the patch and got some promising results.  Please find
the updated patch attached.

Basically I patched 'blis/benchmark.py' to use "blas_opt_info" instead
of "blas_ilp64_opt_info" and tests went fine.  An issue with different
numpy versions I guess?  I also added "blis" and "python-numpy-next" to
the "native-inputs".

- Artyom

Comments

Ludovic Courtès June 13, 2022, 10:20 a.m. UTC | #1
Hi Artyom,

"Artyom V. Poptsov" <poptsov.artyom@gmail.com> skribis:

> Basically I patched 'blis/benchmark.py' to use "blas_opt_info" instead
> of "blas_ilp64_opt_info" and tests went fine.  An issue with different
> numpy versions I guess?  I also added "blis" and "python-numpy-next" to
> the "native-inputs".

Unfortunately this is not sufficient: the source bundles a copy of BLIS
under ‘blis/_src’ and it starts by building it (which is why it takes so
long), whether or not BLIS is among the inputs.

Could you (1) add a snippet that removes ‘blis/_src’, and (2) see
whether/how ‘setup.py’ can be patched to not build BLIS?  It might be
that commenting out the line that reads:

    cmdclass={"build_ext": ExtensionBuilder},

would be enough, I don’t know.

Anyhow, given that BLIS is the kind of package that’s highly tuned on
our side for performance and reproducibility configuration, it’s
important to not have several copies around.

> +    (native-inputs (list python-numpy-next
> +                         python-pytest
> +                         python-cython
> +                         blis
> +                         python-hypothesis))

NumPy and BLIS should definitely be ‘inputs’, not ‘native-inputs’; not
sure about ‘hypothesis’.

Also, please include a short comment explaining why numpy-next is used
rather than numpy (like “version >= X.Y required”).

Could you send an updated patch?

Sorry that this is providing trickier than we’d like!

Thanks,
Ludo’.
diff mbox series

Patch

From 3d088c0cbeee76c59dc140db16119a5e3f837b08 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Sun, 22 May 2022 01:14:26 +0300
Subject: [PATCH] gnu: Add python-blis

* gnu/packages/python-xyz.scm (python-blis): New variable.
---
 gnu/packages/python-xyz.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 5f9ce4fdfe..934dfd2959 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -29435,3 +29435,39 @@  Information about these scales can be
 @url{https://en.wikipedia.org/wiki/List_of_musical_scales_and_modes, found on
 Wikipedia}.")
     (license license:expat)))
+
+(define-public python-blis
+  (package
+    (name "python-blis")
+    (version "0.9.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/explosion/cython-blis")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1p4y4mf8046kv2syf2s0v6mf4s000anr1ws7w3fny852gpp6czk4"))))
+    (build-system python-build-system)
+    (native-inputs (list python-numpy-next
+                         python-pytest
+                         python-cython
+                         blis
+                         python-hypothesis))
+    (arguments
+     (list #:tests? #t
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'patch
+                 (lambda _
+                   (substitute* "./blis/benchmark.py"
+                     (("blas_ilp64_opt_info")
+                      "blas_opt_info")))))))
+    (home-page "https://github.com/explosion/cython-blis")
+    (synopsis "Fast matrix-multiplication Python library")
+    (description
+     "This package provides the @url{https://github.com/flame/blis,
+Blis linear algebra} routines as a self-contained Python C-extension.")
+    (license license:bsd-3)))
-- 
2.25.1