unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#55565] [PATCH] gnu: Add python-blis
@ 2022-05-21 22:17 Artyom V. Poptsov
  2022-05-27 21:23 ` Ludovic Courtès
  2023-09-02  0:00 ` bug#55565: " Vagrant Cascadian
  0 siblings, 2 replies; 5+ messages in thread
From: Artyom V. Poptsov @ 2022-05-21 22:17 UTC (permalink / raw)
  To: 55565


[-- Attachment #1.1: Type: text/plain, Size: 212 bytes --]

Hello,

this patch adds "blis" Python module[1] under the name "python-blis".

- Artyom

References:
1. "Fast matrix-multiplication as a self-contained Python library"
   https://github.com/explosion/cython-blis

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-Add-python-blis.patch --]
[-- Type: text/x-diff, Size: 1760 bytes --]

From 3d22d0e5f7929ac1b782217ec207a5e462316c66 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 | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 3c4fa16d16..95b85b9931 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -31449,3 +31449,27 @@ written in C.")
     (synopsis "Cython bindings for MurmurHash2")
     (description "This package provides Cython bindings for MurmurHash2.")
     (license license:expat)))
+
+(define-public python-blis
+  (package
+    (name "python-blis")
+    (version "0.9.0")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "blis" version))
+              (sha256
+               (base32
+                "0adl7knj11rglg6l9nfqccl8kgs2v1c7qllv9c5kf5k796hir7k9"))))
+    (build-system python-build-system)
+    (native-inputs (list python-pytest python-cython))
+    (inputs (list python python-numpy python-hypothesis))
+    (arguments
+     ;; XXX: Tests are failing with the following error:
+     ;; AttributeError: module 'numpy.__config__' has no attribute 'blas_ilp64_opt_info'
+     (list #:tests? #f))
+    (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


[-- Attachment #1.3: Type: text/plain, Size: 207 bytes --]


-- 
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#55565] [PATCH] gnu: Add python-blis
  2022-05-21 22:17 [bug#55565] [PATCH] gnu: Add python-blis Artyom V. Poptsov
@ 2022-05-27 21:23 ` Ludovic Courtès
  2022-06-11 10:44   ` Artyom V. Poptsov
  2023-09-02  0:00 ` bug#55565: " Vagrant Cascadian
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2022-05-27 21:23 UTC (permalink / raw)
  To: Artyom V. Poptsov; +Cc: 55565

Hi Artyom,

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

> From 3d22d0e5f7929ac1b782217ec207a5e462316c66 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.

[...]

> +    (native-inputs (list python-pytest python-cython))
> +    (inputs (list python python-numpy python-hypothesis))
> +    (arguments
> +     ;; XXX: Tests are failing with the following error:
> +     ;; AttributeError: module 'numpy.__config__' has no attribute 'blas_ilp64_opt_info'
> +     (list #:tests? #f))

Doesn’t that failure suggest something’s really wrong?  Seems worth
investigating.

> +    (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.")

Blis isn’t listed in ‘inputs’, and apparently that’s because it’s
bundled.

Could you “unbundle” it?  That is, add Blis as an input, make sure it
gets used during the build process, and remove the bundled copy.

Thanks in advance,
Ludo’.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#55565] [PATCH] gnu: Add python-blis
  2022-05-27 21:23 ` Ludovic Courtès
@ 2022-06-11 10:44   ` Artyom V. Poptsov
  2022-06-13 10:20     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Artyom V. Poptsov @ 2022-06-11 10:44 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 55565


[-- Attachment #1.1: Type: text/plain, Size: 386 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-Add-python-blis.patch --]
[-- Type: text/x-diff, Size: 2119 bytes --]

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


[-- Attachment #1.3: Type: text/plain, Size: 207 bytes --]


-- 
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#55565] [PATCH] gnu: Add python-blis
  2022-06-11 10:44   ` Artyom V. Poptsov
@ 2022-06-13 10:20     ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2022-06-13 10:20 UTC (permalink / raw)
  To: Artyom V. Poptsov; +Cc: 55565

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’.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#55565: [PATCH] gnu: Add python-blis
  2022-05-21 22:17 [bug#55565] [PATCH] gnu: Add python-blis Artyom V. Poptsov
  2022-05-27 21:23 ` Ludovic Courtès
@ 2023-09-02  0:00 ` Vagrant Cascadian
  1 sibling, 0 replies; 5+ messages in thread
From: Vagrant Cascadian @ 2023-09-02  0:00 UTC (permalink / raw)
  To: Artyom V. Poptsov, 55565-done

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

On 2022-05-22, Artyom V. Poptsov wrote:
> Subject: [PATCH] gnu: Add python-blis
>
> * gnu/packages/python-xyz.scm (python-blis): New variable.
...
> +(define-public python-blis
> +  (package
> +    (name "python-blis")
> +    (version "0.9.0")

python-blis 0.9.1 was added in:

069618522d3ee040e0b0f2d9f24ceb763ce434aa gnu: Add python-blis.

Marking as done.

live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-02  0:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-21 22:17 [bug#55565] [PATCH] gnu: Add python-blis Artyom V. Poptsov
2022-05-27 21:23 ` Ludovic Courtès
2022-06-11 10:44   ` Artyom V. Poptsov
2022-06-13 10:20     ` Ludovic Courtès
2023-09-02  0:00 ` bug#55565: " Vagrant Cascadian

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).