diff --git a/doc/tutorial/content/mtapi.tex b/doc/tutorial/content/mtapi.tex index 4b940ce..1ac8c2b 100644 --- a/doc/tutorial/content/mtapi.tex +++ b/doc/tutorial/content/mtapi.tex @@ -152,7 +152,11 @@ After everything is done, the action is deleted (\lstinline|mtapi_action_delete( \section{C++ Interface} \label{sec:mtapi_cpp_interface} -\embb provides C++ wrappers for the MTAPI C interface. The signature of the action function for the C++ interface is the same as in the C interface: +\embb provides C++ wrappers for the MTAPI C interface. The full interface provides functions for all MTAPI releated tasks and supports heterogeneous systems. For ease of use a simpler version for SMP systems is provided. + +\subsection{Full Interface} + +The signature of the action function for the C++ interface is the same as in the C interface: % \\\inputlisting{../examples/mtapi/mtapi_c_action_signature-snippet.h} % @@ -193,7 +197,7 @@ After that, the action function needs to be associated to a job. By instancing a % \\\inputlisting{../examples/mtapi/mtapi_cpp_register_action-snippet.h} % -Not that the action is registered and the job is initialized, the root task can be started: +Now that the action is registered and the job is initialized, the root task can be started: % \\\inputlisting{../examples/mtapi/mtapi_cpp_start_task-snippet.h} % @@ -203,6 +207,19 @@ The registered action will be unregistered when it goes out of scope. The runtime needs to be shut down by calling: \\\inputlisting{../examples/mtapi/mtapi_cpp_finalize-snippet.h} +\subsection{Simplified Interface for SMP actions} + +MTAPI CPP provides a simpler version of the MTAPI interface for SMP actions. The signature of the +action function for the simplified API looks like this: +% +\\\inputlisting{../examples/mtapi/mtapi_cpp_simple_action_signature-snippet.h} +% +The action function does not need to be registered with a job. Instead a preregistered job is used that expects a \lstinline|embb::base::Function| object. Therefore a task can be scheduled directly using only the function above: +% +\\\inputlisting{../examples/mtapi/mtapi_cpp_simple_start_task-snippet.h} +% + + \section{Plugins} The \embb implementation of MTAPI provides an extension to allow for custom actions that are not executed by the scheduler for software actions as detailed in the previous sections. diff --git a/mtapi_cpp/include/embb/mtapi/node.h b/mtapi_cpp/include/embb/mtapi/node.h index 1cb2572..1365cb8 100644 --- a/mtapi_cpp/include/embb/mtapi/node.h +++ b/mtapi_cpp/include/embb/mtapi/node.h @@ -171,8 +171,14 @@ class Node { return task_limit_; } + /** + * Starts a new Task. + * + * \returns The handle to the started Task. + * \threadsafe + */ Task Start( - SMPFunction const & func + SMPFunction const & func /**< Function to use for the task. */ ) { Job job = GetJob(EMBB_MTAPI_FUNCTION_JOB_ID); void * res = NULL; @@ -180,9 +186,16 @@ class Node { job, embb::base::Allocation::New(func), res); } + /** + * Starts a new Task with a given affinity and priority. + * + * \returns The handle to the started Task. + * \threadsafe + */ Task Start( - SMPFunction const & func, - ExecutionPolicy const & policy + SMPFunction const & func, /**< Function to use for the task. */ + ExecutionPolicy const & policy /**< Affinity and priority of the + task. */ ) { Job job = GetJob(EMBB_MTAPI_FUNCTION_JOB_ID); void * res = NULL;