Class template mapped_view
boost::compute::mapped_view — A mapped view of host memory.
Synopsis
Description
Класс mapped_view упрощает отображение памяти хоста в вычислительное устройство. Это позволяет использовать выделенную хостом память с Boost. Вычислить алгоритмы.
Следующий пример показывает, как нанести на карту простой C-массив, содержащий данные на хосте устройства, и запустить алгоритм редуцирования () для расчета суммы:
См. также:
буфер
mapped_view
public
construct/copy/destruct
mapped_view();
Создает нулевой mapped_view объект.mapped_view(T * host_ptr, size_type n,
const context & context = system::default_context());Creates a mapped_view for host_ptr with n elements. After constructing a mapped_view the data is available for use by a compute device. Use the unmap() method to make the updated data available to the host.
mapped_view(const T * host_ptr, size_type n,
const context & context = system::default_context());Creates a read-only mapped_view for host_ptr with n elements. After constructing a mapped_view the data is available for use by a compute device. Use the unmap() method to make the updated data available to the host.
mapped_view(const mapped_view< T > & other);
Creates a copy of other. mapped_view<T > & constconstmapped_view< > ;Копирует нанесенный на карту буфер из other.
~mapped_view();
Уничтожает объект mapped_view.
mapped_view public member functions
iterator begin();
Вернет итератор к первому элементу в mapped_view.const_iterator begin() const;
Вернет const_iterator к первому элементу в mapped_view.const_iterator cbegin() const;
Вернет const_iterator к первому элементу в mapped_view.iterator end();
Returns an iterator to one past the last element in the mapped_view. const_iterator end() const;
Returns a const_iterator to one past the last element in the mapped_view. const_iterator cend() const;
Вернет const_iterator к одному прошедшему последнему элементу в mapped_view.size_type size() const;
Вернет количество элементов в mapped_view.T * get_host_ptr();
Returns the host data pointer. const Tget_host_ptr() const;
Вернет указатель данных хоста.void resize(size_type size);
Resizes mapped_view to size elements.bool empty() const;
Возвращает true, если mapped_view пуст.const buffer & get_buffer() const;
Вернет отображаемый буфер.void map(cl_map_flags flags, command_queue & queue);
Maps the buffer into the host address space.
See the documentation for clEnqueueMapBuffer() for more information.
void map(command_queue & queue);
Maps the buffer into the host address space for reading and writing.
Equivalent to:
map(CL_MAP_READ | CL_MAP_WRITE, queue);
void unmap(command_queue & queue);
Unmaps the buffer from the host address space.
See the documentation for clEnqueueUnmapMemObject() for more information.