QUARK
0.9.0
QUARK-QUeuingAndRuntimeforKernels
|
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include <pthread.h>
#include "icl_list.h"
#include "icl_hash.h"
#include "bsd_queue.h"
#include "bsd_tree.h"
#include "quark.h"
#include "quark_unpack_args.h"
#include "quark_trace.h"
Go to the source code of this file.
Data Types | |
struct | quark_s |
struct | Quark_sequence_s |
struct | worker_s |
struct | quark_task_s |
struct | dependency_s |
struct | scratch_s |
struct | address_set_node_s |
struct | ll_list_node_s |
struct | completed_tasks_node_s |
struct | task_priority_tree_node_s |
Macros | |
#define | inline __inline |
#define | fopen(ppfile, name, mode) *ppfile = fopen(name, mode) |
#define | ULLONG_MAX 18446744073709551615ULL |
#define | tasklevel_width_max_level 5000 |
#define | DEPCOLOR "black" |
#define | DEPCOLOR_R_FIRST "black" |
#define | DEPCOLOR_W_FIRST "black" |
#define | DEPCOLOR_RAR "black" |
#define | DEPCOLOR_WAW "black" |
#define | DEPCOLOR_RAW "black" |
#define | DEPCOLOR_WAR "red" |
#define | DEPCOLOR_GATHERV "green" |
#define | DOT_DAG_FILENAME "dot_dag_file.dot" |
#define | dot_dag_print_edge(quark, parentid, parent_level, childid, child_level, color) |
#define | quark_atomic_add(pval, addvalue, pmutex) |
#define | quark_atomic_set(pval, setvalue, pmutex) |
#define | quark_atomic_get(retval, pval, pmutex) |
Typedefs | |
typedef struct worker_s | Worker |
typedef struct quark_task_s | Task |
typedef struct dependency_s | Dependency |
typedef struct scratch_s | Scratch |
typedef struct address_set_node_s | Address_Set_Node |
typedef struct ll_list_node_s | ll_list_node_t |
typedef struct ll_list_head_s | ll_list_head_t |
typedef struct completed_tasks_node_s | completed_tasks_node_t |
typedef struct completed_tasks_head_s | completed_tasks_head_t |
typedef struct task_priority_tree_node_s | task_priority_tree_node_t |
typedef struct task_priority_tree_head_s | task_priority_tree_head_t |
Enumerations | |
enum | task_status { ALLOCATED_ONLY, NOTREADY, QUEUED, RUNNING, DONE, CANCELLED } |
enum | bool { FALSE, TRUE } |
enum | worker_status { WORKER_SLEEPING, WORKER_NOT_SLEEPING } |
Functions/Subroutines | |
LIST_HEAD (ll_list_head_s, ll_list_node_s) | |
TAILQ_HEAD (completed_tasks_head_s, completed_tasks_node_s) | |
RB_HEAD (task_priority_tree_head_s, task_priority_tree_node_s) | |
RB_GENERATE (task_priority_tree_head_s, task_priority_tree_node_s, n_entry, compare_task_priority_tree_nodes) | |
int | quark_setaffinity (int rank) |
void | quark_topology_init () |
void | quark_topology_finalize () |
int | quark_get_numthreads () |
int * | quark_get_affthreads () |
int | quark_yield () |
int | quark_getenv_int (char *name, int defval) |
void | quark_warning (const char *func_name, char *msg_text) |
int | QUARK_Thread_Rank (Quark *quark) |
void * | QUARK_Args_List (Quark *quark) |
int | QUARK_Get_RankInTask (Quark *quark) |
void * | QUARK_Args_Pop (void *args_list, void **last_arg) |
Quark * | QUARK_Setup (int num_threads) |
Quark * | QUARK_New (int num_threads) |
void | QUARK_Barrier (Quark *quark) |
void | QUARK_Waitall (Quark *quark) |
void | QUARK_Free (Quark *quark) |
void | QUARK_Delete (Quark *quark) |
Task * | quark_set_task_flags_in_task_structure (Quark *quark, Task *task, Quark_Task_Flags *task_flags) |
Task * | QUARK_Task_Init (Quark *quark, void(*function)(Quark *), Quark_Task_Flags *task_flags) |
void | QUARK_Task_Pack_Arg (Quark *quark, Task *task, int arg_size, void *arg_ptr, int arg_flags) |
unsigned long long | QUARK_Insert_Task_Packed (Quark *quark, Task *task) |
unsigned long long | QUARK_Insert_Task (Quark *quark, void(*function)(Quark *), Quark_Task_Flags *task_flags,...) |
unsigned long long | QUARK_Execute_Task (Quark *quark, void(*function)(Quark *), Quark_Task_Flags *task_flags,...) |
int | QUARK_Cancel_Task (Quark *quark, unsigned long long taskid) |
void | quark_avoid_war_dependencies (Quark *quark, Address_Set_Node *asn_old, Task *parent_task) |
void | QUARK_Worker_Loop (Quark *quark, int thread_rank) |
Quark_Sequence * | QUARK_Sequence_Create (Quark *quark) |
int | QUARK_Sequence_Cancel (Quark *quark, Quark_Sequence *sequence) |
Quark_Sequence * | QUARK_Sequence_Destroy (Quark *quark, Quark_Sequence *sequence) |
int | QUARK_Sequence_Wait (Quark *quark, Quark_Sequence *sequence) |
Quark_Sequence * | QUARK_Get_Sequence (Quark *quark) |
int | QUARK_Get_Priority (Quark *quark) |
char * | QUARK_Get_Task_Label (Quark *quark) |
Quark_Task_Flags * | QUARK_Task_Flag_Set (Quark_Task_Flags *task_flags, int flag, intptr_t val) |
intptr_t | QUARK_Task_Flag_Get (Quark *quark, int flag) |
void | QUARK_DOT_DAG_Enable (Quark *quark, int enable) |
Variables | |
FILE * | dot_dag_file = NULL |
QUARK (QUeuing And Runtime for Kernels) provides a runtime enviornment for the dynamic execution of precedence-constrained tasks.
QUARK is a software package provided by Univ. of Tennessee, Univ. of California Berkeley and Univ. of Colorado Denver.
Definition in file quark.c.
#define dot_dag_print_edge | ( | quark, | |
parentid, | |||
parent_level, | |||
childid, | |||
child_level, | |||
color | |||
) |
#define fopen | ( | ppfile, | |
name, | |||
mode | |||
) | *ppfile = fopen(name, mode) |
#define quark_atomic_add | ( | pval, | |
addvalue, | |||
pmutex | |||
) |
#define quark_atomic_get | ( | retval, | |
pval, | |||
pmutex | |||
) |
Define a macro get a value. Setup to shorten some code by locking/unlocking a mutex around the operation. Can disable the mutex for performance, since the exact current value of the variable is not needed. The variables used here are declared volatile, and can lag behind the real value without a loss of accuracy.
#define quark_atomic_set | ( | pval, | |
setvalue, | |||
pmutex | |||
) |
typedef struct address_set_node_s Address_Set_Node |
typedef struct completed_tasks_head_s completed_tasks_head_t |
typedef struct completed_tasks_node_s completed_tasks_node_t |
typedef struct dependency_s Dependency |
typedef struct ll_list_head_s ll_list_head_t |
typedef struct ll_list_node_s ll_list_node_t |
typedef struct quark_task_s Task |
typedef struct task_priority_tree_head_s task_priority_tree_head_t |
typedef struct task_priority_tree_node_s task_priority_tree_node_t |
enum task_status |
enum worker_status |
LIST_HEAD | ( | ll_list_head_s | , |
ll_list_node_s | |||
) |
void quark_avoid_war_dependencies | ( | Quark * | quark, |
Address_Set_Node * | asn_old, | ||
Task * | parent_task | ||
) |
Routine to avoid false (WAR write-after-read) dependencies by making copies of the data. Check if there are suffient INPUTS in the beginning of a address dependency followed by a OUTPUT or an INOUT (data<-RRRRW). If so, make a copy of the data, adjust the pointers of the read dependencies to point to the new copy (copy<-RRRR and data<-W) and send to workers if the tasks are ready. The copy can be automacally freed when all the reads are done. The write can proceed at once. The asn_old->asn_mutex is already locked when this is called.
Definition at line 1565 of file quark.c.
References dependency_s::address, address_set_node_s::address, quark_s::address_set, quark_s::address_set_mutex, dependency_s::address_set_node_ptr, dependency_s::address_set_waiting_deps_node_ptr, icl_list_s::data, address_set_node_s::delete_data_at_address_when_node_is_deleted, DEPCOLOR, dependency_s::direction, DONE, dot_dag_print_edge, FALSE, icl_hash_insert(), icl_list_append(), icl_list_delete(), icl_list_first(), icl_list_next(), INOUT, INPUT, quark_s::low_water_mark, NOTREADY, quark_task_s::num_dependencies_remaining, quark_s::num_queued_tasks, quark_s::num_queued_tasks_mutex, quark_s::num_tasks, quark_s::num_threads, OUTPUT, quark_atomic_get, quark_getenv_int(), dependency_s::ready, address_set_node_s::size, quark_task_s::status, dependency_s::task, dependency_s::task_args_list_node_ptr, quark_task_s::task_mutex, quark_task_s::taskid, quark_task_s::tasklevel, TRUE, address_set_node_s::waiting_deps, and quark_s::war_dependencies_enable.
int* quark_get_affthreads | ( | ) |
Definition at line 329 of file quarkos.c.
References CONTEXT_THREADS_MAX, QUARK_CLEANENV, and QUARK_GETENV.
int quark_get_numthreads | ( | ) |
Definition at line 306 of file quarkos.c.
References QUARK_CLEANENV, and QUARK_GETENV.
int quark_getenv_int | ( | char * | name, |
int | defval | ||
) |
Definition at line 384 of file quarkos.c.
References QUARK_CLEANENV, and QUARK_GETENV.
Task* quark_set_task_flags_in_task_structure | ( | Quark * | quark, |
Task * | task, | ||
Quark_Task_Flags * | task_flags | ||
) |
Use the task_flags data structure to set various items in the task (priority, lock_to_thread, color, labels, etc ).
Definition at line 1031 of file quark.c.
References quark_s::dot_dag_enable, quark_task_s::lock_to_thread, quark_task_s::lock_to_thread_mask, quark_task_s::priority, quark_task_s::sequence, quark_task_flags_s::task_color, quark_task_s::task_color, quark_task_flags_s::task_label, quark_task_s::task_label, quark_task_flags_s::task_lock_to_thread, quark_task_flags_s::task_lock_to_thread_mask, quark_task_flags_s::task_priority, quark_task_flags_s::task_sequence, quark_task_flags_s::task_thread_count, quark_task_s::task_thread_count, quark_task_flags_s::thread_set_to_manual_scheduling, and quark_task_s::thread_set_to_manual_scheduling.
int quark_setaffinity | ( | int | rank | ) |
This routine will set affinity for the calling thread that has rank 'rank'. Ranks start with 0.
If there are multiple instances of QUARK then affinity will be wrong: all ranks 0 will be pinned to core 0.
Also, affinity is not resotred when QUARK_Finalize() is called.
Definition at line 129 of file quarkos.c.
References QUARK_ERR_NOT_SUPPORTED, QUARK_ERR_UNEXPECTED, and QUARK_SUCCESS.
void quark_topology_finalize | ( | ) |
Definition at line 115 of file quarkos.c.
References quark_unsetaffinity().
void quark_topology_init | ( | ) |
Definition at line 79 of file quarkos.c.
References pthread_mutex_lock(), and pthread_mutex_unlock().
void quark_warning | ( | const char * | func_name, |
char * | msg_text | ||
) |
int quark_yield | ( | ) |
Definition at line 271 of file quarkos.c.
References QUARK_ERR_NOT_SUPPORTED.
RB_GENERATE | ( | task_priority_tree_head_s | , |
task_priority_tree_node_s | , | ||
n_entry | , | ||
compare_task_priority_tree_nodes | |||
) |
RB_HEAD | ( | task_priority_tree_head_s | , |
task_priority_tree_node_s | |||
) |
TAILQ_HEAD | ( | completed_tasks_head_s | , |
completed_tasks_node_s | |||
) |