Commit e368010b authored by Philippe SWARTVAGHER's avatar Philippe SWARTVAGHER
Browse files

Add STARPU_FXT_EVENTS to select at runtime events to record

parent 686cc86b
Pipeline #280934 passed with stages
in 20 minutes and 16 seconds
......@@ -58,6 +58,8 @@ New features:
* Add support for Maxeler FPGA accelerators.
* Add 4D tensors filters.
* Add n-dimension data interface and filters.
* New STARPU_FXT_EVENTS environment variable to select at runtime which
event categories has to be recorded.
Small features:
* New configure option --with-check-cflags to define flags for C,
......
......@@ -309,6 +309,10 @@ script:
$ starpu_fxt_number_events_to_names.py number_events.data
\endverbatim
The number of recorded events (and thus the performance overhead introduced by
tracing) can be reduced by setting which categories of events to record with
the environment variable \ref STARPU_FXT_EVENTS.
\subsection LimitingScopeTrace Limiting The Scope Of The Trace
......
......@@ -1160,6 +1160,40 @@ Specify in which file to save the generated trace if FxT is enabled.
Specify whether to generate (1) or not (0) the FxT trace in /tmp/prof_file_XXX_YYY (the directory and file name can be changed with \ref STARPU_FXT_PREFIX and \ref STARPU_FXT_SUFFIX). The default is 0 (do not generate it)
</dd>
<dt>STARPU_FXT_EVENTS</dt>
<dd>
\anchor STARPU_FXT_EVENTS
\addindex __env__STARPU_FXT_EVENTS
Specify which events will be recorded in traces. By default, all events are
recorded. One can set this variable to a comma- or pipe-separated list of the
following categories, to record only events belonging to the selected
categories:
- <c>USER</c>
- <c>TASK</c>
- <c>TASK_VERBOSE</c>
- <c>DATA</c>
- <c>DATA_VERBOSE</c>
- <c>WORKER</c>
- <c>WORKER_VERBOSE</c>
- <c>DSM</c>
- <c>DSM_VERBOSE</c>
- <c>SCHED</c>
- <c>SCHED_VERBOSE</c>
- <c>LOCK</c>
- <c>LOCK_VERBOSE</c>
- <c>EVENT</c>
- <c>EVENT_VERBOSE</c>
- <c>MPI</c>
- <c>MPI_VERBOSE</c>
- <c>HYP</c>
- <c>HYP_VERBOSE</c>
</dd>
The choice of which categories have to be recorded is a tradeoff between
required informations for offline analyzis and acceptable overhead introduced
by tracing. For instance, to inspect with ViTE which tasks workers execute, one
has to at least select the <c>TASK</c> category.
<dt>STARPU_LIMIT_CUDA_devid_MEM</dt>
<dd>
\anchor STARPU_LIMIT_CUDA_devid_MEM
......
......@@ -112,6 +112,7 @@ void starpu_fxt_generate_trace(struct starpu_fxt_options *options);
Determine whether profiling should be started by starpu_init(), or only when
starpu_fxt_start_profiling() is called. \p autostart should be 1 to do so, or 0 to
prevent it.
This function has to be called before starpu_init().
*/
void starpu_fxt_autostart_profiling(int autostart);
......
......@@ -58,8 +58,17 @@ static int _starpu_id;
* size to warn the user if needed and avoid processing partial traces. */
static int _starpu_mpi_worldsize = 1;
/* Event mask used to initialize FxT. By default all events are recorded just
* after FxT starts, but this can be changed by calling
* starpu_fxt_autostart_profiling(0) */
static unsigned int initial_key_mask = FUT_KEYMASKALL;
/* Event mask used when events are actually recorded, e.g. between
* starpu_fxt_start|stop_profiling() calls if autostart is disabled, or at
* anytime otherwise. Can be changed by the user at runtime, by setting
* STARPU_FXT_EVENTS env var. */
static unsigned int profiling_key_mask = 0;
#ifdef STARPU_SIMGRID
/* Give virtual time to FxT */
uint64_t fut_getstamp(void)
......@@ -122,6 +131,73 @@ static void _starpu_profile_set_tracefile(void)
snprintf(_starpu_prof_file_user, sizeof(_starpu_prof_file_user), "%s/%s", fxt_prefix, suffix);
}
static inline unsigned int _starpu_profile_get_user_keymask(void)
{
if (profiling_key_mask != 0)
return profiling_key_mask;
char *fxt_events = starpu_getenv("STARPU_FXT_EVENTS");
if (fxt_events)
{
profiling_key_mask = _STARPU_FUT_KEYMASK_META; // contains mandatory events, even when profiling is disabled
char delim[] = "|,";
char* sub = strtok(fxt_events, delim);
for (; sub != NULL; sub = strtok(NULL, delim))
{
if (!strcasecmp(sub, "USER"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_USER;
else if (!strcasecmp(sub, "TASK"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_TASK;
else if (!strcasecmp(sub, "TASK_VERBOSE"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_TASK_VERBOSE;
else if (!strcasecmp(sub, "DATA"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_DATA;
else if (!strcasecmp(sub, "DATA_VERBOSE"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_DATA_VERBOSE;
else if (!strcasecmp(sub, "WORKER"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_WORKER;
else if (!strcasecmp(sub, "WORKER_VERBOSE"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_WORKER_VERBOSE;
else if (!strcasecmp(sub, "DSM"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_DSM;
else if (!strcasecmp(sub, "DSM_VERBOSE"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_DSM_VERBOSE;
else if (!strcasecmp(sub, "SCHED"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_SCHED;
else if (!strcasecmp(sub, "SCHED_VERBOSE"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_SCHED_VERBOSE;
else if (!strcasecmp(sub, "LOCK"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_LOCK;
else if (!strcasecmp(sub, "LOCK_VERBOSE"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_LOCK_VERBOSE;
else if (!strcasecmp(sub, "EVENT"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_EVENT;
else if (!strcasecmp(sub, "EVENT_VERBOSE"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_EVENT_VERBOSE;
else if (!strcasecmp(sub, "MPI"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_MPI;
else if (!strcasecmp(sub, "MPI_VERBOSE"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_MPI_VERBOSE;
else if (!strcasecmp(sub, "HYP"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_HYP;
else if (!strcasecmp(sub, "HYP_VERBOSE"))
profiling_key_mask |= _STARPU_FUT_KEYMASK_HYP_VERBOSE;
/* Added categories here should also be added in the documentation
* 501_environment_variable.doxy. */
else
_STARPU_MSG("Unknown event type '%s'\n", sub);
}
}
else
{
/* If user doesn't want to filter events, all events are recorded: */
profiling_key_mask = FUT_KEYMASKALL;
}
return profiling_key_mask;
}
void starpu_profiling_set_id(int new_id)
{
_STARPU_DEBUG("Set id to <%d>\n", new_id);
......@@ -158,7 +234,7 @@ void _starpu_profiling_set_mpi_worldsize(int worldsize)
void starpu_fxt_autostart_profiling(int autostart)
{
if (autostart)
initial_key_mask = FUT_KEYMASKALL;
initial_key_mask = _starpu_profile_get_user_keymask();
else
initial_key_mask = _STARPU_FUT_KEYMASK_META;
}
......@@ -166,7 +242,7 @@ void starpu_fxt_autostart_profiling(int autostart)
void starpu_fxt_start_profiling()
{
unsigned threadid = _starpu_gettid();
fut_keychange(FUT_ENABLE, FUT_KEYMASKALL, threadid);
fut_keychange(FUT_ENABLE, _starpu_profile_get_user_keymask(), threadid);
_STARPU_TRACE_META("start_profiling");
}
......
......@@ -262,6 +262,8 @@
#define _STARPU_FUT_KEYMASK_MPI_VERBOSE FUT_KEYMASK17
#define _STARPU_FUT_KEYMASK_HYP FUT_KEYMASK18
#define _STARPU_FUT_KEYMASK_HYP_VERBOSE FUT_KEYMASK19
/* When doing modifications to keymasks, also adapt
* _starpu_profile_get_user_keymask() in src/common/fxt.c ! */
extern unsigned long _starpu_job_cnt;
......
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