static void upload( TObject const & handle, std::vector < typename TObject::value_type > const& input, context const& ctx, bool synchronous = true) { assert ( ( input.size() / TObject::value_elements ) == handle.get_count() ); ctx.transfer_to_buffer(handle.get_mem(), &input.front(), handle.value_entry_size * handle.get_count()); }
static void uploadScalar( TObject const & handle, typename TObject::value_type const& input, context const& ctx, bool synchronous = true) { assert ( handle.get_count() == 1 ); ctx.transfer_to_buffer(handle.get_mem(), &input, handle.value_entry_size); }
static void downloadScalar( TObject const & handle, typename TObject::value_type & out, context const& ctx, bool synchronous = true, uint offset = 0, uint lengthWaitList = 0, const cl_event * waitList = NULL) { assert ( handle.get_count() >= offset ); offset = offset * handle.value_entry_size; ctx.transfer_from_buffer(handle.get_mem(), &out, handle.value_entry_size, lengthWaitList, waitList, offset); }