This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients neologix, njs, pitrou, rhettinger, skrah, tim.peters, trent, vstinner, wscullin
Date 2017-10-23.14:11:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1508767888.51.0.213398074469.issue18835@psf.upfronthosting.co.za>
In-reply-to
Content
Yes, I think it is partly convenience. I want to set ...

   ndt_mallocfunc = PyMem_Malloc;
   ndt_alignedallocfunc = PyMem_AlignedAlloc;
   ndt_callocfunc = PyMem_Calloc;
   ndt_reallocfunc = PyMem_Realloc;
   ndt_freefunc = PyMem_Free;

... so I can always just call ndt_free(), because there's only one memory
allocator.


But the other part is that datashape allows to specify alignment regardless
of the size of the type.  Example:

>>> from ndtypes import *
>>> from xnd import *
>>> t = ndt("{a: int64, b: uint64, align=16}")
>>> xnd(t, {'a': 111, 'b': 222})
<xnd.xnd object at 0x7f82750c2a30>


The xnd object essentially wraps a typed data pointer. In the above case, the
'align' keyword has the same purpose as gcc's __attribute__((aligned(16))).


There are several other cases in datashape where alignment can specified
explicitly.


For the convenience case it would already help if PyMem_AlignedAlloc() did
*not* use the fast allocator, but just delegated to _aligned_malloc() (MSVC)
or aligned_alloc() (C11), ...
History
Date User Action Args
2017-10-23 14:11:28skrahsetrecipients: + skrah, tim.peters, rhettinger, pitrou, vstinner, trent, njs, neologix, wscullin
2017-10-23 14:11:28skrahsetmessageid: <1508767888.51.0.213398074469.issue18835@psf.upfronthosting.co.za>
2017-10-23 14:11:28skrahlinkissue18835 messages
2017-10-23 14:11:28skrahcreate