mirror of
https://github.com/boostorg/compute.git
synced 2026-01-29 19:32:17 +00:00
This adds a system-wide default command queue. This queue is accessible via the new static system::default_queue() method. The default command queue is created for the default compute device in the default context and is analogous to the default stream in CUDA. This changes how algorithms operate when invoked without an explicit command queue. Previously, each algorithm had two overloads, the first expected a command queue to be explicitly passed and the second would create and use a temporary command queue. Now, all algorithms take a command queue argument which has a default value equal to system::default_queue(). This fixes a number of race-conditions and performance issues througout the library associated with create, using, and destroying many separate command queues.
118 lines
4.2 KiB
XML
118 lines
4.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<header name="boost/compute/algorithm/copy.hpp">
|
|
<namespace name="boost">
|
|
<namespace name="compute">
|
|
|
|
<!-- boost::compute::copy(first, last, result, queue) -->
|
|
<function name="copy">
|
|
<template>
|
|
<template-type-parameter name="InputIterator"/>
|
|
<template-type-parameter name="OutputIterator"/>
|
|
</template>
|
|
|
|
<type>OutputIterator</type>
|
|
|
|
<parameter name="first">
|
|
<paramtype>InputIterator</paramtype>
|
|
</parameter>
|
|
<parameter name="last">
|
|
<paramtype>InputIterator</paramtype>
|
|
</parameter>
|
|
<parameter name="result">
|
|
<paramtype>OutputIterator</paramtype>
|
|
</parameter>
|
|
<parameter name="queue">
|
|
<paramtype>command_queue &</paramtype>
|
|
<default>
|
|
<methodname>system::default_queue()</methodname>
|
|
</default>
|
|
</parameter>
|
|
|
|
<returns>
|
|
An iterator pointing to the end of the result range.
|
|
</returns>
|
|
|
|
<description>
|
|
<para>
|
|
Copies the values from the range [<code>first</code>,
|
|
<code>last</code>) to the range beginning at <code>result</code>.
|
|
</para>
|
|
<para>
|
|
The copy() function is one of the few Boost.Compute algorithms
|
|
which can take both device and host iterators as arguments. For
|
|
example, to copy values from a vector on the host to a vector on
|
|
the device:
|
|
<programlisting>
|
|
std::vector<int> host_vector = ...
|
|
<classname>boost::compute::vector</classname><int> device_vector = ...
|
|
|
|
// copy all values in host_vector to device_vector
|
|
<functionname>boost::compute::copy</functionname>(host_vector.begin(),
|
|
host_vector.end(),
|
|
device_vector.begin());
|
|
</programlisting>
|
|
</para>
|
|
<para>
|
|
The generic <code>copy()</code> function can be used for a variety
|
|
of data transfer tasks and provides a standard interface to the
|
|
following OpenCL functions:
|
|
<itemizedlist>
|
|
<listitem><code>clEnqueueReadBuffer()</code></listitem>
|
|
<listitem><code>clEnqueueWriteBuffer()</code></listitem>
|
|
<listitem><code>clEnqueueCopyBuffer()</code></listitem>
|
|
</itemizedlist>
|
|
Unlike the aforementioned OpenCL functions, <code>copy()</code>
|
|
will also work with non-contiguous data-structures (e.g.
|
|
<code>std::list<T></code>) as well as with "fancy"
|
|
iterators (e.g. <classname>transform_iterator</classname>).
|
|
</para>
|
|
<para>
|
|
See also: <functionname>copy_n()</functionname>,
|
|
<functionname>copy_if()</functionname>,
|
|
<functionname>copy_async()</functionname>
|
|
</para>
|
|
</description>
|
|
</function>
|
|
|
|
<!-- boost::compute::copy_async(first, last, result, queue) -->
|
|
<function name="copy_async">
|
|
<template>
|
|
<template-type-parameter name="InputIterator"/>
|
|
<template-type-parameter name="OutputIterator"/>
|
|
</template>
|
|
|
|
<type><classname>future</classname><OutputIterator></type>
|
|
|
|
<parameter name="first">
|
|
<paramtype>InputIterator</paramtype>
|
|
</parameter>
|
|
<parameter name="last">
|
|
<paramtype>InputIterator</paramtype>
|
|
</parameter>
|
|
<parameter name="result">
|
|
<paramtype>OutputIterator</paramtype>
|
|
</parameter>
|
|
<parameter name="queue">
|
|
<paramtype>command_queue &</paramtype>
|
|
<default>
|
|
<methodname>system::default_queue()</methodname>
|
|
</default>
|
|
</parameter>
|
|
|
|
<returns>
|
|
A <classname>future</classname> containing an iterator pointing to
|
|
the end of the result range.
|
|
</returns>
|
|
|
|
<description>
|
|
<para>
|
|
Copies the values from the range [<code>first</code>,
|
|
<code>last</code>) to the range beginning at <code>result</code>.
|
|
The copy is performed asynchronously.
|
|
</para>
|
|
</description>
|
|
</function>
|
|
</namespace>
|
|
</namespace>
|
|
</header>
|