Add experimental OpenMP support
This commit is contained in:
parent
bb035e5f80
commit
8ff3359c34
2
Makefile
2
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 emu_tampi.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 emu_openmp.o ovni.o prv.o pcf.o parson.o chan.o
|
||||
|
||||
libovni.so: ovni.o parson.o
|
||||
$(LINK.c) -shared $^ -o $@
|
||||
|
43
cfg/cpu-openmp-mode.cfg
Normal file
43
cfg/cpu-openmp-mode.cfg
Normal file
@ -0,0 +1,43 @@
|
||||
#ParaverCFG
|
||||
ConfigFile.Version: 3.4
|
||||
ConfigFile.NumWindows: 1
|
||||
|
||||
|
||||
################################################################################
|
||||
< NEW DISPLAYING WINDOW Thread: OpenMP mode >
|
||||
################################################################################
|
||||
window_name CPU: OpenMP 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 90
|
||||
window_filter_module evt_type_label 1 "CPU: OpenMP running thread mode"
|
||||
window_synchronize 1
|
||||
|
43
cfg/thread-openmp-mode.cfg
Normal file
43
cfg/thread-openmp-mode.cfg
Normal file
@ -0,0 +1,43 @@
|
||||
#ParaverCFG
|
||||
ConfigFile.Version: 3.4
|
||||
ConfigFile.NumWindows: 1
|
||||
|
||||
|
||||
################################################################################
|
||||
< NEW DISPLAYING WINDOW Thread: OpenMP mode >
|
||||
################################################################################
|
||||
window_name Thread: OpenMP 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 40
|
||||
window_filter_module evt_type_label 1 "Thread: OpenMP mode"
|
||||
window_synchronize 1
|
||||
|
3
emu.c
3
emu.c
@ -164,6 +164,7 @@ hook_init(struct ovni_emu *emu)
|
||||
hook_init_ovni(emu);
|
||||
hook_init_nosv(emu);
|
||||
hook_init_tampi(emu);
|
||||
hook_init_openmp(emu);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -179,6 +180,8 @@ hook_pre(struct ovni_emu *emu)
|
||||
break;
|
||||
case 'T': hook_pre_tampi(emu);
|
||||
break;
|
||||
case 'M': hook_pre_openmp(emu);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
11
emu.h
11
emu.h
@ -57,6 +57,11 @@ enum nosv_tampi_state {
|
||||
ST_TAMPI_WAITALL = 6,
|
||||
};
|
||||
|
||||
enum nosv_openmp_state {
|
||||
ST_OPENMP_TASK = 1,
|
||||
ST_OPENMP_PARALLEL = 2,
|
||||
};
|
||||
|
||||
enum nosv_thread_ss_event {
|
||||
EV_NULL = 0,
|
||||
EV_SCHED_RECV = 50,
|
||||
@ -141,6 +146,7 @@ enum chan {
|
||||
CHAN_NOSV_SUBSYSTEM,
|
||||
|
||||
CHAN_TAMPI_MODE,
|
||||
CHAN_OPENMP_MODE,
|
||||
|
||||
CHAN_MAX
|
||||
};
|
||||
@ -161,6 +167,8 @@ const static int chan_to_prvtype[CHAN_MAX][3] = {
|
||||
{ CHAN_NOSV_SUBSYSTEM, 23, 73 },
|
||||
|
||||
{ CHAN_TAMPI_MODE, 30, 80 },
|
||||
|
||||
{ CHAN_OPENMP_MODE, 40, 90 },
|
||||
};
|
||||
|
||||
///* All PRV event types */
|
||||
@ -405,6 +413,9 @@ 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);
|
||||
|
||||
void hook_init_openmp(struct ovni_emu *emu);
|
||||
void hook_pre_openmp(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);
|
||||
|
104
emu_openmp.c
Normal file
104
emu_openmp.c
Normal file
@ -0,0 +1,104 @@
|
||||
#include <assert.h>
|
||||
#include "uthash.h"
|
||||
|
||||
#include "ovni.h"
|
||||
#include "ovni_trace.h"
|
||||
#include "emu.h"
|
||||
#include "prv.h"
|
||||
#include "chan.h"
|
||||
|
||||
/* --------------------------- init ------------------------------- */
|
||||
|
||||
void
|
||||
hook_init_openmp(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; i<emu->total_nthreads; i++)
|
||||
{
|
||||
th = emu->global_thread[i];
|
||||
row = th->gindex + 1;
|
||||
|
||||
chan_th_init(th, CHAN_OPENMP_MODE, CHAN_TRACK_TH_RUNNING, row, prv_th, clock);
|
||||
chan_enable(&th->chan[CHAN_OPENMP_MODE], 1);
|
||||
chan_set(&th->chan[CHAN_OPENMP_MODE], ST_NULL);
|
||||
chan_enable(&th->chan[CHAN_OPENMP_MODE], 0);
|
||||
}
|
||||
|
||||
/* Init the channels in all cpus */
|
||||
for(i=0; i<emu->total_ncpus; i++)
|
||||
{
|
||||
cpu = emu->global_cpu[i];
|
||||
row = cpu->gindex + 1;
|
||||
|
||||
chan_cpu_init(cpu, CHAN_OPENMP_MODE, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------- pre ------------------------------- */
|
||||
|
||||
|
||||
static void
|
||||
pre_task(struct ovni_emu *emu)
|
||||
{
|
||||
struct ovni_ethread *th;
|
||||
|
||||
th = emu->cur_thread;
|
||||
|
||||
switch(emu->cur_ev->header.value)
|
||||
{
|
||||
case '[':
|
||||
chan_push(&th->chan[CHAN_OPENMP_MODE], ST_OPENMP_TASK);
|
||||
break;
|
||||
case ']':
|
||||
chan_pop(&th->chan[CHAN_OPENMP_MODE], ST_OPENMP_TASK);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pre_barrier(struct ovni_emu *emu)
|
||||
{
|
||||
struct ovni_ethread *th;
|
||||
|
||||
th = emu->cur_thread;
|
||||
|
||||
switch(emu->cur_ev->header.value)
|
||||
{
|
||||
case '[':
|
||||
chan_push(&th->chan[CHAN_OPENMP_MODE], ST_OPENMP_PARALLEL);
|
||||
break;
|
||||
case ']':
|
||||
chan_pop(&th->chan[CHAN_OPENMP_MODE], ST_OPENMP_PARALLEL);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
hook_pre_openmp(struct ovni_emu *emu)
|
||||
{
|
||||
assert(emu->cur_ev->header.model == 'M');
|
||||
|
||||
switch(emu->cur_ev->header.category)
|
||||
{
|
||||
case 'T': pre_task(emu); break;
|
||||
case 'P': pre_barrier(emu); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
19
pcf.c
19
pcf.c
@ -167,6 +167,23 @@ struct event_type thread_tampi_mode = {
|
||||
tampi_mode_values
|
||||
};
|
||||
|
||||
struct event_value openmp_mode_values[] = {
|
||||
{ ST_NULL, "NULL" },
|
||||
{ ST_OPENMP_TASK, "OpenMP: Task" },
|
||||
{ ST_OPENMP_PARALLEL, "OpenMP: Parallel" },
|
||||
{ -1, NULL },
|
||||
};
|
||||
|
||||
struct event_type cpu_openmp_mode = {
|
||||
0, 90, "CPU: OpenMP running thread mode",
|
||||
openmp_mode_values
|
||||
};
|
||||
|
||||
struct event_type thread_openmp_mode = {
|
||||
0, 40, "Thread: OpenMP mode",
|
||||
openmp_mode_values
|
||||
};
|
||||
|
||||
struct event_type thread_cpu_affinity = {
|
||||
0, chan_to_prvtype[CHAN_OVNI_CPU][1], "Thread: current CPU affinity",
|
||||
/* Ignored */ NULL
|
||||
@ -253,6 +270,8 @@ write_events(FILE *f, struct ovni_emu *emu)
|
||||
write_event_type(f, &cpu_ss);
|
||||
write_event_type(f, &cpu_tampi_mode);
|
||||
write_event_type(f, &thread_tampi_mode);
|
||||
write_event_type(f, &cpu_openmp_mode);
|
||||
write_event_type(f, &thread_openmp_mode);
|
||||
|
||||
write_cpu_type(f, &thread_cpu_affinity, emu);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user