summaryrefslogtreecommitdiff
path: root/HST-S/host/app.c
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2023-06-02 15:27:22 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2023-06-02 15:27:22 +0200
commit7e0597a2ddb2d07ff7b72a6fa47245774e04f964 (patch)
tree51dbd792f11428c5f61283fb5de3fc7d4f9606f7 /HST-S/host/app.c
parentf438d54780af4ae90638f5d57acdd5e98d6596e9 (diff)
port HST-S to dfatool
Diffstat (limited to 'HST-S/host/app.c')
-rw-r--r--HST-S/host/app.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/HST-S/host/app.c b/HST-S/host/app.c
index e50fd62..5dafa3a 100644
--- a/HST-S/host/app.c
+++ b/HST-S/host/app.c
@@ -23,6 +23,9 @@
#define DPU_BINARY "./bin/dpu_code"
#endif
+#define XSTR(x) STR(x)
+#define STR(x) #x
+
#if ENERGY
#include <dpu_probe.h>
#endif
@@ -40,7 +43,7 @@ static void read_input(T* A, const Params p) {
// Open input file
unsigned short temp;
- sprintf(dctFileName, p.file_name);
+ sprintf(dctFileName, "%s", p.file_name);
if((File = fopen(dctFileName, "rb")) != NULL) {
for(unsigned int y = 0; y < p.input_size; y++) {
fread(&temp, sizeof(unsigned short), 1, File);
@@ -138,14 +141,14 @@ int main(int argc, char **argv) {
// Compute output on CPU (performance comparison and verification purposes)
if(rep >= p.n_warmup)
- start(&timer, 0, rep - p.n_warmup);
+ start(&timer, 0, 0);
histogram_host(histo_host, A, p.bins, p.input_size, 1, nr_of_dpus);
if(rep >= p.n_warmup)
stop(&timer, 0);
printf("Load input data\n");
if(rep >= p.n_warmup)
- start(&timer, 1, rep - p.n_warmup);
+ start(&timer, 1, 0);
// Input arguments
unsigned int kernel = 0;
i = 0;
@@ -177,7 +180,7 @@ int main(int argc, char **argv) {
printf("Run program on DPU(s) \n");
// Run DPU kernel
if(rep >= p.n_warmup) {
- start(&timer, 2, rep - p.n_warmup);
+ start(&timer, 2, 0);
#if ENERGY
DPU_ASSERT(dpu_probe_start(&probe));
#endif
@@ -206,7 +209,7 @@ int main(int argc, char **argv) {
printf("Retrieve results\n");
i = 0;
if(rep >= p.n_warmup)
- start(&timer, 3, rep - p.n_warmup);
+ start(&timer, 3, 0);
// PARALLEL RETRIEVE TRANSFER
DPU_FOREACH(dpu_set, dpu, i) {
DPU_ASSERT(dpu_prepare_xfer(dpu, histo + p.bins * i));
@@ -222,6 +225,20 @@ int main(int argc, char **argv) {
if(rep >= p.n_warmup)
stop(&timer, 3);
+ if (rep >= p.n_warmup) {
+ printf("[::] HST-S NMC | n_dpus=%d n_tasklets=%d e_type=%s n_elements=%d n_bins=%d "
+ "| throughput_cpu_MBps=%f throughput_pim_MBps=%f throughput_MBps=%f",
+ nr_of_dpus, NR_TASKLETS, XSTR(T), input_size, p.bins,
+ input_size * sizeof(T) / timer.time[0],
+ input_size * sizeof(T) / timer.time[2],
+ input_size * sizeof(T) / (timer.time[1] + timer.time[2] + timer.time[3]));
+ printf(" throughput_cpu_MOpps=%f throughput_pim_MOpps=%f throughput_MOpps=%f",
+ input_size / timer.time[0],
+ input_size / timer.time[2],
+ input_size / (timer.time[1] + timer.time[2] + timer.time[3]));
+ printall(&timer, 3);
+ }
+
}
// Print timing results