MAGMA  magma-1.4.0
Matrix Algebra on GPU and Multicore Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
QUARK: Unsupported functions

Functions

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 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
-1 since the task is run at once and there is no need for a task handle.

Definition at line 1122 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, scratch_allocate(), scratch_deallocate(), quark_task_s::scratch_list, quark_task_s::status, quark_task_s::task_mutex, and quark_s::worker.

1123 {
1124  va_list varg_list;
1125  int arg_size;
1126 
1127  Task *task = QUARK_Task_Init(quark, function, task_flags);
1128 
1129  va_start(varg_list, task_flags);
1130  // For each argument
1131  while( (arg_size = va_arg(varg_list, int)) != 0) {
1132  void *arg_ptr = va_arg(varg_list, void *);
1133  int arg_flags = va_arg(varg_list, int);
1134  QUARK_Task_Pack_Arg( quark, task, arg_size, arg_ptr, arg_flags );
1135  }
1136  va_end(varg_list);
1137 
1138  int thread_rank = QUARK_Thread_Rank(quark);
1139  Worker *worker = quark->worker[thread_rank];
1140  if ( task->function == NULL ) {
1141  /* This can occur if the task is cancelled */
1142  task->status = CANCELLED;
1143  } else {
1144  /* Call the task */
1145  task->status = RUNNING;
1146  worker->current_task_ptr = task;
1147  scratch_allocate( task );
1148  task->function( quark );
1149  scratch_deallocate( task );
1150  worker->current_task_ptr = NULL;
1151  task->status = DONE;
1152  }
1153 
1154  /* Delete the task data structures */
1155  icl_list_destroy(task->args_list, free);
1156  icl_list_destroy(task->dependency_list, free);
1157  icl_list_destroy(task->scratch_list, free);
1159  free(task);
1160 
1161  /* There is no real taskid to be returned, since the task has been deleted */
1162  return( -1 );
1163 }
pthread_mutex_t task_mutex
Definition: quark.c:142
int icl_list_destroy(icl_list_t *head, void(*free_function)(void *))
Definition: icl_list.c:143
int QUARK_Thread_Rank(Quark *quark)
Definition: quark.c:377
void(* function)(Quark *)
Definition: quark.c:143
static void scratch_deallocate(Task *task)
Definition: quark.c:626
struct worker_s ** worker
Definition: quark.c:100
volatile task_status status
Definition: quark.c:144
icl_list_t * args_list
Definition: quark.c:147
void QUARK_Task_Pack_Arg(Quark *quark, Quark_Task *task, int arg_size, void *arg_ptr, int arg_flags)
Definition: quark.c:925
icl_list_t * scratch_list
Definition: quark.c:149
Definition: quark.c:92
static void scratch_allocate(Task *task)
Definition: quark.c:605
MAGMA_DLLPORT int MAGMA_CDECL pthread_mutex_destroy(pthread_mutex_t *mutex)
Quark_Task * QUARK_Task_Init(Quark *quark, void(*function)(Quark *), Quark_Task_Flags *task_flags)
Definition: quark.c:895
Quark_Task * current_task_ptr
Definition: quark.c:135
icl_list_t * dependency_list
Definition: quark.c:148
Definition: quark.c:92

Here is the call graph for this function: