You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Currently, this method (addValueToMetric) expects a taskName to be passed.
The addValueToMetric method is called for the TASK_COPY_IN_SIZE_BYES and TASK_COPY_OUT_SIZE_BYTES profile type, which is not correct. Objects passed as parameters to tasks belong to the whole task schedule context (i.e multiple tasks that belong to the same task schedule and use the same object parameter will result in a single COPY_IN/STREAM_IN).
Therefore, I think the TASK_COPY_IN/OUT_SIZE_BYTES should be profiled per task schedule, and not individual tasks.
How To Reproduce
To reproduce, run the test below with the -Dtornado.profiler=True flag
public static void add(int[] a, int[] b) {
for (@Parallel int i = 0; i < a.length; i++) {
b[i] = a[i] + a[i];
}
}
public static void mult(int[] a, int[] b) {
for (@Parallel int i = 0; i < b.length; i++) {
b[i] = b[i] + a[i] * 3;
}
}
public static void main(String[] args) {
int n = 32;
int[] a = new int[n];
int[] b = new int[n];
TaskSchedule ts = new TaskSchedule("s0")
.task("t0", Main::add, a, b)
.task("t1", Main::mult, a, b)
.streamOut(b);
ts.execute();
}
Thank you @gigiblender for the report. This is by design. We want each task to have its own profiler. This is especially beneficial in a multi-task , multi-device environment. But I also agree that for some cases (e.g., using the task.sync(objects) ) the profiler should add the metrics at the task-schedule level, rather than the task-level.
I suggest refactoring this part to add both options.
Add metrics for copies at the task-schedule level
When possible, keep the copy metrics for each individual task.
Describe the bug
Currently, this method (
addValueToMetric
) expects ataskName
to be passed.The
addValueToMetric
method is called for theTASK_COPY_IN_SIZE_BYES
andTASK_COPY_OUT_SIZE_BYTES
profile type, which is not correct. Objects passed as parameters to tasks belong to the whole task schedule context (i.e multiple tasks that belong to the same task schedule and use the same object parameter will result in a single COPY_IN/STREAM_IN).Therefore, I think the
TASK_COPY_IN/OUT_SIZE_BYTES
should be profiled per task schedule, and not individual tasks.How To Reproduce
To reproduce, run the test below with the
-Dtornado.profiler=True
flagThe output produced by the profiler is:
Even though objects
a
andb
are used by botht0
andt1
, theTASK_COPY_IN_SIZE_BYTES
andTASK_COPY_OUT_SIZE_BYTES
are only reported fort0
.Expected behavior
The expected output for the test above would be:
Additional context
Also, Javadoc for the datastructures of the profiler should be added.
The text was updated successfully, but these errors were encountered: