Skip to content

Add MKLMemory class to expose MKL allocated memory via Python buffer protocol#182

Open
ndgrigorian wants to merge 8 commits into
use-meson-buildfrom
feature/add-mkl-memory
Open

Add MKLMemory class to expose MKL allocated memory via Python buffer protocol#182
ndgrigorian wants to merge 8 commits into
use-meson-buildfrom
feature/add-mkl-memory

Conversation

@ndgrigorian
Copy link
Copy Markdown
Collaborator

@ndgrigorian ndgrigorian commented Apr 12, 2026

This PR proposes the introduction of _mkl_memory.pyx, which implements an MKLMemory class that exposes memory allocated via mkl_malloc and mkl_calloc to Python via the buffer protocol

The class uses an atomic counter incremented as __getbuffer__ and __releasebuffer__ are called to track the views on the buffer to permit use of mkl_realloc in the object (via realloc method). This concept was adapted from the PEP which revised the buffer protocol which proposed this kind of approach to tracking views on a buffer

Closes #18

@ndgrigorian ndgrigorian force-pushed the feature/add-mkl-memory branch 5 times, most recently from aed1ff6 to a99e626 Compare April 12, 2026 07:19
@ndgrigorian ndgrigorian marked this pull request as ready for review April 12, 2026 09:03
@ndgrigorian ndgrigorian force-pushed the feature/add-mkl-memory branch 2 times, most recently from a3a803b to b2cc6fc Compare May 10, 2026 01:59
@ndgrigorian ndgrigorian force-pushed the feature/add-mkl-memory branch from b2cc6fc to 00fea26 Compare May 10, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant