mkitti / ArrayAllocators.jl

Allocate arrays with malloc, calloc, or on NUMA nodes
MIT License
53 stars 1 forks source link

Memory alignment #1

Closed carstenbauer closed 2 years ago

carstenbauer commented 2 years ago

Maybe it's worth adding something like https://github.com/JuliaPerf/BandwidthBenchmark.jl/blob/main/src/allocate.jl to this package. Based on posix_memalign this allows one to specify the alignment of objects. Isn't available on Windows though.

See also https://discourse.julialang.org/t/julia-alignas-is-there-a-way-to-specify-the-alignment-of-julia-objects-in-memory/57501/2 where this originated from.

mkitti commented 2 years ago

Yes, I should be able to support that. I also have the Windows side figured out which is not that different from the NUMA aware allocation I am doing on Windows now: https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc2

mkitti commented 2 years ago

I did a rough version in https://github.com/mkitti/ArrayAllocators.jl/commit/b5590a29bc0ee601e4d6b87e3c518ef87008a682 . I should probably switch to pull requests once I actually register and release this package.

mkitti commented 2 years ago

Fixed in #3