4.5. nanos6_spawn_function

The nanos6_spawn_function allows to asynchrously spawn a new function using the runtime resources.

C/C++ format:

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. Once the task finishes the runtime 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.