Bolt  1.3
C++ template library with support for OpenCL
Functions
CL-copy

Functions

template<typename InputIterator , typename OutputIterator >
OutputIterator bolt::cl::copy (const bolt::cl::control &ctl, InputIterator first, InputIterator last, OutputIterator result, const std::string &user_code="")
 
template<typename InputIterator , typename OutputIterator >
OutputIterator bolt::cl::copy (InputIterator first, InputIterator last, OutputIterator result, const std::string &user_code="")
 
template<typename InputIterator , typename Size , typename OutputIterator >
OutputIterator bolt::cl::copy_n (const bolt::cl::control &ctl, InputIterator first, Size n, OutputIterator result, const std::string &user_code="")
 
template<typename InputIterator , typename Size , typename OutputIterator >
OutputIterator bolt::cl::copy_n (InputIterator first, Size n, OutputIterator result, const std::string &user_code="")
 

Detailed Description

Function Documentation

template<typename InputIterator , typename OutputIterator >
OutputIterator bolt::cl::copy ( const bolt::cl::control ctl,
InputIterator  first,
InputIterator  last,
OutputIterator  result,
const std::string &  user_code = "" 
)

copy copies each element from the sequence [first, last) to [result, result + (last - first)), i.e., it assigns *result = *first, then *(result + 1) = *(first + 1), and so on.

Calling copy with overlapping source and destination ranges has undefined behavior, as the order of copying on the GPU is not guaranteed.

Parameters
ctlOptional Control structure to control command-queue, debug, tuning, etc.See bolt::cl::control.
firstBeginning of the source copy sequence.
lastEnd of the source copy sequence.
resultBeginning of the destination sequence.
user_codeOptional OpenCL(TM) code to be prepended to any OpenCL kernels used by this function.
Returns
result + (last - first).
Template Parameters
InputIteratoris a model of InputIterator and InputIterator's value_type must be convertible to OutputIterator's value_type.
OutputIteratoris a model of OutputIterator

The following demonstrates how to use copy.

#include <bolt/cl/copy.h>
...
std::vector<float> vecSrc(128);
std::vector<float> vecDest(128);
...
bolt::cl::copy(ctrl, vecSrc.begin(), vecSrc.end(), vecDest.begin());
// vecDest is now a copy of vecSrc
See Also
http://www.sgi.com/tech/stl/copy.html
http://www.sgi.com/tech/stl/InputIterator.html
http://www.sgi.com/tech/stl/OutputIterator.html
template<typename InputIterator , typename Size , typename OutputIterator >
OutputIterator bolt::cl::copy_n ( const bolt::cl::control ctl,
InputIterator  first,
Size  n,
OutputIterator  result,
const std::string &  user_code = "" 
)

copy_n copies each element from the sequence [first, first+n) to [result, result + n), i.e., it assigns *result = *first, then *(result + 1) = *(first + 1), and so on.

Calling copy_n with overlapping source and destination ranges has undefined behavior, as the order of copying on the GPU is not guaranteed.

Parameters
ctlOptional Control structure to control command-queue, debug, tuning, etc.See bolt::cl::control.
firstBeginning of the source copy sequence.
nNumber of elements to copy.
resultBeginning of the destination sequence.
user_codeOptional OpenCL™ code to be passed to the OpenCL compiler. The cl_code is inserted first in the generated code, before the cl_code trait.
Returns
result + n.
Template Parameters
InputIteratoris a model of InputIterator and InputIterator's value_type must be convertible to OutputIterator's value_type.
Sizeis an integral type.
OutputIteratoris a model of OutputIterator

The following demonstrates how to use copy.

#include <bolt/cl/copy.h>
...
std::vector<float> vecSrc(128);
std::vector<float> vecDest(128);
...
bolt::cl::copy_n(vecSrc.begin(), 128, vecDest.begin());
// vecDest is now a copy of vecSrc
See Also
http://www.sgi.com/tech/stl/copy_n.html
http://www.sgi.com/tech/stl/InputIterator.html
http://www.sgi.com/tech/stl/OutputIterator.html