ham icon indicating copy to clipboard operation
ham copied to clipboard

What is the difference between ham::new_buffer and ham::offload::allocate?

Open marehr opened this issue 6 years ago • 1 comments

What is the difference between ham::new_buffer and ham::offload::allocate?

  • ham::new_buffer is called with new_buffer{size_t n, node_t source} and is a functor
  • ham::offload::allocate is called with allocate(const node_t node, size_t n) and is a normal function call

(Note the inconsistent call order)

allocate calls new_buffer internally https://github.com/noma/ham/blob/5649c04291336e0df172734ca8631d7be3020dbd/include/ham/offload/offload.hpp#L204-L209

What would happen if I call new_buffer{n, source}() directly? Is that async or sync?

From a design perspective ham::new_buffer seems to be more specific than ham::offload::allocate, because it has one namespace less.

Is there a reason why new_buffer is general api and not in ham::detail?

marehr avatar Apr 16 '18 10:04 marehr

new_buffer is a functor intended to be transferred and executed on the remote side, the allocate function is built on top for convenience. User's could manually use it, if they know what they're doing, for instance to perform an asynchronous allocation.

TODO:

  • [ ] check argument orders for node_t and size_tthroughout the code and fix inconsistencies
  • [ ] think about putting some stuff, e.g. new_buffer, into ham::detail namespace

noma avatar Apr 23 '18 12:04 noma