diff --git a/Makefile b/Makefile index a0dccd1..d9dfb62 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,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_nosv_ss.o ovni.o prv.o pcf.o parson.o chan.o +emu: emu.o emu_ovni.o emu_nosv.o emu_nosv_ss.o emu_tampi.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-tampi-mode.cfg b/cfg/cpu-tampi-mode.cfg new file mode 100644 index 0000000..1352336 --- /dev/null +++ b/cfg/cpu-tampi-mode.cfg @@ -0,0 +1,43 @@ +#ParaverCFG +ConfigFile.Version: 3.4 +ConfigFile.NumWindows: 1 + + +################################################################################ +< NEW DISPLAYING WINDOW Thread: TAMPI mode > +################################################################################ +window_name CPU: TAMPI 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 80 +window_filter_module evt_type_label 1 "Thread: TAMPI mode" +window_synchronize 1 + diff --git a/cfg/thread-tampi-mode.cfg b/cfg/thread-tampi-mode.cfg new file mode 100644 index 0000000..75942a6 --- /dev/null +++ b/cfg/thread-tampi-mode.cfg @@ -0,0 +1,43 @@ +#ParaverCFG +ConfigFile.Version: 3.4 +ConfigFile.NumWindows: 1 + + +################################################################################ +< NEW DISPLAYING WINDOW Thread: TAMPI mode > +################################################################################ +window_name Thread: TAMPI 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 30 +window_filter_module evt_type_label 1 "Thread: TAMPI mode" +window_synchronize 1 + diff --git a/emu.c b/emu.c index 90d1cf8..6f96429 100644 --- a/emu.c +++ b/emu.c @@ -163,6 +163,7 @@ hook_init(struct ovni_emu *emu) { hook_init_ovni(emu); hook_init_nosv(emu); + hook_init_tampi(emu); } static void @@ -176,6 +177,8 @@ hook_pre(struct ovni_emu *emu) break; case 'V': hook_pre_nosv(emu); break; + case 'T': hook_pre_tampi(emu); + break; default: break; } diff --git a/emu.h b/emu.h index 443b44e..8a2610a 100644 --- a/emu.h +++ b/emu.h @@ -48,6 +48,15 @@ enum nosv_thread_ss_state { ST_BAD = 666, }; +enum nosv_tampi_state { + ST_TAMPI_SEND = 1, + ST_TAMPI_RECV = 2, + ST_TAMPI_ISEND = 3, + ST_TAMPI_IRECV = 4, + ST_TAMPI_WAIT = 5, + ST_TAMPI_WAITALL = 6, +}; + enum nosv_thread_ss_event { EV_NULL = 0, EV_SCHED_RECV = 50, @@ -130,6 +139,9 @@ enum chan { CHAN_NOSV_TYPEID, CHAN_NOSV_APPID, CHAN_NOSV_SUBSYSTEM, + + CHAN_TAMPI_MODE, + CHAN_MAX }; @@ -147,6 +159,8 @@ const static int chan_to_prvtype[CHAN_MAX][3] = { { CHAN_NOSV_TYPEID, 21, 71 }, { CHAN_NOSV_APPID, 22, 72 }, { CHAN_NOSV_SUBSYSTEM, 23, 73 }, + + { CHAN_TAMPI_MODE, 30, 80 }, }; ///* All PRV event types */ @@ -388,6 +402,9 @@ void hook_pre_nosv_ss(struct ovni_emu *emu); void hook_emit_nosv_ss(struct ovni_emu *emu); void hook_post_nosv_ss(struct ovni_emu *emu); +void hook_init_tampi(struct ovni_emu *emu); +void hook_pre_tampi(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_tampi.c b/emu_tampi.c new file mode 100644 index 0000000..5f563da --- /dev/null +++ b/emu_tampi.c @@ -0,0 +1,188 @@ +#include +#include "uthash.h" + +#include "ovni.h" +#include "ovni_trace.h" +#include "emu.h" +#include "prv.h" +#include "chan.h" + +/* --------------------------- init ------------------------------- */ + +void +hook_init_tampi(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + struct ovni_cpu *cpu; + struct ovni_trace *trace; + int i, row, type; + FILE *prv_th, *prv_cpu; + int64_t *clock; + + clock = &emu->delta_time; + prv_th = emu->prv_thread; + prv_cpu = emu->prv_cpu; + trace = &emu->trace; + + /* Init the channels in all threads */ + for(i=0; itotal_nthreads; i++) + { + th = emu->global_thread[i]; + row = th->gindex + 1; + + chan_th_init(th, CHAN_TAMPI_MODE, CHAN_TRACK_TH_RUNNING, row, prv_th, clock); + chan_enable(&th->chan[CHAN_TAMPI_MODE], 1); + chan_set(&th->chan[CHAN_TAMPI_MODE], ST_NULL); + chan_enable(&th->chan[CHAN_TAMPI_MODE], 0); + } + + /* Init the channels in all cpus */ + for(i=0; itotal_ncpus; i++) + { + cpu = emu->global_cpu[i]; + row = cpu->gindex + 1; + + chan_cpu_init(cpu, CHAN_TAMPI_MODE, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); + } +} + +/* --------------------------- pre ------------------------------- */ + + +static void +pre_send(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + + th = emu->cur_thread; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(&th->chan[CHAN_TAMPI_MODE], ST_TAMPI_SEND); + break; + case ']': + chan_pop(&th->chan[CHAN_TAMPI_MODE], ST_TAMPI_SEND); + break; + default: + abort(); + } +} + +static void +pre_recv(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + + th = emu->cur_thread; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(&th->chan[CHAN_TAMPI_MODE], ST_TAMPI_RECV); + break; + case ']': + chan_pop(&th->chan[CHAN_TAMPI_MODE], ST_TAMPI_RECV); + break; + default: + abort(); + } +} + +static void +pre_isend(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + + th = emu->cur_thread; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(&th->chan[CHAN_TAMPI_MODE], ST_TAMPI_ISEND); + break; + case ']': + chan_pop(&th->chan[CHAN_TAMPI_MODE], ST_TAMPI_ISEND); + break; + default: + abort(); + } +} + +static void +pre_irecv(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + + th = emu->cur_thread; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(&th->chan[CHAN_TAMPI_MODE], ST_TAMPI_IRECV); + break; + case ']': + chan_pop(&th->chan[CHAN_TAMPI_MODE], ST_TAMPI_IRECV); + 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_TAMPI_MODE], ST_TAMPI_WAIT); + break; + case ']': + chan_pop(&th->chan[CHAN_TAMPI_MODE], ST_TAMPI_WAIT); + break; + default: + abort(); + } +} + +static void +pre_waitall(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + + th = emu->cur_thread; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(&th->chan[CHAN_TAMPI_MODE], ST_TAMPI_WAITALL); + break; + case ']': + chan_pop(&th->chan[CHAN_TAMPI_MODE], ST_TAMPI_WAITALL); + break; + default: + abort(); + } +} + +void +hook_pre_tampi(struct ovni_emu *emu) +{ + assert(emu->cur_ev->header.model == 'T'); + + switch(emu->cur_ev->header.category) + { + case 'S': pre_send(emu); break; + case 'R': pre_recv(emu); break; + case 's': pre_isend(emu); break; + case 'r': pre_irecv(emu); break; + case 'V': pre_wait(emu); break; + case 'W': pre_waitall(emu); break; + default: + break; + } +} diff --git a/pcf.c b/pcf.c index 65d6348..7cd487c 100644 --- a/pcf.c +++ b/pcf.c @@ -146,6 +146,27 @@ struct event_type cpu_ss = { ss_values }; +struct event_value tampi_mode_values[] = { + { ST_NULL, "NULL" }, + { ST_TAMPI_SEND, "TAMPI: Send" }, + { ST_TAMPI_RECV, "TAMPI: Recv" }, + { ST_TAMPI_ISEND, "TAMPI: Isend" }, + { ST_TAMPI_IRECV, "TAMPI: Irecv" }, + { ST_TAMPI_WAIT, "TAMPI: Wait" }, + { ST_TAMPI_WAITALL, "TAMPI: Waitall" }, + { -1, NULL }, +}; + +struct event_type cpu_tampi_mode = { + 0, 80, "CPU: TAMPI running thread mode", + tampi_mode_values +}; + +struct event_type thread_tampi_mode = { + 0, 30, "Thread: TAMPI mode", + tampi_mode_values +}; + struct event_type thread_cpu_affinity = { 0, chan_to_prvtype[CHAN_OVNI_CPU][1], "Thread: current CPU affinity", /* Ignored */ NULL @@ -230,6 +251,8 @@ write_events(FILE *f, struct ovni_emu *emu) write_event_type(f, &thread_tid); write_event_type(f, &thread_ss); write_event_type(f, &cpu_ss); + write_event_type(f, &cpu_tampi_mode); + write_event_type(f, &thread_tampi_mode); write_cpu_type(f, &thread_cpu_affinity, emu); }