<para><refrefid="classtf_1_1cudaFlow"kindref="compound">tf::cudaFlow</ref> provides a template method, <refrefid="classtf_1_1cudaFlow_1ac2906cb0002fc411a983d100a3d58d62"kindref="member">tf::cudaFlow::single_task</ref>, for creating a task to run the given callable using a single kernel thread.</para>
<title>Include the Header</title><para>You need to include the header file, <computeroutput>taskflow/cuda/algorithm/for_each.hpp</computeroutput>, for creating a single-threaded task.</para>
<title>Run a Task with a Single Thread</title><para>You can create a task to run a kernel function just once, i.e., using one GPU thread. This is handy when you want to set up a single or a few global variables that do not need multiple threads and will be used by multiple kernels afterwards. The following example creates a single-task kernel that sets a device variable to <computeroutput>1</computeroutput>.</para>
<title>Miscellaneous Items</title><para>The single-task algorithm is also available in <refrefid="classtf_1_1cudaFlowCapturer_1ac944c7d20056e0633ef84f1a25b52296"kindref="member">tf::cudaFlowCapturer::single_task</ref>. </para>