Spawning functions¶
The nanos6_spawn_function
allows to asynchronously spawn a new function that will leverage the run-time system resources:
void nanos6_spawn_function(
void (*function)(void *),
void *args,
void (*completion_callback)(void *),
void *completion_args,
char const *label
);
Where each of this routine’s parameters are:
function
the function to be spawned.args
a parameter that is passed to the function.completion_callback
an optional function that will be called when the function finishes.completion_args
a parameter that is passed to the completion callback.label
an optional name for the function.
The routine will create a new OmpSs-2 task executing the function
code and receiving the args
parameters.
This task has an independent namespace of data dependencies and has no relationship with any other existing task (i.e., no taskwait
will wait for it).
Once the task finishes the run-time system will invoke the registered callback service (i.e., completion_callback
using completion_args
parameters).
The callback is used as the provided synchronization mechanism.
The label
string will be used for debugging/instrumentation purposes.