summaryrefslogtreecommitdiff
path: root/GEMV
diff options
context:
space:
mode:
Diffstat (limited to 'GEMV')
-rw-r--r--GEMV/Makefile29
-rwxr-xr-xGEMV/benchmark-scripts/ccmcc25-sim.sh26
-rwxr-xr-xGEMV/benchmark-scripts/ccmcc25.sh31
-rw-r--r--GEMV/dpu/task.c2
-rw-r--r--GEMV/host/app.c54
-rw-r--r--[-rwxr-xr-x]GEMV/include/common.h (renamed from GEMV/support/common.h)0
-rw-r--r--GEMV/include/dfatool_host.ah30
-rw-r--r--GEMV/include/params.h (renamed from GEMV/support/params.h)0
-rw-r--r--GEMV/include/timer.h5
-rwxr-xr-xGEMV/run-fgbs24a.sh27
-rwxr-xr-xGEMV/run-paper-strong-full.sh20
-rwxr-xr-xGEMV/run-paper-strong-rank.sh20
-rwxr-xr-xGEMV/run-paper-weak.sh21
-rwxr-xr-xGEMV/run.sh32
-rwxr-xr-xGEMV/support/timer.h74
15 files changed, 152 insertions, 219 deletions
diff --git a/GEMV/Makefile b/GEMV/Makefile
index 5f766ae..644278e 100644
--- a/GEMV/Makefile
+++ b/GEMV/Makefile
@@ -5,16 +5,31 @@ WITH_ALLOC_OVERHEAD ?= 0
WITH_LOAD_OVERHEAD ?= 0
WITH_FREE_OVERHEAD ?= 0
-COMMON_INCLUDES := support
HOST_SOURCES := $(wildcard host/*.c)
DPU_SOURCES := $(wildcard dpu/*.c)
-.PHONY: all clean test
+aspectc ?= 0
+aspectc_timing ?= 0
+dfatool_timing ?= 1
+
+HOST_CC := ${CC}
-COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES}
-HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -DWITH_ALLOC_OVERHEAD=${WITH_ALLOC_OVERHEAD} -DWITH_LOAD_OVERHEAD=${WITH_LOAD_OVERHEAD} -DWITH_FREE_OVERHEAD=${WITH_FREE_OVERHEAD}
+COMMON_FLAGS := -Wall -Wextra -g -Iinclude
+HOST_FLAGS := ${COMMON_FLAGS} -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -DWITH_ALLOC_OVERHEAD=${WITH_ALLOC_OVERHEAD} -DWITH_LOAD_OVERHEAD=${WITH_LOAD_OVERHEAD} -DWITH_FREE_OVERHEAD=${WITH_FREE_OVERHEAD} -DASPECTC=${aspectc} -DDFATOOL_TIMING=${dfatool_timing}
DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL}
+ifeq (${aspectc_timing}, 1)
+ ASPECTC_HOST_FLAGS += -ainclude/dfatool_host_dpu.ah -ainclude/dfatool_host.ah
+endif
+
+ASPECTC_HOST_FLAGS ?= -a0
+
+ifeq (${aspectc}, 1)
+ HOST_CC = ag++ -r repo.acp -v 0 ${ASPECTC_HOST_FLAGS} --c_compiler ${UPMEM_HOME}/bin/clang++ -p . --Xcompiler
+else
+ HOST_FLAGS += -std=c11
+endif
+
QUIET = @
ifdef verbose
@@ -27,7 +42,9 @@ bin:
${QUIET}mkdir -p bin
bin/gemv_host: ${HOST_SOURCES} ${COMMON_INCLUDES} bin
- ${QUIET}${CC} -o $@ ${HOST_SOURCES} ${HOST_FLAGS}
+ ${QUIET}cp ../include/dfatool_host_dpu.ah include
+ ${QUIET}${HOST_CC} -o $@ ${HOST_SOURCES} ${HOST_FLAGS}
+ ${QUIET}rm -f include/dfatool_host_dpu.ah
bin/gemv_dpu: ${DPU_SOURCES} ${COMMON_INCLUDES} bin
${QUIET}dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES}
@@ -37,3 +54,5 @@ clean:
test: all
bin/gemv_host -m 1024 -n 1024
+
+.PHONY: all clean test
diff --git a/GEMV/benchmark-scripts/ccmcc25-sim.sh b/GEMV/benchmark-scripts/ccmcc25-sim.sh
new file mode 100755
index 0000000..3f88fcf
--- /dev/null
+++ b/GEMV/benchmark-scripts/ccmcc25-sim.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+mkdir -p log/$(hostname)
+
+run_benchmark_nmc() {
+ local "$@"
+ set -e
+ make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets} \
+ aspectc=1 aspectc_timing=1 dfatool_timing=0
+ bin/gemv_host -w 0 -e 5 -n ${nr_cols} -m ${nr_rows} 2>&1
+}
+
+export -f run_benchmark_nmc
+
+fn=log/$(hostname)/ccmcc25-sdk${sdk}-sim
+
+source ~/lib/local/upmem/upmem-2025.1.0-Linux-x86_64/upmem_env.sh simulator
+
+echo "prim-benchmarks GEMV $(git describe --all --long) $(git rev-parse HEAD) $(date -R)" >> ${fn}.txt
+
+parallel -j1 --eta --joblog ${fn}.joblog --resume --header : \
+ run_benchmark_nmc nr_dpus={nr_dpus} nr_tasklets=16 nr_cols={nr_cols} nr_rows={nr_rows} \
+ ::: nr_dpus 1 2 4 8 16 32 48 64 \
+ ::: nr_cols 256 512 768 1024 1536 \
+ ::: nr_rows 512 68 1024 1536 2048 \
+>> ${fn}.txt
diff --git a/GEMV/benchmark-scripts/ccmcc25.sh b/GEMV/benchmark-scripts/ccmcc25.sh
new file mode 100755
index 0000000..591a200
--- /dev/null
+++ b/GEMV/benchmark-scripts/ccmcc25.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+mkdir -p log/$(hostname)
+
+run_benchmark_nmc() {
+ local "$@"
+ set -e
+ sudo limit_ranks_to_numa_node ${numa_rank}
+ make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets} \
+ aspectc=1 aspectc_timing=1 dfatool_timing=0
+ bin/gemv_host -w 0 -e 50 -n ${nr_cols} -m ${nr_rows} 2>&1
+}
+
+export -f run_benchmark_nmc
+
+for sdk in 2023.2.0 2024.1.0 2024.2.0 2025.1.0; do
+
+ fn=log/$(hostname)/ccmcc25-sdk${sdk}
+
+ source /opt/upmem/upmem-${sdk}-Linux-x86_64/upmem_env.sh
+
+ echo "prim-benchmarks GEMV $(git describe --all --long) $(git rev-parse HEAD) $(date -R)" >> ${fn}.txt
+
+ parallel -j1 --eta --joblog ${fn}.joblog --resume --header : \
+ run_benchmark_nmc nr_dpus={nr_dpus} nr_tasklets=16 numa_rank=any nr_cols={nr_cols} nr_rows={nr_rows} \
+ ::: nr_dpus 64 128 256 512 768 1024 1536 2048 2304 \
+ ::: nr_cols 2048 4096 8192 \
+ ::: nr_rows 40960 81920 163840 \
+ >> ${fn}.txt
+
+done
diff --git a/GEMV/dpu/task.c b/GEMV/dpu/task.c
index 3bf52e8..120f134 100644
--- a/GEMV/dpu/task.c
+++ b/GEMV/dpu/task.c
@@ -10,7 +10,7 @@
#include <barrier.h>
#include <seqread.h>
-#include "../support/common.h"
+#include "common.h"
#define roundup(n, m) ((n / m) * m + m)
diff --git a/GEMV/host/app.c b/GEMV/host/app.c
index 6553774..9838eb4 100644
--- a/GEMV/host/app.c
+++ b/GEMV/host/app.c
@@ -8,25 +8,33 @@
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
-#include <dpu.h>
-#include <dpu_log.h>
#include <unistd.h>
#include <getopt.h>
#include <assert.h>
-#if ENERGY
-#include <dpu_probe.h>
+#if ASPECTC
+extern "C" {
#endif
+#include <dpu.h>
+#include <dpu_log.h>
#include <dpu_management.h>
#include <dpu_target_macros.h>
+#if ENERGY
+#include <dpu_probe.h>
+#endif
+
+#if ASPECTC
+}
+#endif
+
#define XSTR(x) STR(x)
#define STR(x) #x
-#include "../support/common.h"
-#include "../support/timer.h"
-#include "../support/params.h"
+#include "common.h"
+#include "timer.h"
+#include "params.h"
// Define the DPU Binary path as DPU_BINARY here
#ifndef DPU_BINARY
@@ -38,6 +46,8 @@ static T *B;
static T *C;
static T *C_dpu;
+unsigned int kernel = 0;
+
// Create input arrays
static void init_data(T *A, T *B, unsigned int m_size, unsigned int n_size)
{
@@ -85,18 +95,24 @@ int main(int argc, char **argv)
// Allocate DPUs and load binary
#if !WITH_ALLOC_OVERHEAD
DPU_ASSERT(dpu_alloc(NR_DPUS, NULL, &dpu_set));
+#if DFATOOL_TIMING
timer.time[0] = 0; // alloc
#endif
+#endif
#if !WITH_LOAD_OVERHEAD
DPU_ASSERT(dpu_load(dpu_set, DPU_BINARY, NULL));
DPU_ASSERT(dpu_get_nr_dpus(dpu_set, &nr_of_dpus));
DPU_ASSERT(dpu_get_nr_ranks(dpu_set, &nr_of_ranks));
assert(nr_of_dpus == NR_DPUS);
+#if DFATOOL_TIMING
timer.time[1] = 0; // load
#endif
+#endif
#if !WITH_FREE_OVERHEAD
+#if DFATOOL_TIMING
timer.time[8] = 0; // free
#endif
+#endif
#if ENERGY
struct dpu_probe_t probe;
@@ -155,10 +171,10 @@ int main(int argc, char **argv)
input_args[i].nr_rows = rows_per_dpu;
}
- A = malloc(max_rows_per_dpu * NR_DPUS * n_size_pad * sizeof(T));
- B = malloc(n_size_pad * sizeof(T));
- C = malloc(max_rows_per_dpu * NR_DPUS * sizeof(T));
- C_dpu = malloc(max_rows_per_dpu * NR_DPUS * sizeof(T));
+ A = (T*)malloc(max_rows_per_dpu * NR_DPUS * n_size_pad * sizeof(T));
+ B = (T*)malloc(n_size_pad * sizeof(T));
+ C = (T*)malloc(max_rows_per_dpu * NR_DPUS * sizeof(T));
+ C_dpu = (T*)malloc(max_rows_per_dpu * NR_DPUS * sizeof(T));
// Initialize data with arbitrary data
init_data(A, B, m_size, n_size);
@@ -347,26 +363,26 @@ int main(int argc, char **argv)
printf("[" ANSI_COLOR_GREEN "OK" ANSI_COLOR_RESET
"] Outputs are equal\n");
if (rep >= p.n_warmup) {
- printf
+ dfatool_printf
("[::] GEMV-UPMEM | n_dpus=%d n_ranks=%d n_tasklets=%d e_type=%s block_size_B=%d n_elements=%d",
NR_DPUS, nr_of_ranks, NR_TASKLETS, XSTR(T),
BLOCK_SIZE, n_size * m_size);
- printf
+ dfatool_printf
(" b_with_alloc_overhead=%d b_with_load_overhead=%d b_with_free_overhead=%d numa_node_rank=%d ",
WITH_ALLOC_OVERHEAD, WITH_LOAD_OVERHEAD,
WITH_FREE_OVERHEAD, numa_node_rank);
- printf
+ dfatool_printf
("| latency_alloc_us=%f latency_load_us=%f latency_cpu_us=%f latency_write_us=%f latency_kernel_us=%f latency_read_us=%f latency_free_us=%f",
timer.time[0], timer.time[1],
timer.time[2],
timer.time[3] + timer.time[6] +
timer.time[7], timer.time[4],
timer.time[5], timer.time[8]);
- printf
+ dfatool_printf
(" latency_write1_us=%f latency_write2_us=%f latency_write3_us=%f",
timer.time[3], timer.time[6], timer.time[7]
);
- printf
+ dfatool_printf
(" throughput_cpu_MBps=%f throughput_upmem_kernel_MBps=%f throughput_upmem_total_MBps=%f",
n_size * m_size * sizeof(T) /
timer.time[2],
@@ -377,7 +393,7 @@ int main(int argc, char **argv)
timer.time[3] + timer.time[6] +
timer.time[7] + timer.time[4] +
timer.time[5] + timer.time[8]));
- printf
+ dfatool_printf
(" throughput_upmem_wxr_MBps=%f throughput_upmem_lwxr_MBps=%f throughput_upmem_alwxr_MBps=%f",
n_size * m_size * sizeof(T) /
(timer.time[3] + timer.time[6] +
@@ -392,7 +408,7 @@ int main(int argc, char **argv)
timer.time[3] + timer.time[6] +
timer.time[7] + timer.time[4] +
timer.time[5]));
- printf
+ dfatool_printf
(" throughput_cpu_MOpps=%f throughput_upmem_kernel_MOpps=%f throughput_upmem_total_MOpps=%f",
n_size * m_size / timer.time[2],
n_size * m_size / (timer.time[4]),
@@ -404,7 +420,7 @@ int main(int argc, char **argv)
timer.time[4] +
timer.time[5] +
timer.time[8]));
- printf
+ dfatool_printf
(" throughput_upmem_wxr_MOpps=%f throughput_upmem_lwxr_MOpps=%f throughput_upmem_alwxr_MOpps=%f\n",
n_size * m_size / (timer.time[3] +
timer.time[6] +
diff --git a/GEMV/support/common.h b/GEMV/include/common.h
index 47a9628..47a9628 100755..100644
--- a/GEMV/support/common.h
+++ b/GEMV/include/common.h
diff --git a/GEMV/include/dfatool_host.ah b/GEMV/include/dfatool_host.ah
new file mode 100644
index 0000000..84c1dd3
--- /dev/null
+++ b/GEMV/include/dfatool_host.ah
@@ -0,0 +1,30 @@
+#pragma once
+
+#include <sys/time.h>
+#include "dfatool_host_dpu.ah"
+
+aspect DfatoolHostTiming : public DfatoolHostDPUTiming {
+ unsigned int n_cols, n_rows;
+ unsigned int element_size;
+
+ virtual int getKernel() { return 1; }
+
+ DfatoolHostTiming() {
+ element_size = sizeof(T);
+ }
+
+ advice call("% input_params(...)") : after() {
+ Params* p = tjp->result();
+ n_cols = p->n_size;
+ n_rows = p->m_size;
+ printf("[>>] GEMV | n_dpus=%u n_cols=%u n_rows=%u\n", NR_DPUS, n_cols, n_rows);
+ }
+
+ advice call("% gemv_host(...)") : after() {
+ printf("[--] GEMV | n_dpus=%u n_cols=%u n_rows=%u\n", NR_DPUS, n_cols, n_rows);
+ }
+
+ advice execution("% main(...)") : after() {
+ printf("[<<] GEMV | n_dpus=%u n_cols=%u n_rows=%u\n", NR_DPUS, n_cols, n_rows);
+ }
+};
diff --git a/GEMV/support/params.h b/GEMV/include/params.h
index c72b0c1..c72b0c1 100644
--- a/GEMV/support/params.h
+++ b/GEMV/include/params.h
diff --git a/GEMV/include/timer.h b/GEMV/include/timer.h
new file mode 100644
index 0000000..313151d
--- /dev/null
+++ b/GEMV/include/timer.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#define N_TIMERS 9
+#include "../../include/timer_base.h"
+#undef N_TIMERS
diff --git a/GEMV/run-fgbs24a.sh b/GEMV/run-fgbs24a.sh
deleted file mode 100755
index 4135623..0000000
--- a/GEMV/run-fgbs24a.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-
-set -e
-
-mkdir -p $(hostname)
-
-ts=$(date +%Y%m%d)
-
-(
-
-echo "prim-benchmarks GEMV (dfatool fgbs24a edition)"
-echo "Started at $(date)"
-echo "Revision $(git describe --always)"
-
-for nr_dpus in 2304 2048 2543; do
- for nr_tasklets in 16; do
- echo
- if make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets} BL=10; then
- timeout --foreground -k 1m 30m bin/gemv_host -w 0 -e 100 -m 163840 -n 4096 || true
- fi
- if make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets} BL=10 WITH_ALLOC_OVERHEAD=1 WITH_LOAD_OVERHEAD=1 WITH_FREE_OVERHEAD=1; then
- timeout --foreground -k 1m 30m bin/gemv_host -w 0 -e 100 -m 163840 -n 4096 || true
- fi
- done
-done
-echo "Completed at $(date)"
-) | tee "$(hostname)/${ts}-fgbs24a.txt"
diff --git a/GEMV/run-paper-strong-full.sh b/GEMV/run-paper-strong-full.sh
deleted file mode 100755
index 38e6123..0000000
--- a/GEMV/run-paper-strong-full.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-
-set -e
-
-(
-
-echo "prim-benchmarks GEMV strong-full (dfatool edition)"
-echo "Started at $(date)"
-echo "Revision $(git describe --always)"
-
-# >2048 are not part of upstream
-for nr_dpus in 2543 2304 256 512 1024 2048; do
- for nr_tasklets in 1 2 4 8 16; do
- echo
- if make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets} BL=10 verbose=1; then
- timeout --foreground -k 1m 30m bin/gemv_host -w 1 -e 100 -m 163840 -n 4096 || true
- fi
- done
-done
-) | tee log-paper-strong-full.txt
diff --git a/GEMV/run-paper-strong-rank.sh b/GEMV/run-paper-strong-rank.sh
deleted file mode 100755
index 64f0751..0000000
--- a/GEMV/run-paper-strong-rank.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-
-set -e
-
-(
-
-echo "prim-benchmarks GEMV strong-rank (dfatool edition)"
-echo "Started at $(date)"
-echo "Revision $(git describe --always)"
-
-# >64 are not part of upstream
-for nr_dpus in 128 1 4 16 64; do
- for nr_tasklets in 1 2 4 8 16; do
- echo
- if make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets} BL=10 verbose=1; then
- timeout --foreground -k 1m 30m bin/gemv_host -w 1 -e 100 -m 8192 -n 1024 || true
- fi
- done
-done
-) | tee log-paper-strong-rank.txt
diff --git a/GEMV/run-paper-weak.sh b/GEMV/run-paper-weak.sh
deleted file mode 100755
index 0632e71..0000000
--- a/GEMV/run-paper-weak.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-set -e
-
-(
-
-echo "prim-benchmarks GEMV weak (dfatool edition)"
-echo "Started at $(date)"
-echo "Revision $(git describe --always)"
-
-# 256 and 512 are not part of upstream config space
-for nr_dpus in 512 256 1 4 16 64; do
- for nr_tasklets in 1 2 4 8 16; do
- echo
- if make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets} BL=10 verbose=1; then
- i=$(( nr_dpus * 1024 ))
- timeout --foreground -k 1m 30m bin/gemv_host -w 1 -e 100 -m $i -n 2048 || true
- fi
- done
-done
-) | tee log-paper-weak.txt
diff --git a/GEMV/run.sh b/GEMV/run.sh
deleted file mode 100755
index 68637dc..0000000
--- a/GEMV/run.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-
-set -e
-
-# BL: use 2^(BL) B blocks for MRAM <-> WRAM transfers on PIM module
-# -w: number of un-timed warmup iterations
-# -e: number of timed iterations
-# -m: number of rows
-# -n: number of cols
-
-(
-
-echo "prim-benchmarks GEMV (dfatool edition)"
-echo "Started at $(date)"
-echo "Revision $(git describe --always)"
-
-# run-paper-strong-full: m=163840 n=4096
-# run-paper-strong-rank: m=8192 n=1024
-# run-paper-weak: m=ndpus*1024 n=2048
-for n in 512 1024 2048 4096; do
- for m in 512 1024 2048 4096 8192 163840; do
- for nr_dpus in 1 4 8 16 32 64 128 256 512 768 1024 1536 2048; do
- for nr_tasklets in 8 12 16; do
- echo
- if make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets} BL=10; then
- timeout --foreground -k 1m 30m bin/gemv_host -w 0 -e 100 -m $m -n $n || true
- fi
- done
- done
- done
-done
-) | tee "log-$(hostname)-ndpus.txt"
diff --git a/GEMV/support/timer.h b/GEMV/support/timer.h
deleted file mode 100755
index b2b9148..0000000
--- a/GEMV/support/timer.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2016 University of Cordoba and University of Illinois
- * All rights reserved.
- *
- * Developed by: IMPACT Research Group
- * University of Cordoba and University of Illinois
- * http://impact.crhc.illinois.edu/
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * > Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimers.
- * > Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimers in the
- * documentation and/or other materials provided with the distribution.
- * > Neither the names of IMPACT Research Group, University of Cordoba,
- * University of Illinois nor the names of its contributors may be used
- * to endorse or promote products derived from this Software without
- * specific prior written permission.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH
- * THE SOFTWARE.
- *
- */
-
-#include <sys/time.h>
-typedef struct Timer {
- struct timeval startTime[9];
- struct timeval stopTime[9];
- double time[9];
-} Timer;
-
-void start(Timer *timer, int i, int rep)
-{
- if (rep == 0) {
- timer->time[i] = 0.0;
- }
- gettimeofday(&timer->startTime[i], NULL);
-}
-
-void stop(Timer *timer, int i)
-{
- gettimeofday(&timer->stopTime[i], NULL);
- timer->time[i] +=
- (timer->stopTime[i].tv_sec -
- timer->startTime[i].tv_sec) * 1000000.0 +
- (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec);
-
- //printf("Time (ms): %f\t",((timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 +
- // (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec)) / 1000);
-}
-
-void print(Timer *timer, int i, int REP)
-{
- printf("%f\t", timer->time[i] / (1000 * REP));
-}
-
-void printall(Timer *timer, int maxt)
-{
- for (int i = 0; i <= maxt; i++) {
- printf(" timer%d_us=%f", i, timer->time[i]);
- }
- printf("\n");
-}