You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The examples you have are really powerful. I just wish they didn't require acquiring the GIL to use ;).
I agree, for example debug_allocator really comes in handy when I optimize NumPy code (helps me spot unnecessary memory allocations and copies). These examples are there for demonstration purposes, mostly. For production, I also use the part of the API that avoids Python callbacks.
Would you accept PRs here for predefined allactors, or do you consider this "out of scope" for this project?
I think it would make more sense to have a dedicated project (e.g. numpy-allocators) to host various NumPy Allocator implementations, and definitely accept PRs from the community.
I think I also feel like the examples you provided in the tests are really solid! Maybe you could include those in the distribution?
We could include them in the binary distributions, but I'm more in favor of an optimized NumPy Allocator Collection project with support for every platform. The current aligned_allocator uses GNU memalign which is not available in MacOS and Windows, in a dedicated project we would make sure that everything works as expected on every supported platform.
Let's keep this issue open to track these actions.
I understand your desire to keep this focused on making it easy to create these kinds of python objects.
My concern is that users will end up with unnecessary code/dependencies.
I had this idea to implement NumPy Allocators for several custom "malloc" implementations, e.g. mi_allocator after mimalloc, tc_allocator after tcmalloc, je_allocator after jemalloc, etc. and my plan was to publish them as separate projects that depend on this one. I think this is the best approach if you want to keep everyone happy.
This new project (regardless of it's name) may still use the numpy_allocator namespace, e.g.:
Ah i see. Yeah, i've never packaged things that way before. I think it is possible with
so maybe the packages become something like
numpy-allocator-mimalloc
numpy-allocator-tcmalloc
numpy-allocator-page-aligned
etc.
I guess i'll have to look into it. My general feeling is that your context managers are tremendously useful to debug and to prototype things with! Thank you for that!
Activity
hmaarrfk commentedon Nov 29, 2022
I think I also feel like the examples you provided in the tests are really solid! Maybe you could include those in the distribution?
eliaskoromilas commentedon Nov 29, 2022
I agree, for example
debug_allocatorreally comes in handy when I optimize NumPy code (helps me spot unnecessary memory allocations and copies). These examples are there for demonstration purposes, mostly. For production, I also use the part of the API that avoids Python callbacks.I think it would make more sense to have a dedicated project (e.g.
numpy-allocators) to host various NumPy Allocator implementations, and definitely accept PRs from the community.We could include them in the binary distributions, but I'm more in favor of an optimized NumPy Allocator Collection project with support for every platform. The current
aligned_allocatoruses GNUmemalignwhich is not available in MacOS and Windows, in a dedicated project we would make sure that everything works as expected on every supported platform.Let's keep this issue open to track these actions.
hmaarrfk commentedon Nov 30, 2022
I understand your desire to keep this focused on making it easy to create these kinds of python objects.
I do worry about the suggested name for the new library:
is really easy to get confused with.
eliaskoromilas commentedon Nov 30, 2022
This new project (regardless of it's name) may still use the
numpy_allocatornamespace, e.g.:My concern is that users will end up with unnecessary code/dependencies.
I had this idea to implement NumPy Allocators for several custom "malloc" implementations, e.g.
mi_allocatorafter mimalloc,tc_allocatorafter tcmalloc,je_allocatorafter jemalloc, etc. and my plan was to publish them as separate projects that depend on this one. I think this is the best approach if you want to keep everyone happy.hmaarrfk commentedon Nov 30, 2022
Dependency management is a real concern.
Ah i see. Yeah, i've never packaged things that way before. I think it is possible with
so maybe the packages become something like
numpy-allocator-mimallocnumpy-allocator-tcmallocnumpy-allocator-page-alignedetc.
I guess i'll have to look into it. My general feeling is that your context managers are tremendously useful to debug and to prototype things with! Thank you for that!