447 lines
33 KiB
XML
447 lines
33 KiB
XML
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
|
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.9.1" xml:lang="en-US">
|
|
<compounddef id="classtf_1_1DataPipeline" kind="class" language="C++" prot="public">
|
|
<compoundname>tf::DataPipeline</compoundname>
|
|
<includes refid="data__pipeline_8hpp" local="no">taskflow/algorithm/data_pipeline.hpp</includes>
|
|
<innerclass refid="structtf_1_1DataPipeline_1_1Line" prot="private">tf::DataPipeline::Line</innerclass>
|
|
<innerclass refid="structtf_1_1DataPipeline_1_1PipeMeta" prot="private">tf::DataPipeline::PipeMeta</innerclass>
|
|
<templateparamlist>
|
|
<param>
|
|
<type>typename...</type>
|
|
<declname>Ps</declname>
|
|
<defname>Ps</defname>
|
|
</param>
|
|
</templateparamlist>
|
|
<sectiondef kind="public-type">
|
|
<memberdef kind="typedef" id="classtf_1_1DataPipeline_1a4fafcfd61a19628b48042b79e0d3f86e" prot="public" static="no">
|
|
<type>unique_variant_t< std::variant< std::conditional_t< std::is_void_v< typename Ps::output_t >, std::monostate, std::decay_t< typename Ps::output_t > >... > ></type>
|
|
<definition>using tf::DataPipeline< Ps >::data_t = unique_variant_t<std::variant<std::conditional_t< std::is_void_v<typename Ps::output_t>, std::monostate, std::decay_t<typename Ps::output_t> >... > ></definition>
|
|
<argsstring></argsstring>
|
|
<name>data_t</name>
|
|
<briefdescription>
|
|
<para>internal storage type for each data token (default std::variant) </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="278" column="3" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="282" bodyend="-1"/>
|
|
</memberdef>
|
|
</sectiondef>
|
|
<sectiondef kind="private-attrib">
|
|
<memberdef kind="variable" id="classtf_1_1DataPipeline_1aceec74e44a0b6c2c7018844643da84fb" prot="private" static="no" mutable="no">
|
|
<type><ref refid="classtf_1_1Graph" kindref="compound">Graph</ref></type>
|
|
<definition>Graph tf::DataPipeline< Ps >::_graph</definition>
|
|
<argsstring></argsstring>
|
|
<name>_graph</name>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="355" column="9" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="355" bodyend="-1"/>
|
|
</memberdef>
|
|
<memberdef kind="variable" id="classtf_1_1DataPipeline_1a4c4d77197be98821ad567db7e8d1cc61" prot="private" static="no" mutable="no">
|
|
<type>size_t</type>
|
|
<definition>size_t tf::DataPipeline< Ps >::_num_tokens</definition>
|
|
<argsstring></argsstring>
|
|
<name>_num_tokens</name>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="357" column="10" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="357" bodyend="-1"/>
|
|
</memberdef>
|
|
<memberdef kind="variable" id="classtf_1_1DataPipeline_1a30a1c660df935da648be30743a6a3381" prot="private" static="no" mutable="no">
|
|
<type><ref refid="cpp/utility/tuple" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::tuple</ref>< Ps... ></type>
|
|
<definition>std::tuple<Ps...> tf::DataPipeline< Ps >::_pipes</definition>
|
|
<argsstring></argsstring>
|
|
<name>_pipes</name>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="359" column="14" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="359" bodyend="-1"/>
|
|
</memberdef>
|
|
<memberdef kind="variable" id="classtf_1_1DataPipeline_1ad7bb60a333fe6cde6c72c7599145a96c" prot="private" static="no" mutable="no">
|
|
<type><ref refid="cpp/container/array" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::array</ref>< PipeMeta, sizeof...(Ps)></type>
|
|
<definition>std::array<PipeMeta, sizeof...(Ps)> tf::DataPipeline< Ps >::_meta</definition>
|
|
<argsstring></argsstring>
|
|
<name>_meta</name>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="360" column="14" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="360" bodyend="-1"/>
|
|
</memberdef>
|
|
<memberdef kind="variable" id="classtf_1_1DataPipeline_1aa8c8a3852f6a055e0666bd679b69a550" prot="private" static="no" mutable="no">
|
|
<type><ref refid="cpp/container/vector" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::vector</ref>< <ref refid="cpp/container/array" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::array</ref>< Line, sizeof...(Ps)> ></type>
|
|
<definition>std::vector<std::array<Line, sizeof...(Ps)> > tf::DataPipeline< Ps >::_lines</definition>
|
|
<argsstring></argsstring>
|
|
<name>_lines</name>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="361" column="15" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="361" bodyend="-1"/>
|
|
</memberdef>
|
|
<memberdef kind="variable" id="classtf_1_1DataPipeline_1ab8d93e0c228355590102a9bc1775b5fd" prot="private" static="no" mutable="no">
|
|
<type><ref refid="cpp/container/vector" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::vector</ref>< <ref refid="classtf_1_1Task" kindref="compound">Task</ref> ></type>
|
|
<definition>std::vector<Task> tf::DataPipeline< Ps >::_tasks</definition>
|
|
<argsstring></argsstring>
|
|
<name>_tasks</name>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="362" column="15" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="362" bodyend="-1"/>
|
|
</memberdef>
|
|
<memberdef kind="variable" id="classtf_1_1DataPipeline_1ae78ad58672cd1a4307543957950d7819" prot="private" static="no" mutable="no">
|
|
<type><ref refid="cpp/container/vector" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::vector</ref>< <ref refid="classtf_1_1Pipeflow" kindref="compound">Pipeflow</ref> ></type>
|
|
<definition>std::vector<Pipeflow> tf::DataPipeline< Ps >::_pipeflows</definition>
|
|
<argsstring></argsstring>
|
|
<name>_pipeflows</name>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="363" column="15" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="363" bodyend="-1"/>
|
|
</memberdef>
|
|
<memberdef kind="variable" id="classtf_1_1DataPipeline_1a59b6d2346e79a363f5c15958a9d14d7b" prot="private" static="no" mutable="no">
|
|
<type><ref refid="cpp/container/vector" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::vector</ref>< CachelineAligned< <ref refid="classtf_1_1DataPipeline_1a4fafcfd61a19628b48042b79e0d3f86e" kindref="member">data_t</ref> > ></type>
|
|
<definition>std::vector<CachelineAligned<data_t> > tf::DataPipeline< Ps >::_buffer</definition>
|
|
<argsstring></argsstring>
|
|
<name>_buffer</name>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="364" column="15" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="364" bodyend="-1"/>
|
|
</memberdef>
|
|
</sectiondef>
|
|
<sectiondef kind="public-func">
|
|
<memberdef kind="function" id="classtf_1_1DataPipeline_1a1559f218ca91b41d6c871a88183a04e5" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
|
|
<type></type>
|
|
<definition>tf::DataPipeline< Ps >::DataPipeline</definition>
|
|
<argsstring>(size_t num_lines, Ps &&... ps)</argsstring>
|
|
<name>DataPipeline</name>
|
|
<param>
|
|
<type>size_t</type>
|
|
<declname>num_lines</declname>
|
|
</param>
|
|
<param>
|
|
<type>Ps &&...</type>
|
|
<declname>ps</declname>
|
|
</param>
|
|
<briefdescription>
|
|
<para>constructs a data-parallel pipeline object </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
<para><parameterlist kind="param"><parameteritem>
|
|
<parameternamelist>
|
|
<parametername>num_lines</parametername>
|
|
</parameternamelist>
|
|
<parameterdescription>
|
|
<para>the number of parallel lines </para>
|
|
</parameterdescription>
|
|
</parameteritem>
|
|
<parameteritem>
|
|
<parameternamelist>
|
|
<parametername>ps</parametername>
|
|
</parameternamelist>
|
|
<parameterdescription>
|
|
<para>a list of pipes</para>
|
|
</parameterdescription>
|
|
</parameteritem>
|
|
</parameterlist>
|
|
Constructs a data-parallel pipeline of up to <computeroutput>num_lines</computeroutput> parallel lines to schedule tokens through the given linear chain of pipes. The first pipe must define a serial direction (<ref refid="namespacetf_1abb7a11e41fd457f69e7ff45d4c769564a7b804a28d6154ab8007287532037f1d0" kindref="member">tf::PipeType::SERIAL</ref>) or an exception will be thrown. </para>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="295" column="3" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="375" bodyend="393"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1DataPipeline_1abe9f09834e32eebf792c330fe825138d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
|
|
<type></type>
|
|
<definition>tf::DataPipeline< Ps >::DataPipeline</definition>
|
|
<argsstring>(size_t num_lines, std::tuple< Ps... > &&ps)</argsstring>
|
|
<name>DataPipeline</name>
|
|
<param>
|
|
<type>size_t</type>
|
|
<declname>num_lines</declname>
|
|
</param>
|
|
<param>
|
|
<type><ref refid="cpp/utility/tuple" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::tuple</ref>< Ps... > &&</type>
|
|
<declname>ps</declname>
|
|
</param>
|
|
<briefdescription>
|
|
<para>constructs a data-parallel pipeline object </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
<para><parameterlist kind="param"><parameteritem>
|
|
<parameternamelist>
|
|
<parametername>num_lines</parametername>
|
|
</parameternamelist>
|
|
<parameterdescription>
|
|
<para>the number of parallel lines </para>
|
|
</parameterdescription>
|
|
</parameteritem>
|
|
<parameteritem>
|
|
<parameternamelist>
|
|
<parametername>ps</parametername>
|
|
</parameternamelist>
|
|
<parameterdescription>
|
|
<para>a tuple of pipes</para>
|
|
</parameterdescription>
|
|
</parameteritem>
|
|
</parameterlist>
|
|
Constructs a data-parallel pipeline of up to <computeroutput>num_lines</computeroutput> parallel lines to schedule tokens through the given linear chain of pipes stored in a <ref refid="cpp/utility/tuple" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::tuple</ref>. The first pipe must define a serial direction (<ref refid="namespacetf_1abb7a11e41fd457f69e7ff45d4c769564a7b804a28d6154ab8007287532037f1d0" kindref="member">tf::PipeType::SERIAL</ref>) or an exception will be thrown. </para>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="308" column="3" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="397" bodyend="417"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1DataPipeline_1aaa74a52dac68155a9b73f5f70d9d14aa" prot="public" static="no" const="yes" explicit="no" inline="no" noexcept="yes" virt="non-virtual">
|
|
<type>size_t</type>
|
|
<definition>size_t tf::DataPipeline< Ps >::num_lines</definition>
|
|
<argsstring>() const noexcept</argsstring>
|
|
<name>num_lines</name>
|
|
<briefdescription>
|
|
<para>queries the number of parallel lines </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
<para>The function returns the number of parallel lines given by the user upon the construction of the pipeline. The number of lines represents the maximum parallelism this pipeline can achieve. </para>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="318" column="10" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="428" bodyend="430"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1DataPipeline_1a8720a404e3811b28e3dd5b98c9047496" prot="public" static="no" constexpr="yes" const="yes" explicit="no" inline="no" noexcept="yes" virt="non-virtual">
|
|
<type>constexpr size_t</type>
|
|
<definition>constexpr size_t tf::DataPipeline< Ps >::num_pipes</definition>
|
|
<argsstring>() const noexcept</argsstring>
|
|
<name>num_pipes</name>
|
|
<briefdescription>
|
|
<para>queries the number of pipes </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
<para>The Function returns the number of pipes given by the user upon the construction of the pipeline. </para>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="326" column="20" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="434" bodyend="436"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1DataPipeline_1ad6355a117bbc4d3d607fb6f95ffd9889" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
|
|
<type>void</type>
|
|
<definition>void tf::DataPipeline< Ps >::reset</definition>
|
|
<argsstring>()</argsstring>
|
|
<name>reset</name>
|
|
<briefdescription>
|
|
<para>resets the pipeline </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
<para>Resetting the pipeline to the initial state. After resetting a pipeline, its token identifier will start from zero as if the pipeline was just constructed. </para>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="335" column="8" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="452" bodyend="480"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1DataPipeline_1a2c208032313105d142e2c8cec650acfe" prot="public" static="no" const="yes" explicit="no" inline="no" noexcept="yes" virt="non-virtual">
|
|
<type>size_t</type>
|
|
<definition>size_t tf::DataPipeline< Ps >::num_tokens</definition>
|
|
<argsstring>() const noexcept</argsstring>
|
|
<name>num_tokens</name>
|
|
<briefdescription>
|
|
<para>queries the number of generated tokens in the pipeline </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
<para>The number represents the total scheduling tokens that has been generated by the pipeline so far. </para>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="343" column="10" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="440" bodyend="442"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1DataPipeline_1adfc70da6fdffc4a0a56bd2fe0f0dc07d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
|
|
<type><ref refid="classtf_1_1Graph" kindref="compound">Graph</ref> &</type>
|
|
<definition>Graph & tf::DataPipeline< Ps >::graph</definition>
|
|
<argsstring>()</argsstring>
|
|
<name>graph</name>
|
|
<briefdescription>
|
|
<para>obtains the graph object associated with the pipeline construct </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
<para>This method is primarily used as an opaque data structure for creating a module task of this pipeline. </para>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="351" column="9" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="446" bodyend="448"/>
|
|
</memberdef>
|
|
</sectiondef>
|
|
<sectiondef kind="private-func">
|
|
<memberdef kind="function" id="classtf_1_1DataPipeline_1a4550dd13483b3624648acda90d1e04f4" prot="private" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
|
|
<templateparamlist>
|
|
<param>
|
|
<type>size_t...</type>
|
|
<declname>I</declname>
|
|
<defname>I</defname>
|
|
</param>
|
|
</templateparamlist>
|
|
<type>auto</type>
|
|
<definition>auto tf::DataPipeline< Ps >::_gen_meta</definition>
|
|
<argsstring>(std::tuple< Ps... > &&, std::index_sequence< I... >)</argsstring>
|
|
<name>_gen_meta</name>
|
|
<param>
|
|
<type><ref refid="cpp/utility/tuple" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::tuple</ref>< Ps... > &&</type>
|
|
<defname>ps</defname>
|
|
</param>
|
|
<param>
|
|
<type>std::index_sequence< I... ></type>
|
|
</param>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="367" column="8" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="422" bodyend="424"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1DataPipeline_1ad5836484403bf71a4082fc9a71393e86" prot="private" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
|
|
<type>void</type>
|
|
<definition>void tf::DataPipeline< Ps >::_on_pipe</definition>
|
|
<argsstring>(Pipeflow &, Runtime &)</argsstring>
|
|
<name>_on_pipe</name>
|
|
<param>
|
|
<type><ref refid="classtf_1_1Pipeflow" kindref="compound">Pipeflow</ref> &</type>
|
|
<defname>pf</defname>
|
|
</param>
|
|
<param>
|
|
<type><ref refid="classtf_1_1Runtime" kindref="compound">Runtime</ref> &</type>
|
|
</param>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="369" column="8" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="484" bodyend="534"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1DataPipeline_1a2820a8648648fbdb5f06220b5960f033" prot="private" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
|
|
<type>void</type>
|
|
<definition>void tf::DataPipeline< Ps >::_build</definition>
|
|
<argsstring>()</argsstring>
|
|
<name>_build</name>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="370" column="8" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="538" bodyend="629"/>
|
|
</memberdef>
|
|
</sectiondef>
|
|
<briefdescription>
|
|
<para>class to create a data-parallel pipeline scheduling framework </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
<para><parameterlist kind="templateparam"><parameteritem>
|
|
<parameternamelist>
|
|
<parametername>Ps</parametername>
|
|
</parameternamelist>
|
|
<parameterdescription>
|
|
<para>data pipe types</para>
|
|
</parameterdescription>
|
|
</parameteritem>
|
|
</parameterlist>
|
|
Similar to <ref refid="classtf_1_1Pipeline" kindref="compound">tf::Pipeline</ref>, a <ref refid="classtf_1_1DataPipeline" kindref="compound">tf::DataPipeline</ref> is a composable graph object for users to create a <emphasis>data-parallel pipeline scheduling framework</emphasis> using a module task in a taskflow. The only difference is that <ref refid="classtf_1_1DataPipeline" kindref="compound">tf::DataPipeline</ref> provides a data abstraction for users to quickly express dataflow in a pipeline. The following example creates a data-parallel pipeline of three stages that generate dataflow from <computeroutput>void</computeroutput> to <computeroutput>int</computeroutput>, <computeroutput><ref refid="cpp/string/basic_string" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::string</ref></computeroutput>, and <computeroutput>void</computeroutput>.</para>
|
|
<para><programlisting filename=".cpp"><codeline><highlight class="preprocessor">#include<sp/><<ref refid="taskflow_8hpp" kindref="compound">taskflow/taskflow.hpp</ref>></highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><taskflow/algorithm/data_pipeline.hpp></highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>main()<sp/>{</highlight></codeline>
|
|
<codeline><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>data<sp/>flow<sp/>=><sp/>void<sp/>-><sp/>int<sp/>-><sp/>std::string<sp/>-><sp/>void</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><ref refid="classtf_1_1Taskflow" kindref="compound">tf::Taskflow</ref><sp/>taskflow(</highlight><highlight class="stringliteral">"pipeline"</highlight><highlight class="normal">);</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><ref refid="classtf_1_1Executor" kindref="compound">tf::Executor</ref><sp/>executor;</highlight></codeline>
|
|
<codeline><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/><ref refid="classtf_1_1DataPipeline_1aaa74a52dac68155a9b73f5f70d9d14aa" kindref="member">num_lines</ref><sp/>=<sp/>4;</highlight></codeline>
|
|
<codeline><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><ref refid="classtf_1_1DataPipeline" kindref="compound">tf::DataPipeline</ref><sp/>pl(<ref refid="classtf_1_1DataPipeline_1aaa74a52dac68155a9b73f5f70d9d14aa" kindref="member">num_lines</ref>,</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/>tf::make_data_pipe<void,<sp/>int>(<ref refid="namespacetf_1abb7a11e41fd457f69e7ff45d4c769564a7b804a28d6154ab8007287532037f1d0" kindref="member">tf::PipeType::SERIAL</ref>,<sp/>[&](<ref refid="classtf_1_1Pipeflow" kindref="compound">tf::Pipeflow</ref>&<sp/>pf)<sp/>-><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal">{</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(pf.<ref refid="classtf_1_1Pipeflow_1a295e5d884665c076f4ef5d78139f7c51" kindref="member">token</ref>()<sp/>==<sp/>5)<sp/>{</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pf.stop();</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>return<sp/>0;</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>return<sp/>pf.token();</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/>}),</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/>tf::make_data_pipe<int,<sp/>std::string>(<ref refid="namespacetf_1abb7a11e41fd457f69e7ff45d4c769564a7b804a28d6154ab8007287532037f1d0" kindref="member">tf::PipeType::SERIAL</ref>,<sp/>[](</highlight><highlight class="keywordtype">int</highlight><highlight class="normal">&<sp/>input)<sp/>{</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="namespacetf_1a9ca58dc6c666698cc7373eb0262140ef" kindref="member">std::to_string</ref>(input<sp/>+<sp/>100);</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/>}),</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/>tf::make_data_pipe<std::string,<sp/>void>(<ref refid="namespacetf_1abb7a11e41fd457f69e7ff45d4c769564a7b804a28d6154ab8007287532037f1d0" kindref="member">tf::PipeType::SERIAL</ref>,<sp/>[](<ref refid="cpp/string/basic_string" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::string</ref>&<sp/>input)<sp/>{</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="cpp/io/basic_ostream" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::cout</ref><sp/><<<sp/>input<sp/><<<sp/><ref refid="cpp/io/manip/endl" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::endl</ref>;</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/>})</highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/>);</highlight></codeline>
|
|
<codeline><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>build<sp/>the<sp/>pipeline<sp/>graph<sp/>using<sp/>composition</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/>taskflow.composed_of(pl).name(</highlight><highlight class="stringliteral">"pipeline"</highlight><highlight class="normal">);</highlight></codeline>
|
|
<codeline><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>dump<sp/>the<sp/>pipeline<sp/>graph<sp/>structure<sp/>(with<sp/>composition)</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/>taskflow.dump(<ref refid="cpp/io/basic_ostream" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::cout</ref>);</highlight></codeline>
|
|
<codeline><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>run<sp/>the<sp/>pipeline</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/>executor.<ref refid="classtf_1_1Executor_1a8d08f0cb79e7b3780087975d13368a96" kindref="member">run</ref>(taskflow).wait();</highlight></codeline>
|
|
<codeline><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
|
|
<codeline><highlight class="normal">}</highlight></codeline>
|
|
</programlisting></para>
|
|
<para>The pipeline schedules five tokens over four parallel lines in a circular fashion, as depicted below:</para>
|
|
<para><programlisting filename=".shell-session"><codeline><highlight class="normal">o<sp/>-><sp/>o<sp/>-><sp/>o</highlight></codeline>
|
|
<codeline><highlight class="normal">|<sp/><sp/><sp/><sp/>|<sp/><sp/><sp/><sp/>|</highlight></codeline>
|
|
<codeline><highlight class="normal">v<sp/><sp/><sp/><sp/>v<sp/><sp/><sp/><sp/>v</highlight></codeline>
|
|
<codeline><highlight class="normal">o<sp/>-><sp/>o<sp/>-><sp/>o</highlight></codeline>
|
|
<codeline><highlight class="normal">|<sp/><sp/><sp/><sp/>|<sp/><sp/><sp/><sp/>|</highlight></codeline>
|
|
<codeline><highlight class="normal">v<sp/><sp/><sp/><sp/>v<sp/><sp/><sp/><sp/>v</highlight></codeline>
|
|
<codeline><highlight class="normal">o<sp/>-><sp/>o<sp/>-><sp/>o</highlight></codeline>
|
|
<codeline><highlight class="normal">|<sp/><sp/><sp/><sp/>|<sp/><sp/><sp/><sp/>|</highlight></codeline>
|
|
<codeline><highlight class="normal">v<sp/><sp/><sp/><sp/>v<sp/><sp/><sp/><sp/>v</highlight></codeline>
|
|
<codeline><highlight class="normal">o<sp/>-><sp/>o<sp/>-><sp/>o</highlight></codeline>
|
|
</programlisting> </para>
|
|
</detaileddescription>
|
|
<location file="taskflow/algorithm/data_pipeline.hpp" line="254" column="1" bodyfile="taskflow/algorithm/data_pipeline.hpp" bodystart="254" bodyend="371"/>
|
|
<listofallmembers>
|
|
<member refid="classtf_1_1DataPipeline_1a59b6d2346e79a363f5c15958a9d14d7b" prot="private" virt="non-virtual"><scope>tf::DataPipeline</scope><name>_buffer</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1a2820a8648648fbdb5f06220b5960f033" prot="private" virt="non-virtual"><scope>tf::DataPipeline</scope><name>_build</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1a4550dd13483b3624648acda90d1e04f4" prot="private" virt="non-virtual"><scope>tf::DataPipeline</scope><name>_gen_meta</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1aceec74e44a0b6c2c7018844643da84fb" prot="private" virt="non-virtual"><scope>tf::DataPipeline</scope><name>_graph</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1aa8c8a3852f6a055e0666bd679b69a550" prot="private" virt="non-virtual"><scope>tf::DataPipeline</scope><name>_lines</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1ad7bb60a333fe6cde6c72c7599145a96c" prot="private" virt="non-virtual"><scope>tf::DataPipeline</scope><name>_meta</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1a4c4d77197be98821ad567db7e8d1cc61" prot="private" virt="non-virtual"><scope>tf::DataPipeline</scope><name>_num_tokens</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1ad5836484403bf71a4082fc9a71393e86" prot="private" virt="non-virtual"><scope>tf::DataPipeline</scope><name>_on_pipe</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1ae78ad58672cd1a4307543957950d7819" prot="private" virt="non-virtual"><scope>tf::DataPipeline</scope><name>_pipeflows</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1a30a1c660df935da648be30743a6a3381" prot="private" virt="non-virtual"><scope>tf::DataPipeline</scope><name>_pipes</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1ab8d93e0c228355590102a9bc1775b5fd" prot="private" virt="non-virtual"><scope>tf::DataPipeline</scope><name>_tasks</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1a4fafcfd61a19628b48042b79e0d3f86e" prot="public" virt="non-virtual"><scope>tf::DataPipeline</scope><name>data_t</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1a1559f218ca91b41d6c871a88183a04e5" prot="public" virt="non-virtual"><scope>tf::DataPipeline</scope><name>DataPipeline</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1abe9f09834e32eebf792c330fe825138d" prot="public" virt="non-virtual"><scope>tf::DataPipeline</scope><name>DataPipeline</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1adfc70da6fdffc4a0a56bd2fe0f0dc07d" prot="public" virt="non-virtual"><scope>tf::DataPipeline</scope><name>graph</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1aaa74a52dac68155a9b73f5f70d9d14aa" prot="public" virt="non-virtual"><scope>tf::DataPipeline</scope><name>num_lines</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1a8720a404e3811b28e3dd5b98c9047496" prot="public" virt="non-virtual"><scope>tf::DataPipeline</scope><name>num_pipes</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1a2c208032313105d142e2c8cec650acfe" prot="public" virt="non-virtual"><scope>tf::DataPipeline</scope><name>num_tokens</name></member>
|
|
<member refid="classtf_1_1DataPipeline_1ad6355a117bbc4d3d607fb6f95ffd9889" prot="public" virt="non-virtual"><scope>tf::DataPipeline</scope><name>reset</name></member>
|
|
</listofallmembers>
|
|
</compounddef>
|
|
</doxygen>
|