From 643e7dc59e8e0799f91ff74df56c52d7d4c10f12 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Thu, 15 May 2025 11:08:24 +0200 Subject: NW: AspectC++ support --- NW/Makefile | 62 +++++++++++++++++++++---------------- NW/dpu/task.c | 2 +- NW/host/app.c | 49 ++++++++++++------------------ NW/include/common.h | 76 ++++++++++++++++++++++++++++++++++++++++++++++ NW/include/dfatool_host.ah | 30 ++++++++++++++++++ NW/include/params.h | 56 ++++++++++++++++++++++++++++++++++ NW/include/timer.h | 59 +++++++++++++++++++++++++++++++++++ NW/support/common.h | 76 ---------------------------------------------- NW/support/params.h | 56 ---------------------------------- NW/support/timer.h | 59 ----------------------------------- README.md | 2 +- 11 files changed, 278 insertions(+), 249 deletions(-) create mode 100644 NW/include/common.h create mode 100644 NW/include/dfatool_host.ah create mode 100644 NW/include/params.h create mode 100644 NW/include/timer.h delete mode 100755 NW/support/common.h delete mode 100644 NW/support/params.h delete mode 100755 NW/support/timer.h diff --git a/NW/Makefile b/NW/Makefile index 68f495a..30353c9 100644 --- a/NW/Makefile +++ b/NW/Makefile @@ -1,46 +1,56 @@ -DPU_DIR := dpu -HOST_DIR := host -BUILDDIR ?= bin NR_TASKLETS ?= 13 BL ?= 1024 BL_IN ?= 4 NR_DPUS ?= 1 ENERGY ?= 0 -define conf_filename - ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3).conf -endef -CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL}) +HOST_SOURCES := $(wildcard host/*.c) +DPU_SOURCES := $(wildcard dpu/*.c) -HOST_TARGET := ${BUILDDIR}/nw_host -DPU_TARGET := ${BUILDDIR}/nw_dpu +aspectc ?= 0 +aspectc_timing ?= 0 -COMMON_INCLUDES := support -HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) -DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) +HOST_CC := ${CC} -.PHONY: all clean test +COMMON_FLAGS := -Wall -Wextra -g -Iinclude -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} +HOST_FLAGS := ${COMMON_FLAGS} -O3 `dpu-pkg-config --cflags --libs dpu` -DENERGY=${ENERGY} -DASPECTC=${aspectc} +DPU_FLAGS := ${COMMON_FLAGS} -O2 -DBL_IN=${BL_IN} + +ifeq (${aspectc_timing}, 1) + ASPECTC_HOST_FLAGS += -ainclude/dfatool_host_dpu.ah -ainclude/dfatool_host.ah +endif + +ASPECTC_HOST_FLAGS ?= -a0 -__dirs := $(shell mkdir -p ${BUILDDIR}) +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 -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} -DENERGY=${ENERGY} -DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -DBL_IN=${BL_IN} +QUIET = @ -all: ${HOST_TARGET} ${DPU_TARGET} +ifdef verbose + QUIET = +endif -${CONF}: - $(RM) $(call conf_filename,*,*) - touch ${CONF} +all: bin/nw_host bin/nw_dpu -${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} - $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} +bin: + ${QUIET}mkdir -p bin -${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} - dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} +bin/nw_host: ${HOST_SOURCES} include bin + ${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/nw_dpu: ${DPU_SOURCES} include bin + ${QUIET}dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} clean: $(RM) -r $(BUILDDIR) test: all - ./${HOST_TARGET} + bin/nw_host + +.PHONY: all clean test diff --git a/NW/dpu/task.c b/NW/dpu/task.c index c022f70..fab163a 100644 --- a/NW/dpu/task.c +++ b/NW/dpu/task.c @@ -10,7 +10,7 @@ #include #include -#include "../support/common.h" +#include "common.h" __host dpu_arguments_t DPU_INPUT_ARGUMENTS; diff --git a/NW/host/app.c b/NW/host/app.c index 0e899ec..9de2918 100644 --- a/NW/host/app.c +++ b/NW/host/app.c @@ -7,20 +7,30 @@ #include #include #include + +#if ASPECTC +extern "C" { +#endif + #include #include -#include -#include -#include - -#include "../support/common.h" -#include "../support/timer.h" -#include "../support/params.h" #if ENERGY #include #endif +#if ASPECTC +} +#endif + +#include +#include +#include + +#include "common.h" +#include "timer.h" +#include "params.h" + // Define the DPU Binary path as DPU_BINARY here #ifndef DPU_BINARY #define DPU_BINARY "./bin/nw_dpu" @@ -184,7 +194,7 @@ int main(int argc, char **argv) { struct Params p = input_params(argc, argv); struct dpu_set_t dpu_set, dpu; - uint32_t nr_of_dpus, max_dpus; + uint32_t nr_of_dpus, nr_of_ranks, max_dpus; #if ENERGY struct dpu_probe_t probe; @@ -195,6 +205,7 @@ int main(int argc, char **argv) { DPU_ASSERT(dpu_alloc(NR_DPUS, NULL, &dpu_set)); 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)); printf("Allocated %d DPU(s)\n", nr_of_dpus); printf("Allocated %d TASKLET(s) per DPU\n", NR_TASKLETS); #if DYNAMIC @@ -822,28 +833,6 @@ int main(int argc, char **argv) { stop(&timer, 1); } - - // Print timing results - printf("CPU version "); - print(&timer, 0, p.n_reps); - printf("CPU-DPU "); - print(&timer, 2, p.n_reps); - printf("DPU Kernel "); - print(&timer, 3, p.n_reps); - printf("Inter-DPU "); - print(&timer, 1, p.n_reps); - printf("DPU-CPU "); - print(&timer, 4, p.n_reps); - printf("\n"); - printf("Longest Diagonal CPU-DPU "); - print(&long_diagonal_timer, 2, p.n_reps); - printf("Longest Diagonal DPU Kernel "); - print(&long_diagonal_timer, 3, p.n_reps); - printf("Longest Diagonal Inter-DPU "); - print(&long_diagonal_timer, 1, p.n_reps); - printf("Longest Diagonal DPU-CPU "); - print(&long_diagonal_timer, 4, p.n_reps); - printf("\n"); #if ENERGY printf("DPU Energy (J): %f \t ", tavg_energy / p.n_reps); diff --git a/NW/include/common.h b/NW/include/common.h new file mode 100644 index 0000000..69069e7 --- /dev/null +++ b/NW/include/common.h @@ -0,0 +1,76 @@ +#ifndef _COMMON_H_ +#define _COMMON_H_ + +// Structures used by both the host and the dpu to communicate information +typedef struct { + uint32_t nblocks; + uint32_t active_blocks; + uint32_t penalty; + uint32_t dummy; +} dpu_arguments_t; + +#ifndef BL +#define BL 16 +#endif + +// Data type +#define T int32_t + +// MAX +int32_t maximum(int32_t a, int32_t b, int32_t c) { + + int32_t k; + if (a <= b) + k = b; + else + k = a; + + if (k <= c) + return c; + else + return k; + +} + +#define DPU_CAPACITY (64 << 20) // A DPU's capacity is 64 MiB + +#define ANSI_COLOR_RED "\x1b[31m" +#define ANSI_COLOR_GREEN "\x1b[32m" +#define ANSI_COLOR_RESET "\x1b[0m" + +#define LIMIT -999 + +int blosum62[24][24] = { + { 4, -1, -2, -2, 0, -1, -1, 0, -2, -1, -1, -1, -1, -2, -1, 1, 0, -3, -2, 0, -2, -1, 0, -4}, + {-1, 5, 0, -2, -3, 1, 0, -2, 0, -3, -2, 2, -1, -3, -2, -1, -1, -3, -2, -3, -1, 0, -1, -4}, + {-2, 0, 6, 1, -3, 0, 0, 0, 1, -3, -3, 0, -2, -3, -2, 1, 0, -4, -2, -3, 3, 0, -1, -4}, + {-2, -2, 1, 6, -3, 0, 2, -1, -1, -3, -4, -1, -3, -3, -1, 0, -1, -4, -3, -3, 4, 1, -1, -4}, + { 0, -3, -3, -3, 9, -3, -4, -3, -3, -1, -1, -3, -1, -2, -3, -1, -1, -2, -2, -1, -3, -3, -2, -4}, + {-1, 1, 0, 0, -3, 5, 2, -2, 0, -3, -2, 1, 0, -3, -1, 0, -1, -2, -1, -2, 0, 3, -1, -4}, + {-1, 0, 0, 2, -4, 2, 5, -2, 0, -3, -3, 1, -2, -3, -1, 0, -1, -3, -2, -2, 1, 4, -1, -4}, + { 0, -2, 0, -1, -3, -2, -2, 6, -2, -4, -4, -2, -3, -3, -2, 0, -2, -2, -3, -3, -1, -2, -1, -4}, + {-2, 0, 1, -1, -3, 0, 0, -2, 8, -3, -3, -1, -2, -1, -2, -1, -2, -2, 2, -3, 0, 0, -1, -4}, + {-1, -3, -3, -3, -1, -3, -3, -4, -3, 4, 2, -3, 1, 0, -3, -2, -1, -3, -1, 3, -3, -3, -1, -4}, + {-1, -2, -3, -4, -1, -2, -3, -4, -3, 2, 4, -2, 2, 0, -3, -2, -1, -2, -1, 1, -4, -3, -1, -4}, + {-1, 2, 0, -1, -3, 1, 1, -2, -1, -3, -2, 5, -1, -3, -1, 0, -1, -3, -2, -2, 0, 1, -1, -4}, + {-1, -1, -2, -3, -1, 0, -2, -3, -2, 1, 2, -1, 5, 0, -2, -1, -1, -1, -1, 1, -3, -1, -1, -4}, + {-2, -3, -3, -3, -2, -3, -3, -3, -1, 0, 0, -3, 0, 6, -4, -2, -2, 1, 3, -1, -3, -3, -1, -4}, + {-1, -2, -2, -1, -3, -1, -1, -2, -2, -3, -3, -1, -2, -4, 7, -1, -1, -4, -3, -2, -2, -1, -2, -4}, + { 1, -1, 1, 0, -1, 0, 0, 0, -1, -2, -2, 0, -1, -2, -1, 4, 1, -3, -2, -2, 0, 0, 0, -4}, + { 0, -1, 0, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -2, -1, 1, 5, -2, -2, 0, -1, -1, 0, -4}, + {-3, -3, -4, -4, -2, -2, -3, -2, -2, -3, -2, -3, -1, 1, -4, -3, -2, 11, 2, -3, -4, -3, -2, -4}, + {-2, -2, -2, -3, -2, -1, -2, -3, 2, -1, -1, -2, -1, 3, -3, -2, -2, 2, 7, -1, -3, -2, -1, -4}, + { 0, -3, -3, -3, -1, -2, -2, -3, -3, 3, 1, -2, 1, -1, -2, -2, 0, -3, -1, 4, -3, -2, -1, -4}, + {-2, -1, 3, 4, -3, 0, 1, -1, 0, -3, -4, 0, -3, -3, -2, 0, -1, -4, -3, -3, 4, 1, -1, -4}, + {-1, 0, 0, 1, -3, 3, 4, -2, 0, -3, -3, 1, -1, -3, -1, 0, -1, -3, -2, -2, 1, 4, -1, -4}, + { 0, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, 0, 0, -2, -1, -1, -1, -1, -1, -4}, + {-4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 1} +}; + +#define DYNAMIC 1 +#define PRINT 0 +#define PRINT_FILE 0 +#ifndef ENERGY +#define ENERGY 0 +#endif +#endif diff --git a/NW/include/dfatool_host.ah b/NW/include/dfatool_host.ah new file mode 100644 index 0000000..d45aef3 --- /dev/null +++ b/NW/include/dfatool_host.ah @@ -0,0 +1,30 @@ +#pragma once + +#include +#include "dfatool_host_dpu.ah" + +aspect DfatoolHostTiming : public DfatoolHostDPUTiming { + + unsigned long n_elements; + unsigned int element_size; + + virtual int getKernel() { return 1; } + + DfatoolHostTiming() { + element_size = sizeof(uint32_t); + } + + advice call("% input_params(...)"): after() { + Params* p = tjp->result(); + n_elements = p->max_rows; + printf("[>>] NW | n_dpus=%u n_elements=%lu\n", NR_DPUS, n_elements); + } + + advice call("% srand(...)") : after() { + printf("[--] NW | n_dpus=%u n_elements=%lu\n", NR_DPUS, n_elements); + } + + advice execution("% main(...)") : after() { + printf("[<<] NW | n_dpus=%u n_elements=%lu\n", NR_DPUS, n_elements); + } +}; diff --git a/NW/include/params.h b/NW/include/params.h new file mode 100644 index 0000000..8874248 --- /dev/null +++ b/NW/include/params.h @@ -0,0 +1,56 @@ +#ifndef _PARAMS_H_ +#define _PARAMS_H_ + +#include "common.h" + +typedef struct Params { + unsigned int max_rows; + unsigned int penalty; + unsigned int n_warmup; + unsigned int n_reps; +} Params; + +static void usage() { + fprintf(stderr, + "\nUsage: ./program [options]" + "\n" + "\nGeneral options:" + "\n -h help" + "\n -w # of untimed warmup iterations (default=1)" + "\n -e # of timed repetition iterations (default=3)" + "\n" + "\nBenchmark-specific options:" + "\n -n size of sequence: length of the sequence" + "\n -p

penalty: a positive integer" + "\n"); +} + +struct Params input_params(int argc, char **argv) { + struct Params p; + p.n_warmup = 1; + p.n_reps = 3; + p.max_rows = 256; + p.penalty = 1; + + int opt; + while((opt = getopt(argc, argv, "hw:e:n:p:")) >= 0) { + switch(opt) { + case 'h': + usage(); + exit(0); + break; + case 'w': p.n_warmup = atoi(optarg); break; + case 'e': p.n_reps = atoi(optarg); break; + case 'n': p.max_rows = atoi(optarg); break; + case 'p': p.penalty = atoi(optarg); break; + default: + fprintf(stderr, "\nUnrecognized option!\n"); + usage(); + exit(0); + } + } + assert(NR_DPUS > 0 && "Invalid # of dpus!"); + + return p; +} +#endif diff --git a/NW/include/timer.h b/NW/include/timer.h new file mode 100644 index 0000000..efaefcd --- /dev/null +++ b/NW/include/timer.h @@ -0,0 +1,59 @@ +/* + * 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 + +typedef struct Timer{ + + struct timeval startTime[5]; + struct timeval stopTime[5]; + double time[5]; + +}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); +} + +void print(Timer *timer, int i, int REP) { printf("Time (ms): %f\t", timer->time[i] / (1000 * REP)); } diff --git a/NW/support/common.h b/NW/support/common.h deleted file mode 100755 index 69069e7..0000000 --- a/NW/support/common.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef _COMMON_H_ -#define _COMMON_H_ - -// Structures used by both the host and the dpu to communicate information -typedef struct { - uint32_t nblocks; - uint32_t active_blocks; - uint32_t penalty; - uint32_t dummy; -} dpu_arguments_t; - -#ifndef BL -#define BL 16 -#endif - -// Data type -#define T int32_t - -// MAX -int32_t maximum(int32_t a, int32_t b, int32_t c) { - - int32_t k; - if (a <= b) - k = b; - else - k = a; - - if (k <= c) - return c; - else - return k; - -} - -#define DPU_CAPACITY (64 << 20) // A DPU's capacity is 64 MiB - -#define ANSI_COLOR_RED "\x1b[31m" -#define ANSI_COLOR_GREEN "\x1b[32m" -#define ANSI_COLOR_RESET "\x1b[0m" - -#define LIMIT -999 - -int blosum62[24][24] = { - { 4, -1, -2, -2, 0, -1, -1, 0, -2, -1, -1, -1, -1, -2, -1, 1, 0, -3, -2, 0, -2, -1, 0, -4}, - {-1, 5, 0, -2, -3, 1, 0, -2, 0, -3, -2, 2, -1, -3, -2, -1, -1, -3, -2, -3, -1, 0, -1, -4}, - {-2, 0, 6, 1, -3, 0, 0, 0, 1, -3, -3, 0, -2, -3, -2, 1, 0, -4, -2, -3, 3, 0, -1, -4}, - {-2, -2, 1, 6, -3, 0, 2, -1, -1, -3, -4, -1, -3, -3, -1, 0, -1, -4, -3, -3, 4, 1, -1, -4}, - { 0, -3, -3, -3, 9, -3, -4, -3, -3, -1, -1, -3, -1, -2, -3, -1, -1, -2, -2, -1, -3, -3, -2, -4}, - {-1, 1, 0, 0, -3, 5, 2, -2, 0, -3, -2, 1, 0, -3, -1, 0, -1, -2, -1, -2, 0, 3, -1, -4}, - {-1, 0, 0, 2, -4, 2, 5, -2, 0, -3, -3, 1, -2, -3, -1, 0, -1, -3, -2, -2, 1, 4, -1, -4}, - { 0, -2, 0, -1, -3, -2, -2, 6, -2, -4, -4, -2, -3, -3, -2, 0, -2, -2, -3, -3, -1, -2, -1, -4}, - {-2, 0, 1, -1, -3, 0, 0, -2, 8, -3, -3, -1, -2, -1, -2, -1, -2, -2, 2, -3, 0, 0, -1, -4}, - {-1, -3, -3, -3, -1, -3, -3, -4, -3, 4, 2, -3, 1, 0, -3, -2, -1, -3, -1, 3, -3, -3, -1, -4}, - {-1, -2, -3, -4, -1, -2, -3, -4, -3, 2, 4, -2, 2, 0, -3, -2, -1, -2, -1, 1, -4, -3, -1, -4}, - {-1, 2, 0, -1, -3, 1, 1, -2, -1, -3, -2, 5, -1, -3, -1, 0, -1, -3, -2, -2, 0, 1, -1, -4}, - {-1, -1, -2, -3, -1, 0, -2, -3, -2, 1, 2, -1, 5, 0, -2, -1, -1, -1, -1, 1, -3, -1, -1, -4}, - {-2, -3, -3, -3, -2, -3, -3, -3, -1, 0, 0, -3, 0, 6, -4, -2, -2, 1, 3, -1, -3, -3, -1, -4}, - {-1, -2, -2, -1, -3, -1, -1, -2, -2, -3, -3, -1, -2, -4, 7, -1, -1, -4, -3, -2, -2, -1, -2, -4}, - { 1, -1, 1, 0, -1, 0, 0, 0, -1, -2, -2, 0, -1, -2, -1, 4, 1, -3, -2, -2, 0, 0, 0, -4}, - { 0, -1, 0, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -2, -1, 1, 5, -2, -2, 0, -1, -1, 0, -4}, - {-3, -3, -4, -4, -2, -2, -3, -2, -2, -3, -2, -3, -1, 1, -4, -3, -2, 11, 2, -3, -4, -3, -2, -4}, - {-2, -2, -2, -3, -2, -1, -2, -3, 2, -1, -1, -2, -1, 3, -3, -2, -2, 2, 7, -1, -3, -2, -1, -4}, - { 0, -3, -3, -3, -1, -2, -2, -3, -3, 3, 1, -2, 1, -1, -2, -2, 0, -3, -1, 4, -3, -2, -1, -4}, - {-2, -1, 3, 4, -3, 0, 1, -1, 0, -3, -4, 0, -3, -3, -2, 0, -1, -4, -3, -3, 4, 1, -1, -4}, - {-1, 0, 0, 1, -3, 3, 4, -2, 0, -3, -3, 1, -1, -3, -1, 0, -1, -3, -2, -2, 1, 4, -1, -4}, - { 0, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, 0, 0, -2, -1, -1, -1, -1, -1, -4}, - {-4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 1} -}; - -#define DYNAMIC 1 -#define PRINT 0 -#define PRINT_FILE 0 -#ifndef ENERGY -#define ENERGY 0 -#endif -#endif diff --git a/NW/support/params.h b/NW/support/params.h deleted file mode 100644 index 8874248..0000000 --- a/NW/support/params.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef _PARAMS_H_ -#define _PARAMS_H_ - -#include "common.h" - -typedef struct Params { - unsigned int max_rows; - unsigned int penalty; - unsigned int n_warmup; - unsigned int n_reps; -} Params; - -static void usage() { - fprintf(stderr, - "\nUsage: ./program [options]" - "\n" - "\nGeneral options:" - "\n -h help" - "\n -w # of untimed warmup iterations (default=1)" - "\n -e # of timed repetition iterations (default=3)" - "\n" - "\nBenchmark-specific options:" - "\n -n size of sequence: length of the sequence" - "\n -p

penalty: a positive integer" - "\n"); -} - -struct Params input_params(int argc, char **argv) { - struct Params p; - p.n_warmup = 1; - p.n_reps = 3; - p.max_rows = 256; - p.penalty = 1; - - int opt; - while((opt = getopt(argc, argv, "hw:e:n:p:")) >= 0) { - switch(opt) { - case 'h': - usage(); - exit(0); - break; - case 'w': p.n_warmup = atoi(optarg); break; - case 'e': p.n_reps = atoi(optarg); break; - case 'n': p.max_rows = atoi(optarg); break; - case 'p': p.penalty = atoi(optarg); break; - default: - fprintf(stderr, "\nUnrecognized option!\n"); - usage(); - exit(0); - } - } - assert(NR_DPUS > 0 && "Invalid # of dpus!"); - - return p; -} -#endif diff --git a/NW/support/timer.h b/NW/support/timer.h deleted file mode 100755 index efaefcd..0000000 --- a/NW/support/timer.h +++ /dev/null @@ -1,59 +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 - -typedef struct Timer{ - - struct timeval startTime[5]; - struct timeval stopTime[5]; - double time[5]; - -}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); -} - -void print(Timer *timer, int i, int REP) { printf("Time (ms): %f\t", timer->time[i] / (1000 * REP)); } diff --git a/README.md b/README.md index b77dbf3..307008e 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ CPU and DPU benchmarks in this repository have been adjusted as follows: * HST-L: AD * HST-S: DLN * MLP: A -* NW: – +* NW: A * RED: DLN * SCAN-SSA: D * SCAN-RSS: DLN -- cgit v1.2.3