ham
ham copied to clipboard
What is the difference between ham::new_buffer and ham::offload::allocate?
What is the difference between ham::new_buffer and ham::offload::allocate?
-
ham::new_buffer
is called withnew_buffer{size_t n, node_t source}
and is a functor -
ham::offload::allocate
is called withallocate(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
?
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
andsize_t
throughout the code and fix inconsistencies - [ ] think about putting some stuff, e.g.
new_buffer
, intoham::detail
namespace