1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
#pragma once
#include <sys/time.h>
aspect DfatoolHostDPUTiming {
struct timeval starttime;
struct timeval stoptime;
unsigned long input_size;
unsigned int element_size;
uint32_t n_ranks = 0;
uint32_t n_dpus = 0;
double const M_to_Mi = 1.048576; /* 2^20 / 1e6 */
advice call("% dpu_get_nr_dpus(...)") : after() {
n_dpus = **(tjp->arg<1>());
}
advice call("% dpu_get_nr_ranks(...)") : after() {
n_ranks = **(tjp->arg<1>());
}
advice call("% dpu_alloc(...)") : around() {
gettimeofday(&starttime, NULL);
tjp->proceed();
gettimeofday(&stoptime, NULL);
n_dpus = *(tjp->arg<0>());
printf("[::] dpu_alloc @ %s:%d | n_dpus=%u | latency_us=%f\n",
tjp->filename(),
tjp->line(),
n_dpus,
(stoptime.tv_sec - starttime.tv_sec) * 1000000.0 + (stoptime.tv_usec - starttime.tv_usec)
);
}
advice call("% dpu_alloc_ranks(...)") : around() {
gettimeofday(&starttime, NULL);
tjp->proceed();
gettimeofday(&stoptime, NULL);
n_ranks = *(tjp->arg<0>());
printf("[::] dpu_alloc_ranks @ %s:%d | n_ranks=%u | latency_us=%f\n",
tjp->filename(),
tjp->line(),
n_ranks,
(stoptime.tv_sec - starttime.tv_sec) * 1000000.0 + (stoptime.tv_usec - starttime.tv_usec)
);
}
advice call("% dpu_load(...)") : around() {
gettimeofday(&starttime, NULL);
tjp->proceed();
gettimeofday(&stoptime, NULL);
printf("[::] dpu_load @ %s:%d | n_dpus=%u n_ranks=%u | latency_us=%f\n",
tjp->filename(),
tjp->line(),
n_dpus, n_ranks,
(stoptime.tv_sec - starttime.tv_sec) * 1000000.0 + (stoptime.tv_usec - starttime.tv_usec)
);
}
advice call("% dpu_free(...)") : around() {
gettimeofday(&starttime, NULL);
tjp->proceed();
gettimeofday(&stoptime, NULL);
printf("[::] dpu_free @ %s:%d | n_dpus=%u n_ranks=%u | latency_us=%f\n",
tjp->filename(),
tjp->line(),
n_dpus, n_ranks,
(stoptime.tv_sec - starttime.tv_sec) * 1000000.0 + (stoptime.tv_usec - starttime.tv_usec)
);
}
advice call("% dpu_launch(...)") : around() {
gettimeofday(&starttime, NULL);
tjp->proceed();
gettimeofday(&stoptime, NULL);
double latency_us = (stoptime.tv_sec - starttime.tv_sec) * 1000000.0 + (stoptime.tv_usec - starttime.tv_usec);
printf("[::] dpu_launch @ %s:%d | n_dpus=%u n_ranks=%u e_kernel=kernel%d n_elements=%lu n_elements_per_dpu=%lu | latency_us=%f throughput_Mps=%f throughput_MiBps=%f\n",
tjp->filename(),
tjp->line(),
n_dpus, n_ranks,
kernel + 1,
input_size,
input_size / n_dpus,
latency_us,
input_size / latency_us,
input_size * element_size / (latency_us * M_to_Mi)
);
}
advice call("% dpu_copy_to(...)") : around() {
size_t payload_size = *(tjp->arg<4>());
gettimeofday(&starttime, NULL);
tjp->proceed();
gettimeofday(&stoptime, NULL);
double time_us = (stoptime.tv_sec - starttime.tv_sec) * 1000000.0 + (stoptime.tv_usec - starttime.tv_usec);
printf("[::] dpu_copy_to @ %s:%d | n_dpus=%u n_ranks=%u payload_B=%lu | latency_us=%f throughput_MiBps=%f\n",
tjp->filename(),
tjp->line(),
n_dpus, n_ranks,
payload_size,
time_us,
payload_size / (time_us * M_to_Mi)
);
}
advice call("% dpu_push_xfer(...)") : around() {
size_t payload_size = *(tjp->arg<4>());
gettimeofday(&starttime, NULL);
tjp->proceed();
gettimeofday(&stoptime, NULL);
double time_us = (stoptime.tv_sec - starttime.tv_sec) * 1000000.0 + (stoptime.tv_usec - starttime.tv_usec);
if (*(tjp->arg<1>()) == DPU_XFER_TO_DPU) {
printf("[::] dpu_push_to_dpu @ %s:%d | n_dpus=%u n_ranks=%u total_payload_B=%lu dpu_payload_B=%lu | latency_us=%f throughput_MiBps=%f\n",
tjp->filename(),
tjp->line(),
n_dpus, n_ranks,
payload_size * n_dpus, payload_size,
time_us,
payload_size * n_dpus / (time_us * M_to_Mi)
);
} else if (*(tjp->arg<1>()) == DPU_XFER_FROM_DPU) {
printf("[::] dpu_push_from_dpu @ %s:%d | n_dpus=%u n_ranks=%u total_payload_B=%lu dpu_payload_B=%lu | latency_us=%f throughput_MiBps=%f\n",
tjp->filename(),
tjp->line(),
n_dpus, n_ranks,
payload_size * n_dpus, payload_size,
time_us,
payload_size * n_dpus / (time_us * M_to_Mi)
);
}
}
};
|