QUARK  0.9.0
QUARK-QUeuingAndRuntimeforKernels
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
QUARK: Unsupported functions

Functions/Subroutines

unsigned long long QUARK_Execute_Task (Quark *quark, void(*function)(Quark *), Quark_Task_Flags *task_flags,...)

Detailed Description

These functions are used by internal QUARK and PLASMA developers to obtain very specific behavior, but are unsupported and may have unexpected results.


Function/Subroutine Documentation

unsigned long long QUARK_Execute_Task ( Quark quark,
void(*)(Quark *)  function,
Quark_Task_Flags task_flags,
  ... 
)

Run this task in the current thread, at once, without scheduling. This is an unsupported function that can be used by developers for testing.

Parameters:
[in,out]quarkThe scheduler's main data structure.
[in]functionThe function (task) to be executed by the scheduler
[in]task_flagsFlags to specify task behavior
[in]...Triplets of the form, ending with 0 for arg_size. arg_size, arg_ptr, arg_flags where arg_size: int: Size of the argument in bytes (0 cannot be used here) arg_ptr: pointer: Pointer to data or argument arg_flags: int: Flags indicating argument usage and various decorators INPUT, OUTPUT, INOUT, VALUE, NODEP, SCRATCH LOCALITY, ACCUMULATOR, GATHERV TASK_COLOR, TASK_LABEL (special decorators for VALUE) e.g., arg_flags INPUT | LOCALITY | ACCUMULATOR e.g., arg_flags VALUE | TASK_COLOR
Returns:
Error value 0 since the task is run at once and there is no need for a task handle.

Definition at line 1313 of file quark.c.

References quark_task_s::args_list, CANCELLED, worker_s::current_task_ptr, quark_task_s::dependency_list, DONE, quark_task_s::function, icl_list_destroy(), pthread_mutex_destroy(), QUARK_Task_Init(), QUARK_Task_Pack_Arg(), QUARK_Thread_Rank(), RUNNING, quark_task_s::scratch_list, quark_task_s::status, quark_task_s::task_mutex, and quark_s::worker.

{
va_list varg_list;
int arg_size;
Task *task = QUARK_Task_Init(quark, function, task_flags);
va_start(varg_list, task_flags);
// For each argument
while( (arg_size = va_arg(varg_list, int)) != 0) {
void *arg_ptr = va_arg(varg_list, void *);
int arg_flags = va_arg(varg_list, int);
QUARK_Task_Pack_Arg( quark, task, arg_size, arg_ptr, arg_flags );
}
va_end(varg_list);
int thread_rank = QUARK_Thread_Rank(quark);
Worker *worker = quark->worker[thread_rank];
if ( task->function == NULL ) {
/* This can occur if the task is cancelled */
task->status = CANCELLED;
} else {
/* Call the task */
task->status = RUNNING;
worker->current_task_ptr = task;
quark_scratch_allocate( task );
task->function( quark );
quark_scratch_deallocate( task );
worker->current_task_ptr = NULL;
task->status = DONE;
}
/* Delete the task data structures */
free(task);
/* There is no real taskid to be returned, since the task has been deleted */
return( 0 );
}

Here is the call graph for this function: