Commit da33b2b3 authored by Adrian Munera's avatar Adrian Munera
Browse files

Static task scheduling environment variable

parent b5c76bc3
......@@ -63,6 +63,7 @@ ident_color *ColorMap;
ident_task *TaskIdentMap;
kmp_int32 ColorIndex = 0;
bool staticSchedule = false;
//Structures for the prealloc mechanism
struct kmp_space_indexer free_space_indexer;
struct kmp_task_alloc_info *task_static_table;
......@@ -1168,6 +1169,11 @@ void __kmpc_taskgraph(ident_t *loc_ref, kmp_int32 gtid, void (*entry)(void *),
//printf("Recording! \n");
__kmpc_record(loc_ref, gtid, entry, args);
} else if (tdg_type == STATIC_TDG) {
char *my_env_var = getenv("OMP_TASK_SCHEDULE");
if (my_env_var && strcmp(my_env_var, "static") == 0) {
staticSchedule = true;
}
// printf("Fill data and executing! \n");
dynamic_tdgs[0].loc = loc_ref->psource;
......
......@@ -36,6 +36,7 @@ extern struct kmp_task_alloc_info *task_static_table;
extern kmp_task_t *kmp_get_free_task_from_indexer();
extern void kmp_insert_task_in_indexer(kmp_task_t *task);
bool disable_stealing = false;
extern bool staticSchedule;
#endif
/* forward declaration */
......@@ -1869,7 +1870,7 @@ kmp_int32 __kmp_omp_task(kmp_int32 gtid, kmp_task_t *new_task,
return TASK_CURRENT_NOT_QUEUED;
}
if (new_taskdata->is_taskgraph) {
if (new_taskdata->is_taskgraph && staticSchedule) {
int threadID = RecordMap[new_taskdata->td_task_id].static_thread;
if (threadID != -1) {
if (!disable_stealing)
......@@ -1885,13 +1886,16 @@ kmp_int32 __kmp_omp_task(kmp_int32 gtid, kmp_task_t *new_task,
__kmp_threads[gtid]->th.th_task_team->tt.tt_nproc))
KMP_FATAL(ThreadIdentInvalid);
// Wait for the target thread to spawn
while (__kmp_threads[newGtid]->th.th_task_team == nullptr) {
__asm__ volatile("nop");
}
gtid = newGtid;
}
else{
RecordMap[new_taskdata->td_task_id].static_thread = __kmp_tid_from_gtid(gtid);
}
// Wait for the target thread to spawn
while (__kmp_threads[gtid]->th.th_task_team == nullptr) {
__asm__ volatile("nop");
}
}
#endif
/* Should we execute the new task or queue it? For now, let's just always try
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment