<para><refrefid="classtf_1_1syclFlow"kindref="compound">tf::syclFlow</ref> provides a template method, <refrefid="classtf_1_1syclFlow_1ae278939334a90b6d58d8771e87b2e793"kindref="member">tf::syclFlow::transform</ref>, for creating a task to perform parallel transforms by applying the given function to a range of item and stores the transformed result in another range.</para><sect1id="ParallelTransformsSYCL_1IteratorBasedParallelTransformSYCL">
<title>Iterator-based Parallel Transforms</title>
<para>Iterator-based parallel-transform applies the given transform function to a range of items and store the result in another range specified by two iterators, <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput>. The two iterators are typically two raw pointers to the first element and the next to the last element in the range in GPU memory space. The task created by <refrefid="classtf_1_1syclFlow_1ae278939334a90b6d58d8771e87b2e793"kindref="member">tf::syclFlow::transform</ref>(I first, I last, C&& callable, S... srcs) represents a kernel of parallel execution for the following loop:</para><para><programlistingfilename=".cpp"><codeline><highlightclass="keywordflow">while</highlight><highlightclass="normal"><sp/>(first<sp/>!=<sp/>last)<sp/>{</highlight></codeline>
</programlisting></para><para>The two iterators, <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput>, are typically two raw pointers to the first element and the next to the last element in the range. The following example creates a <computeroutput>transform</computeroutput> kernel that assigns each element, starting from <computeroutput>gpu_data</computeroutput> to <computeroutput>gpu_data + 1000</computeroutput>, to the sum of the corresponding elements at <computeroutput>gpu_data_x</computeroutput>, <computeroutput>gpu_data_y</computeroutput>, and <computeroutput>gpu_data_z</computeroutput>.</para><para><programlistingfilename=".cpp"><codeline><highlightclass="normal">taskflow.<refrefid="classtf_1_1FlowBuilder_1afdf47fd1a358fb64f8c1b89e2a393169"kindref="member">emplace_on</ref>([](<refrefid="classtf_1_1syclFlow"kindref="compound">tf::syclFlow</ref>&<sp/>sf){</highlight></codeline>