[ANN] AlignedAllocs.jl - lightweight cross-platform allocation of aligned memory

This is a very lightweight cross-platform package that exports two functions, each is an aligned memory allocator.

memalign(item_type, item_count [, byte_alignment]) 
    providing uninitialized memory

memalign_clear(item_type, item_count [, byte_alignment])
    providing zeroed memory

`byte_alignment` defaults to the local processor cache-line size.
   This value is determined once, at precompilation.

The README.md file gives good reasons to use this (especially with vectors that are not large, or when using SIMD), and provides some more technical details.

The package returns a DenseVector{T}. To use the package for matrix (or higher degree array) allocations, reshape the returned vector:

using AlignAllocs
vec = memalign_clear(Float32, 4096, 64);
mat = reshape(vec, (1024, 4));
7 Likes