diff --git a/Makefile b/Makefile index 4c1ecc2..02c943f 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ dump: ovni.o dump.o parson.o test_speed: test_speed.c ovni.o parson.o -emu: emu.o emu_ovni.o emu_nosv.o emu_tampi.o emu_openmp.o ovni.o prv.o pcf.o parson.o chan.o +emu: emu.o emu_ovni.o emu_nosv.o emu_tampi.o emu_openmp.o emu_nanos6lite.o ovni.o prv.o pcf.o parson.o chan.o libovni.so: ovni.o parson.o $(LINK.c) -shared $^ -o $@ diff --git a/cfg/cpu-nanos6lite-mode.cfg b/cfg/cpu-nanos6lite-mode.cfg new file mode 100644 index 0000000..c6b0359 --- /dev/null +++ b/cfg/cpu-nanos6lite-mode.cfg @@ -0,0 +1,43 @@ +#ParaverCFG +ConfigFile.Version: 3.4 +ConfigFile.NumWindows: 1 + + +################################################################################ +< NEW DISPLAYING WINDOW Thread: Nanos6-Lite mode > +################################################################################ +window_name CPU: Nanos6-Lite mode +window_type single +window_id 1 +window_position_x 960 +window_position_y 287 +window_width 954 +window_height 236 +window_comm_lines_enabled true +window_flags_enabled true +window_noncolor_mode true +window_logical_filtered true +window_physical_filtered false +window_comm_fromto true +window_comm_tagsize true +window_comm_typeval true +window_units Microseconds +window_maximum_y 5.000000000000 +window_minimum_y 1.000000000000 +window_compute_y_max true +window_level thread +window_scale_relative 1.000000000000 +window_end_time_relative 1.000000000000 +window_object appl { 1, { All } } +window_begin_time_relative 0.000000000000 +window_open true +window_drawmode draw_maximum +window_drawmode_rows draw_maximum +window_pixel_size 1 +window_labels_to_draw 1 +window_selected_functions { 14, { {cpu, Active Thd}, {appl, Adding}, {task, Adding}, {thread, Last Evt Val}, {node, Adding}, {system, Adding}, {workload, Adding}, {from_obj, All}, {to_obj, All}, {tag_msg, All}, {size_msg, All}, {bw_msg, All}, {evt_type, =}, {evt_value, All} } } +window_compose_functions { 9, { {compose_cpu, As Is}, {compose_appl, As Is}, {compose_task, As Is}, {compose_thread, As Is}, {compose_node, As Is}, {compose_system, As Is}, {compose_workload, As Is}, {topcompose1, As Is}, {topcompose2, As Is} } } +window_filter_module evt_type 1 100 +window_filter_module evt_type_label 1 "CPU: Nanos6-Lite running thread mode" +window_synchronize 1 + diff --git a/cfg/thread-nanos6lite-mode.cfg b/cfg/thread-nanos6lite-mode.cfg new file mode 100644 index 0000000..f212fa2 --- /dev/null +++ b/cfg/thread-nanos6lite-mode.cfg @@ -0,0 +1,43 @@ +#ParaverCFG +ConfigFile.Version: 3.4 +ConfigFile.NumWindows: 1 + + +################################################################################ +< NEW DISPLAYING WINDOW Thread: Nanos6-Lite mode > +################################################################################ +window_name Thread: Nanos6-Lite mode +window_type single +window_id 1 +window_position_x 960 +window_position_y 287 +window_width 954 +window_height 236 +window_comm_lines_enabled true +window_flags_enabled true +window_noncolor_mode true +window_logical_filtered true +window_physical_filtered false +window_comm_fromto true +window_comm_tagsize true +window_comm_typeval true +window_units Microseconds +window_maximum_y 5.000000000000 +window_minimum_y 1.000000000000 +window_compute_y_max true +window_level thread +window_scale_relative 1.000000000000 +window_end_time_relative 1.000000000000 +window_object appl { 1, { All } } +window_begin_time_relative 0.000000000000 +window_open true +window_drawmode draw_maximum +window_drawmode_rows draw_maximum +window_pixel_size 1 +window_labels_to_draw 1 +window_selected_functions { 14, { {cpu, Active Thd}, {appl, Adding}, {task, Adding}, {thread, Last Evt Val}, {node, Adding}, {system, Adding}, {workload, Adding}, {from_obj, All}, {to_obj, All}, {tag_msg, All}, {size_msg, All}, {bw_msg, All}, {evt_type, =}, {evt_value, All} } } +window_compose_functions { 9, { {compose_cpu, As Is}, {compose_appl, As Is}, {compose_task, As Is}, {compose_thread, As Is}, {compose_node, As Is}, {compose_system, As Is}, {compose_workload, As Is}, {topcompose1, As Is}, {topcompose2, As Is} } } +window_filter_module evt_type 1 50 +window_filter_module evt_type_label 1 "Thread: Nanos6-Lite mode" +window_synchronize 1 + diff --git a/doc/emu_events.txt b/doc/emu_events.txt index 863c3f3..29997db 100644 --- a/doc/emu_events.txt +++ b/doc/emu_events.txt @@ -97,3 +97,30 @@ MT] Task ends MP] Parallel region begins MP[ Parallel region ends + +-------------------- Nanos6-Lite (model=L) ---------------------- + +LR[ Enters the registering of a task's accesses +LR] Exits the registering of a task's accesses + +LU[ Enters the unregistering of a task's accesses +LU] Exits the unregistering of a task's accesses + +LW[ Enters the blocking condition waiting for an If0 task +LW] Exits the blocking condition waiting for an If0 task + +LI[ Enters the inline execution of an If0 task +LI] Exits the inline execution of an If0 task + +LT[ Enters a taskwait +LT] Exits a taskwait + +LC[ Enters the creation of a task +LC] Exits the creation of a task + +LS[ Enters the submit of a task +LS] Exits the submit of a task + +LP[ Enters the spawning of a function +LP] Exits the spawning of a function + diff --git a/emu.c b/emu.c index 33bae68..76fe837 100644 --- a/emu.c +++ b/emu.c @@ -262,6 +262,7 @@ hook_init(struct ovni_emu *emu) hook_init_nosv(emu); hook_init_tampi(emu); hook_init_openmp(emu); + hook_init_nanos6lite(emu); } static void @@ -273,6 +274,7 @@ hook_pre(struct ovni_emu *emu) case 'V': hook_pre_nosv(emu); break; case 'T': hook_pre_tampi(emu); break; case 'M': hook_pre_openmp(emu); break; + case 'L': hook_pre_nanos6lite(emu); break; default: break; } diff --git a/emu.h b/emu.h index 97935ea..346408d 100644 --- a/emu.h +++ b/emu.h @@ -100,6 +100,17 @@ enum nosv_openmp_state { ST_OPENMP_PARALLEL = 2, }; +enum nosv_nanos6lite_state { + ST_NANOS6LITE_REGISTER = 1, + ST_NANOS6LITE_UNREGISTER = 2, + ST_NANOS6LITE_IF0_WAIT = 3, + ST_NANOS6LITE_IF0_INLINE = 4, + ST_NANOS6LITE_TASKWAIT = 5, + ST_NANOS6LITE_CREATE = 6, + ST_NANOS6LITE_SUBMIT = 7, + ST_NANOS6LITE_SPAWN = 8, +}; + struct ovni_ethread; struct ovni_eproc; @@ -148,6 +159,7 @@ enum chan { CHAN_TAMPI_MODE, CHAN_OPENMP_MODE, + CHAN_NANOS6LITE_MODE, CHAN_MAX }; @@ -177,6 +189,8 @@ static const int chan_to_prvtype[CHAN_MAX][3] = { { CHAN_TAMPI_MODE, 30, 80 }, { CHAN_OPENMP_MODE, 40, 90 }, + + { CHAN_NANOS6LITE_MODE, 50, 100 }, }; struct ovni_chan { @@ -466,6 +480,9 @@ void hook_pre_tampi(struct ovni_emu *emu); void hook_init_openmp(struct ovni_emu *emu); void hook_pre_openmp(struct ovni_emu *emu); +void hook_init_nanos6lite(struct ovni_emu *emu); +void hook_pre_nanos6lite(struct ovni_emu *emu); + struct ovni_cpu *emu_get_cpu(struct ovni_loom *loom, int cpuid); struct ovni_ethread *emu_get_thread(struct ovni_eproc *proc, int tid); diff --git a/emu_nanos6lite.c b/emu_nanos6lite.c new file mode 100644 index 0000000..d6c57b9 --- /dev/null +++ b/emu_nanos6lite.c @@ -0,0 +1,220 @@ +#include +#include "uthash.h" + +#include "ovni.h" +#include "ovni_trace.h" +#include "emu.h" +#include "prv.h" +#include "chan.h" + +/* --------------------------- init ------------------------------- */ + +void +hook_init_nanos6lite(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + struct ovni_cpu *cpu; + size_t i; + int row; + FILE *prv_th, *prv_cpu; + int64_t *clock; + struct ovni_chan **uth, **ucpu; + + clock = &emu->delta_time; + prv_th = emu->prv_thread; + prv_cpu = emu->prv_cpu; + + /* Init the channels in all threads */ + for(i=0; itotal_nthreads; i++) + { + th = emu->global_thread[i]; + row = th->gindex + 1; + uth = &emu->th_chan; + + chan_th_init(th, uth, CHAN_NANOS6LITE_MODE, CHAN_TRACK_TH_RUNNING, 0, 0, 1, row, prv_th, clock); + } + + /* Init the channels in all cpus */ + for(i=0; itotal_ncpus; i++) + { + cpu = emu->global_cpu[i]; + row = cpu->gindex + 1; + ucpu = &emu->cpu_chan; + + chan_cpu_init(cpu, ucpu, CHAN_NANOS6LITE_MODE, CHAN_TRACK_TH_RUNNING, 0, 0, 1, row, prv_cpu, clock); + } +} + +/* --------------------------- pre ------------------------------- */ + +static void +pre_register(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + th = emu->cur_thread; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_REGISTER); + break; + case ']': + chan_pop(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_REGISTER); + break; + default: + abort(); + } +} + +static void +pre_unregister(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + th = emu->cur_thread; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_UNREGISTER); + break; + case ']': + chan_pop(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_UNREGISTER); + break; + default: + abort(); + } +} + +static void +pre_wait(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + th = emu->cur_thread; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_IF0_WAIT); + break; + case ']': + chan_pop(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_IF0_WAIT); + break; + default: + abort(); + } +} + +static void +pre_inline(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + th = emu->cur_thread; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_IF0_INLINE); + break; + case ']': + chan_pop(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_IF0_INLINE); + break; + default: + abort(); + } +} + +static void +pre_taskwait(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + th = emu->cur_thread; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_TASKWAIT); + break; + case ']': + chan_pop(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_TASKWAIT); + break; + default: + abort(); + } +} + +static void +pre_create(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + th = emu->cur_thread; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_CREATE); + break; + case ']': + chan_pop(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_CREATE); + break; + default: + abort(); + } +} + +static void +pre_submit(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + th = emu->cur_thread; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_SUBMIT); + break; + case ']': + chan_pop(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_SUBMIT); + break; + default: + abort(); + } +} + +static void +pre_spawn(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + th = emu->cur_thread; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_SPAWN); + break; + case ']': + chan_pop(&th->chan[CHAN_NANOS6LITE_MODE], ST_NANOS6LITE_SPAWN); + break; + default: + abort(); + } +} + +void +hook_pre_nanos6lite(struct ovni_emu *emu) +{ + assert(emu->cur_ev->header.model == 'L'); + + switch(emu->cur_ev->header.category) + { + case 'R': pre_register(emu); break; + case 'U': pre_unregister(emu); break; + case 'W': pre_wait(emu); break; + case 'I': pre_inline(emu); break; + case 'T': pre_taskwait(emu); break; + case 'C': pre_create(emu); break; + case 'S': pre_submit(emu); break; + case 'P': pre_spawn(emu); break; + default: + break; + } +} diff --git a/pcf.c b/pcf.c index a4fe4d2..147bd1b 100644 --- a/pcf.c +++ b/pcf.c @@ -362,6 +362,34 @@ struct event_type thread_openmp_mode = { openmp_mode_values }; +/* ---------------- CHAN_NANOS6LITE_MODE ---------------- */ + +struct event_value nanos6lite_mode_values[] = { + { ST_NULL, "NULL" }, + { ST_TOO_MANY_TH, "Nanos6-Lite: Multiple threads running" }, + { ST_NANOS6LITE_REGISTER, "Dependencies: Register task accesses" }, + { ST_NANOS6LITE_UNREGISTER, "Dependencies: Unregister task accesses" }, + { ST_NANOS6LITE_IF0_WAIT, "If0: Wait for If0 task" }, + { ST_NANOS6LITE_IF0_INLINE, "If0: Execute If0 task inline" }, + { ST_NANOS6LITE_TASKWAIT, "Taskwait: Taskwait" }, + { ST_NANOS6LITE_CREATE, "Add Task: Create a task" }, + { ST_NANOS6LITE_SUBMIT, "Add Task: Submit a task" }, + { ST_NANOS6LITE_SPAWN, "Spawn Function: Spawn a function" }, + { -1, NULL }, +}; + +struct event_type cpu_nanos6lite_mode = { + 0, chan_to_prvtype[CHAN_NANOS6LITE_MODE][CHAN_CPU], + "CPU: Nanos6-Lite mode of the RUNNING thread", + nanos6lite_mode_values +}; + +struct event_type thread_nanos6lite_mode = { + 0, chan_to_prvtype[CHAN_NANOS6LITE_MODE][CHAN_TH], + "Thread: Nanos6-Lite mode of the RUNNING thread", + nanos6lite_mode_values +}; + /* ----------------------------------------------- */ static void @@ -450,6 +478,7 @@ write_events(FILE *f, struct ovni_emu *emu) write_event_type(f, &thread_nosv_ss); write_event_type(f, &thread_tampi_mode); write_event_type(f, &thread_openmp_mode); + write_event_type(f, &thread_nanos6lite_mode); /* CPU */ write_event_type(f, &cpu_ovni_pid); @@ -465,6 +494,7 @@ write_events(FILE *f, struct ovni_emu *emu) write_event_type(f, &cpu_nosv_ss); write_event_type(f, &cpu_tampi_mode); write_event_type(f, &cpu_openmp_mode); + write_event_type(f, &cpu_nanos6lite_mode); /* Custom */ write_cpu_type(f, &thread_cpu_affinity, emu);