Convert assignments to host_buffers into using a memory manager
Allen currently assigns data to host_buffers through functions such as safe_assign_to_host_buffer
. This function has a fundamental flaw:
- It resorts to using
Allen::free
followed byAllen::malloc
(orAllen::malloc_host
) if there is not enough space in the buffer.
Therefore, by construction it will request exclusive access to the memory manager of the GPU, preventing any parallel execution during the operation.
These assignments should instead be copied to a buffer on the host that is preallocated with enough space to account for the request.
One possible solution here would be to use another instance of the host memory manager whose lifetime is linked with that of the host_buffers.
This would solve the slowdown surfaced by https://gitlab.cern.ch/lhcb/Allen/pipelines/4104488 (https://mattermost.web.cern.ch/lhcb/pl/aosba63qf7getgruzpgjk1x9xa).