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:
functionthe function to be spawned.argsa parameter that is passed to the function.completion_callbackan optional function that will be called when the function finishes.completion_argsa parameter that is passed to the completion callback.labelan 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.