├── Linear_Regression ├── LinReg_SUSY_quantization │ ├── LogReg_int32_SUSY │ │ ├── .conf │ │ ├── Makefile │ │ └── support │ │ │ ├── common.h │ │ │ ├── params.h │ │ │ └── timer.h │ ├── LogReg_int8_SUSY │ │ ├── Makefile │ │ └── support │ │ │ ├── params.h │ │ │ ├── common.h │ │ │ └── timer.h │ └── LogReg_int8_builtin_SUSY │ │ ├── Makefile │ │ └── support │ │ ├── params.h │ │ ├── common.h │ │ └── timer.h ├── Baseline │ ├── GPU_cuBLAS │ │ └── Makefile │ └── CPU_MKL │ │ ├── Makefile │ │ └── params.h ├── LinReg_quantization │ ├── LogReg_int8 │ │ ├── Makefile │ │ ├── support │ │ │ ├── common.h │ │ │ ├── params.h │ │ │ └── timer.h │ │ └── run_weak.py │ ├── LogReg_int32_float │ │ ├── Makefile │ │ ├── support │ │ │ ├── common.h │ │ │ ├── params.h │ │ │ └── timer.h │ │ └── run_weak.py │ └── LogReg_int8_builtin │ │ ├── Makefile │ │ ├── support │ │ ├── common.h │ │ ├── params.h │ │ └── timer.h │ │ └── run_weak.py └── LinReg_no_quantization │ ├── LogReg_int32_float │ ├── Makefile │ └── support │ │ ├── common.h │ │ ├── params.h │ │ └── timer.h │ ├── LogReg_int8 │ ├── Makefile │ ├── support │ │ ├── common.h │ │ ├── params.h │ │ └── timer.h │ └── run_weak.py │ └── LogReg_int8_builtin │ ├── Makefile │ ├── support │ ├── common.h │ ├── params.h │ └── timer.h │ └── run_weak.py ├── Logistic_Regression ├── Baseline │ ├── GPU_cuBLAS │ │ └── Makefile │ └── CPU_MKL │ │ ├── Makefile │ │ └── params.h ├── LogReg_quantization │ ├── LogReg_int8 │ │ ├── Makefile │ │ ├── support │ │ │ ├── common.h │ │ │ ├── params.h │ │ │ └── timer.h │ │ └── run_weak.py │ ├── LogReg_int32LUT_float │ │ ├── Makefile │ │ ├── support │ │ │ ├── common.h │ │ │ ├── params.h │ │ │ └── timer.h │ │ └── run_weak.py │ ├── LogReg_int32_float │ │ ├── Makefile │ │ └── support │ │ │ ├── common.h │ │ │ ├── params.h │ │ │ └── timer.h │ ├── LogReg_int8_builtin │ │ ├── Makefile │ │ ├── support │ │ │ ├── common.h │ │ │ ├── params.h │ │ │ └── timer.h │ │ └── run_weak.py │ └── LogReg_int32LUTMRAM_float │ │ ├── Makefile │ │ └── support │ │ ├── common.h │ │ ├── params.h │ │ └── timer.h ├── LogReg_no_quantization │ ├── LogReg_int8 │ │ ├── Makefile │ │ ├── support │ │ │ ├── common.h │ │ │ ├── params.h │ │ │ └── timer.h │ │ └── run_weak.py │ ├── LogReg_int8_builtin │ │ ├── Makefile │ │ ├── support │ │ │ ├── common.h │ │ │ ├── params.h │ │ │ └── timer.h │ │ └── run_weak.py │ ├── LogReg_int32LUT_float │ │ ├── Makefile │ │ └── support │ │ │ ├── common.h │ │ │ ├── params.h │ │ │ └── timer.h │ ├── LogReg_int32_float │ │ ├── Makefile │ │ └── support │ │ │ ├── common.h │ │ │ ├── params.h │ │ │ └── timer.h │ └── LogReg_int32LUTMRAM_float │ │ ├── Makefile │ │ └── support │ │ ├── common.h │ │ ├── params.h │ │ └── timer.h └── LogReg_SUSY_quantization │ ├── LogReg_int32_SUSY │ ├── Makefile │ └── support │ │ ├── common.h │ │ ├── params.h │ │ └── timer.h │ └── LogReg_int8_SUSY │ ├── Makefile │ └── support │ ├── common.h │ ├── params.h │ └── timer.h ├── .gitmodules └── LICENSE /Linear_Regression/LinReg_SUSY_quantization/LogReg_int32_SUSY/.conf: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Linear_Regression/Baseline/GPU_cuBLAS/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | /usr/local/cuda/bin/nvcc kernel.cu -I/usr/local/cuda/include -lcublas -lm -o linreg 3 | 4 | clean: 5 | rm linreg 6 | -------------------------------------------------------------------------------- /Logistic_Regression/Baseline/GPU_cuBLAS/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | /usr/local/cuda/bin/nvcc kernel.cu -I/usr/local/cuda/include -lcublas -lm -o logreg 3 | 4 | clean: 5 | rm logreg 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "scikit-dpu"] 2 | path = scikit-dpu 3 | url = https://github.com/upmem/scikit-dpu 4 | [submodule "dpu_kmeans"] 5 | path = dpu_kmeans 6 | url = https://github.com/upmem/dpu_kmeans.git 7 | -------------------------------------------------------------------------------- /Linear_Regression/Baseline/CPU_MKL/Makefile: -------------------------------------------------------------------------------- 1 | CXX = dpcpp 2 | MKLROOT = /home/rain/intel/oneapi/mkl/2022.0.1 3 | CXXFLAGS = -O2 -L${MKLROOT}/lib/intel64 -lmkl_intel_ilp64 \ 4 | -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl 5 | 6 | # CXX = gcc 7 | # MKLROOT = /home/rain/intel/oneapi/mkl/2022.0.1 8 | # CXXFLAGS = -O2 -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_intel_thread \ 9 | # -lmkl_core -liomp5 -lpthread -lm -ldl 10 | 11 | BUFFER_EXE_NAME = lr_mkl 12 | BUFFER_SOURCES = linear_regression_mkl.c 13 | 14 | all: build_buffers 15 | 16 | build_buffers: 17 | $(CXX) $(CXXFLAGS) -o $(BUFFER_EXE_NAME) $(BUFFER_SOURCES) 18 | 19 | run: 20 | ./$(BUFFER_EXE_NAME) 21 | 22 | clean: 23 | rm -f $(BUFFER_EXE_NAME) 24 | -------------------------------------------------------------------------------- /Logistic_Regression/Baseline/CPU_MKL/Makefile: -------------------------------------------------------------------------------- 1 | CXX = dpcpp 2 | MKLROOT = /home/rain/intel/oneapi/mkl/2022.0.1 3 | CXXFLAGS = -O2 -L${MKLROOT}/lib/intel64 -lmkl_intel_ilp64 \ 4 | -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl 5 | 6 | # CXX = gcc 7 | # MKLROOT = /home/rain/intel/oneapi/mkl/2022.0.1 8 | # CXXFLAGS = -O2 -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_intel_thread \ 9 | # -lmkl_core -liomp5 -lpthread -lm -ldl 10 | 11 | BUFFER_EXE_NAME = logreg_mkl 12 | BUFFER_SOURCES = logistic_regression_mkl.c 13 | 14 | all: build_buffers 15 | 16 | build_buffers: 17 | $(CXX) $(CXXFLAGS) -o $(BUFFER_EXE_NAME) $(BUFFER_SOURCES) 18 | 19 | run: 20 | ./$(BUFFER_EXE_NAME) 21 | 22 | clean: 23 | rm -f $(BUFFER_EXE_NAME) 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 SAFARI Research Group at ETH Zürich 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int8/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 16 5 | BL ?= 10 6 | NR_DPUS ?= 64 7 | TYPE ?= INT8 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int8/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 12 5 | BL ?= 8 6 | NR_DPUS ?= 64 7 | TYPE ?= INT8 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int32_float/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 16 5 | BL ?= 10 6 | NR_DPUS ?= 64 7 | TYPE ?= INT32 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int8/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 16 5 | BL ?= 10 6 | NR_DPUS ?= 64 7 | TYPE ?= INT8 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int32_float/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 16 5 | BL ?= 10 6 | NR_DPUS ?= 64 7 | TYPE ?= INT32 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int8/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 12 5 | BL ?= 8 6 | NR_DPUS ?= 64 7 | TYPE ?= INT8 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_SUSY_quantization/LogReg_int8_SUSY/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 16 5 | BL ?= 10 6 | NR_DPUS ?= 2048 7 | TYPE ?= INT8 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int8_builtin/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 16 5 | BL ?= 10 6 | NR_DPUS ?= 64 7 | TYPE ?= INT8 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int8_builtin/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 16 5 | BL ?= 10 6 | NR_DPUS ?= 64 7 | TYPE ?= INT8 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_SUSY_quantization/LogReg_int32_SUSY/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 12 5 | BL ?= 0 6 | NR_DPUS ?= 64 7 | TYPE ?= INT32 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_SUSY_quantization/LogReg_int8_SUSY/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 12 5 | BL ?= 0 6 | NR_DPUS ?= 64 7 | TYPE ?= INT8 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int8_builtin/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 12 5 | BL ?= 8 6 | NR_DPUS ?= 64 7 | TYPE ?= INT8 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int32LUT_float/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 12 5 | BL ?= 8 6 | NR_DPUS ?= 64 7 | TYPE ?= INT32 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int32_float/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 16 5 | BL ?= 10 6 | NR_DPUS ?= 64 7 | TYPE ?= FLOAT 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int8_builtin/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 12 5 | BL ?= 8 6 | NR_DPUS ?= 64 7 | TYPE ?= INT8 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_SUSY_quantization/LogReg_int32_SUSY/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 16 5 | BL ?= 10 6 | NR_DPUS ?= 2048 7 | TYPE ?= INT32 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int32LUT_float/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 12 5 | BL ?= 8 6 | NR_DPUS ?= 64 7 | TYPE ?= INT32 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int32_float/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 16 5 | BL ?= 10 6 | NR_DPUS ?= 64 7 | TYPE ?= FLOAT 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_SUSY_quantization/LogReg_int8_builtin_SUSY/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 16 5 | BL ?= 10 6 | NR_DPUS ?= 2048 7 | TYPE ?= INT8 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int32LUTMRAM_float/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 16 5 | BL ?= 10 6 | NR_DPUS ?= 64 7 | TYPE ?= INT32 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int32LUTMRAM_float/Makefile: -------------------------------------------------------------------------------- 1 | DPU_DIR := dpu 2 | HOST_DIR := host 3 | BUILDDIR ?= bin 4 | NR_TASKLETS ?= 16 5 | BL ?= 10 6 | NR_DPUS ?= 64 7 | TYPE ?= INT32 8 | ENERGY ?= 0 9 | 10 | define conf_filename 11 | ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_TYPE_$(4).conf 12 | endef 13 | CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${TYPE}) 14 | 15 | HOST_TARGET := ${BUILDDIR}/host_code 16 | DPU_TARGET := ${BUILDDIR}/dpu_code 17 | 18 | COMMON_INCLUDES := support 19 | HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c) 20 | DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c) 21 | 22 | .PHONY: all clean test 23 | 24 | __dirs := $(shell mkdir -p ${BUILDDIR}) 25 | 26 | COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} 27 | HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -lm -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} 28 | DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} 29 | 30 | all: ${HOST_TARGET} ${DPU_TARGET} 31 | 32 | ${CONF}: 33 | $(RM) $(call conf_filename,*,*) 34 | touch ${CONF} 35 | 36 | ${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF} 37 | $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS} 38 | 39 | ${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF} 40 | dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} 41 | 42 | clean: 43 | $(RM) -r $(BUILDDIR) 44 | 45 | test: all 46 | ./${HOST_TARGET} 47 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int8/support/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H_ 2 | #define _COMMON_H_ 3 | 4 | // Structures used by both the host and the dpu to communicate information 5 | typedef struct { 6 | uint32_t n_size; 7 | uint32_t n_size_pad; 8 | uint32_t nr_rows; 9 | uint32_t max_rows; 10 | uint32_t start_row[NR_TASKLETS]; 11 | uint32_t rows_per_tasklet[NR_TASKLETS]; 12 | } dpu_arguments_t; 13 | 14 | // Specific information for each DPU 15 | struct dpu_info_t { 16 | uint32_t rows_per_dpu; 17 | uint32_t rows_per_dpu_pad; 18 | uint32_t prev_rows_dpu; 19 | }; 20 | struct dpu_info_t *dpu_info; 21 | 22 | // Transfer size between MRAM and WRAM 23 | #ifdef BL 24 | #define BLOCK_SIZE_LOG2 BL 25 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 26 | #else 27 | #define BLOCK_SIZE_LOG2 8 28 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 29 | #define BL BLOCK_SIZE_LOG2 30 | #endif 31 | 32 | 33 | #ifdef INT8 34 | #define T int8_t 35 | #define DIV 0 // Shift right to divide by sizeof(T) 36 | #define MUL 0 // Shift left to multiply by sizeof(T) 37 | #endif 38 | 39 | 40 | #ifndef ENERGY 41 | #define ENERGY 0 42 | #endif 43 | #define PRINT 0 44 | 45 | #define ANSI_COLOR_RED "\x1b[31m" 46 | #define ANSI_COLOR_GREEN "\x1b[32m" 47 | #define ANSI_COLOR_RESET "\x1b[0m" 48 | 49 | #define divceil(n, m) (((n)-1) / (m) + 1) 50 | #define roundup(n, m) ((n / m) * m + m) 51 | 52 | // fixed point arithmetic 53 | #define SHIFT_AMOUNT 6 54 | #define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) 55 | 56 | // avoid overflow 57 | #define OFFSET 0 58 | #define OVERFLOW_SHIFT (SHIFT_AMOUNT + OFFSET) 59 | 60 | #define MAX_ROWS 16 61 | 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_SUSY_quantization/LogReg_int32_SUSY/support/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H_ 2 | #define _COMMON_H_ 3 | 4 | // Structures used by both the host and the dpu to communicate information 5 | typedef struct { 6 | uint32_t n_size; 7 | uint32_t n_size_pad; 8 | uint32_t nr_rows; 9 | uint32_t max_rows; 10 | uint32_t start_row[NR_TASKLETS]; 11 | uint32_t rows_per_tasklet[NR_TASKLETS]; 12 | } dpu_arguments_t; 13 | 14 | // Specific information for each DPU 15 | struct dpu_info_t { 16 | uint32_t rows_per_dpu; 17 | uint32_t rows_per_dpu_pad; 18 | uint32_t prev_rows_dpu; 19 | }; 20 | struct dpu_info_t *dpu_info; 21 | 22 | // Transfer size between MRAM and WRAM 23 | #ifdef BL 24 | #define BLOCK_SIZE_LOG2 BL 25 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 26 | #else 27 | #define BLOCK_SIZE_LOG2 8 28 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 29 | #define BL BLOCK_SIZE_LOG2 30 | #endif 31 | 32 | // Data type 33 | #ifdef INT32 34 | #define T int32_t 35 | #define DIV 2 // Shift right to divide by sizeof(T) 36 | #define MUL 2 // Shift left to multiply by sizeof(T) 37 | #endif 38 | 39 | #ifndef ENERGY 40 | #define ENERGY 0 41 | #endif 42 | #define PRINT 0 43 | 44 | #define ANSI_COLOR_RED "\x1b[31m" 45 | #define ANSI_COLOR_GREEN "\x1b[32m" 46 | #define ANSI_COLOR_RESET "\x1b[0m" 47 | 48 | #define divceil(n, m) (((n)-1) / (m) + 1) 49 | #define roundup(n, m) ((n / m) * m + m) 50 | 51 | // fixed point arithmetic 52 | #define SHIFT_AMOUNT 10 53 | #define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) 54 | 55 | // avoid overflow 56 | #define OFFSET 0 57 | #define OVERFLOW_SHIFT (SHIFT_AMOUNT + OFFSET) 58 | 59 | #define MAX_ROWS 24 60 | 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int32_float/support/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H_ 2 | #define _COMMON_H_ 3 | 4 | // Structures used by both the host and the dpu to communicate information 5 | typedef struct { 6 | uint32_t n_size; 7 | uint32_t n_size_pad; 8 | uint32_t nr_rows; 9 | uint32_t max_rows; 10 | uint32_t start_row[NR_TASKLETS]; 11 | uint32_t rows_per_tasklet[NR_TASKLETS]; 12 | } dpu_arguments_t; 13 | 14 | // Specific information for each DPU 15 | struct dpu_info_t { 16 | uint32_t rows_per_dpu; 17 | uint32_t rows_per_dpu_pad; 18 | uint32_t prev_rows_dpu; 19 | }; 20 | struct dpu_info_t *dpu_info; 21 | 22 | // Transfer size between MRAM and WRAM 23 | #ifdef BL 24 | #define BLOCK_SIZE_LOG2 BL 25 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 26 | #else 27 | #define BLOCK_SIZE_LOG2 8 28 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 29 | #define BL BLOCK_SIZE_LOG2 30 | #endif 31 | 32 | // Data type 33 | #ifdef INT32 34 | #define T int32_t 35 | #define MUL 2 // Shift left to divide by sizeof(T) 36 | #define DIV 2 // Shift right to divide by sizeof(T) 37 | #elif FLOAT 38 | #define T float 39 | #define MUL 2 // Shift left to divide by sizeof(T) 40 | #define DIV 2 // Shift right to divide by sizeof(T) 41 | #endif 42 | 43 | #ifndef ENERGY 44 | #define ENERGY 0 45 | #endif 46 | #define PRINT 0 47 | 48 | #define ANSI_COLOR_RED "\x1b[31m" 49 | #define ANSI_COLOR_GREEN "\x1b[32m" 50 | #define ANSI_COLOR_RESET "\x1b[0m" 51 | 52 | #define divceil(n, m) (((n)-1) / (m) + 1) 53 | #define roundup(n, m) ((n / m) * m + m) 54 | 55 | // fixed point arithmetic 56 | #define SHIFT_AMOUNT 10 57 | #define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) 58 | 59 | // avoid overflow 60 | #define OFFSET 0 61 | #define OVERFLOW_SHIFT (SHIFT_AMOUNT + OFFSET) 62 | 63 | #define MAX_ROWS 24 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int32_float/support/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H_ 2 | #define _COMMON_H_ 3 | 4 | // Structures used by both the host and the dpu to communicate information 5 | typedef struct { 6 | uint32_t n_size; 7 | uint32_t n_size_pad; 8 | uint32_t nr_rows; 9 | uint32_t max_rows; 10 | uint32_t start_row[NR_TASKLETS]; 11 | uint32_t rows_per_tasklet[NR_TASKLETS]; 12 | } dpu_arguments_t; 13 | 14 | // Specific information for each DPU 15 | struct dpu_info_t { 16 | uint32_t rows_per_dpu; 17 | uint32_t rows_per_dpu_pad; 18 | uint32_t prev_rows_dpu; 19 | }; 20 | struct dpu_info_t *dpu_info; 21 | 22 | // Transfer size between MRAM and WRAM 23 | #ifdef BL 24 | #define BLOCK_SIZE_LOG2 BL 25 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 26 | #else 27 | #define BLOCK_SIZE_LOG2 8 28 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 29 | #define BL BLOCK_SIZE_LOG2 30 | #endif 31 | 32 | // Data type 33 | #ifdef INT32 34 | #define T int32_t 35 | #define MUL 2 // Shift left to divide by sizeof(T) 36 | #define DIV 2 // Shift right to divide by sizeof(T) 37 | #elif FLOAT 38 | #define T float 39 | #define MUL 2 // Shift left to divide by sizeof(T) 40 | #define DIV 2 // Shift right to divide by sizeof(T) 41 | #endif 42 | 43 | #ifndef ENERGY 44 | #define ENERGY 0 45 | #endif 46 | #define PRINT 0 47 | 48 | #define ANSI_COLOR_RED "\x1b[31m" 49 | #define ANSI_COLOR_GREEN "\x1b[32m" 50 | #define ANSI_COLOR_RESET "\x1b[0m" 51 | 52 | #define divceil(n, m) (((n)-1) / (m) + 1) 53 | #define roundup(n, m) ((n / m) * m + m) 54 | 55 | // fixed point arithmetic 56 | #define SHIFT_AMOUNT 10 57 | #define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) 58 | 59 | // avoid overflow 60 | #define OFFSET 6 61 | #define OVERFLOW_SHIFT (SHIFT_AMOUNT + OFFSET) 62 | 63 | #define MAX_ROWS 16 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int32_float/support/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H_ 2 | #define _COMMON_H_ 3 | 4 | // Structures used by both the host and the dpu to communicate information 5 | typedef struct { 6 | uint32_t n_size; 7 | uint32_t n_size_pad; 8 | uint32_t nr_rows; 9 | uint32_t max_rows; 10 | uint32_t start_row[NR_TASKLETS]; 11 | uint32_t rows_per_tasklet[NR_TASKLETS]; 12 | } dpu_arguments_t; 13 | 14 | // Specific information for each DPU 15 | struct dpu_info_t { 16 | uint32_t rows_per_dpu; 17 | uint32_t rows_per_dpu_pad; 18 | uint32_t prev_rows_dpu; 19 | }; 20 | struct dpu_info_t *dpu_info; 21 | 22 | // Transfer size between MRAM and WRAM 23 | #ifdef BL 24 | #define BLOCK_SIZE_LOG2 BL 25 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 26 | #else 27 | #define BLOCK_SIZE_LOG2 8 28 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 29 | #define BL BLOCK_SIZE_LOG2 30 | #endif 31 | 32 | // Data type 33 | #ifdef INT32 34 | #define T int32_t 35 | #define MUL 2 // Shift left to divide by sizeof(T) 36 | #define DIV 2 // Shift right to divide by sizeof(T) 37 | #elif FLOAT 38 | #define T float 39 | #define MUL 2 // Shift left to divide by sizeof(T) 40 | #define DIV 2 // Shift right to divide by sizeof(T) 41 | #endif 42 | 43 | #ifndef ENERGY 44 | #define ENERGY 0 45 | #endif 46 | #define PRINT 0 47 | 48 | #define ANSI_COLOR_RED "\x1b[31m" 49 | #define ANSI_COLOR_GREEN "\x1b[32m" 50 | #define ANSI_COLOR_RESET "\x1b[0m" 51 | 52 | #define divceil(n, m) (((n)-1) / (m) + 1) 53 | #define roundup(n, m) ((n / m) * m + m) 54 | 55 | // fixed point arithmetic 56 | #define SHIFT_AMOUNT 11 57 | #define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) 58 | 59 | // avoid overflow 60 | #define OFFSET 0 61 | #define OVERFLOW_SHIFT (SHIFT_AMOUNT + OFFSET) 62 | 63 | #define MAX_ROWS 24 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int32_float/support/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H_ 2 | #define _COMMON_H_ 3 | 4 | // Structures used by both the host and the dpu to communicate information 5 | typedef struct { 6 | uint32_t n_size; 7 | uint32_t n_size_pad; 8 | uint32_t nr_rows; 9 | uint32_t max_rows; 10 | uint32_t start_row[NR_TASKLETS]; 11 | uint32_t rows_per_tasklet[NR_TASKLETS]; 12 | } dpu_arguments_t; 13 | 14 | // Specific information for each DPU 15 | struct dpu_info_t { 16 | uint32_t rows_per_dpu; 17 | uint32_t rows_per_dpu_pad; 18 | uint32_t prev_rows_dpu; 19 | }; 20 | struct dpu_info_t *dpu_info; 21 | 22 | // Transfer size between MRAM and WRAM 23 | #ifdef BL 24 | #define BLOCK_SIZE_LOG2 BL 25 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 26 | #else 27 | #define BLOCK_SIZE_LOG2 8 28 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 29 | #define BL BLOCK_SIZE_LOG2 30 | #endif 31 | 32 | // Data type 33 | #ifdef INT32 34 | #define T int32_t 35 | #define MUL 2 // Shift left to divide by sizeof(T) 36 | #define DIV 2 // Shift right to divide by sizeof(T) 37 | #elif FLOAT 38 | #define T float 39 | #define MUL 2 // Shift left to divide by sizeof(T) 40 | #define DIV 2 // Shift right to divide by sizeof(T) 41 | #endif 42 | 43 | #ifndef ENERGY 44 | #define ENERGY 0 45 | #endif 46 | #define PRINT 0 47 | 48 | #define ANSI_COLOR_RED "\x1b[31m" 49 | #define ANSI_COLOR_GREEN "\x1b[32m" 50 | #define ANSI_COLOR_RESET "\x1b[0m" 51 | 52 | #define divceil(n, m) (((n)-1) / (m) + 1) 53 | #define roundup(n, m) ((n / m) * m + m) 54 | 55 | // fixed point arithmetic 56 | #define SHIFT_AMOUNT 11 57 | #define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) 58 | 59 | // avoid overflow 60 | #define OFFSET 0 61 | #define OVERFLOW_SHIFT (SHIFT_AMOUNT + OFFSET) 62 | 63 | #define MAX_ROWS 24 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_SUSY_quantization/LogReg_int32_SUSY/support/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H_ 2 | #define _COMMON_H_ 3 | 4 | // Structures used by both the host and the dpu to communicate information 5 | typedef struct { 6 | uint32_t n_size; 7 | uint32_t n_size_pad; 8 | uint32_t nr_rows; 9 | uint32_t max_rows; 10 | uint32_t start_row[NR_TASKLETS]; 11 | uint32_t rows_per_tasklet[NR_TASKLETS]; 12 | } dpu_arguments_t; 13 | 14 | // Specific information for each DPU 15 | struct dpu_info_t { 16 | uint32_t rows_per_dpu; 17 | uint32_t rows_per_dpu_pad; 18 | uint32_t prev_rows_dpu; 19 | }; 20 | struct dpu_info_t *dpu_info; 21 | 22 | // Transfer size between MRAM and WRAM 23 | #ifdef BL 24 | #if (BL == 0) 25 | #define BLOCK_SIZE 288 26 | #else 27 | #define BLOCK_SIZE_LOG2 BL 28 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 29 | #endif 30 | #else 31 | #define BLOCK_SIZE_LOG2 8 32 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 33 | #define BL BLOCK_SIZE_LOG2 34 | #endif 35 | 36 | // Data type 37 | #ifdef INT32 38 | #define T int32_t 39 | #define MUL 2 // Shift left to divide by sizeof(T) 40 | #define DIV 2 // Shift right to divide by sizeof(T) 41 | #endif 42 | 43 | #ifndef ENERGY 44 | #define ENERGY 0 45 | #endif 46 | #define PRINT 0 47 | 48 | #define ANSI_COLOR_RED "\x1b[31m" 49 | #define ANSI_COLOR_GREEN "\x1b[32m" 50 | #define ANSI_COLOR_RESET "\x1b[0m" 51 | 52 | #define divceil(n, m) (((n)-1) / (m) + 1) 53 | #define roundup(n, m) ((n / m) * m + m) 54 | 55 | // fixed point arithmetic 56 | #define SHIFT_AMOUNT 10 57 | #define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) 58 | 59 | // avoid overflow 60 | #define OFFSET 0 61 | #define OVERFLOW_SHIFT (SHIFT_AMOUNT + OFFSET) 62 | 63 | #define MAX_ROWS 24 64 | 65 | #define SIGMOID_BOUNDARY 20 66 | #define LUT_SIZE (SIGMOID_BOUNDARY< iteration time (default=600)" 22 | "\n -l learning rate (default=0.002)" 23 | "\n -m m_size (default=5000000)" 24 | "\n -n n_size (default=18, max=24)" 25 | "\n"); 26 | } 27 | 28 | struct Params input_params(int argc, char **argv) { 29 | struct Params p; 30 | 31 | p.iter_time = 600; 32 | p.learning_rate = 0.002; 33 | p.m_size = 5000000; 34 | p.n_size = 18; 35 | 36 | int opt; 37 | while((opt = getopt(argc, argv, "hi:l:m:n:")) >= 0) { 38 | switch(opt) { 39 | case 'h': 40 | usage(); 41 | exit(0); 42 | break; 43 | case 'i': p.iter_time = atoi(optarg); break; 44 | case 'l': p.learning_rate = atof(optarg); break; 45 | case 'm': p.m_size = atoi(optarg); break; 46 | case 'n': p.n_size = atoi(optarg); break; 47 | default: 48 | fprintf(stderr, "\nUnrecognized option!\n"); 49 | usage(); 50 | exit(0); 51 | } 52 | } 53 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 54 | if (p.n_size > MAX_ROWS) { 55 | printf("max num of rows is %d!\n", MAX_ROWS); 56 | exit(0); 57 | } 58 | 59 | return p; 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int32LUTMRAM_float/support/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H_ 2 | #define _COMMON_H_ 3 | 4 | // Structures used by both the host and the dpu to communicate information 5 | typedef struct { 6 | uint32_t n_size; 7 | uint32_t n_size_pad; 8 | uint32_t nr_rows; 9 | uint32_t max_rows; 10 | uint32_t start_row[NR_TASKLETS]; 11 | uint32_t rows_per_tasklet[NR_TASKLETS]; 12 | } dpu_arguments_t; 13 | 14 | // Specific information for each DPU 15 | struct dpu_info_t { 16 | uint32_t rows_per_dpu; 17 | uint32_t rows_per_dpu_pad; 18 | uint32_t prev_rows_dpu; 19 | }; 20 | struct dpu_info_t *dpu_info; 21 | 22 | // Transfer size between MRAM and WRAM 23 | #ifdef BL 24 | #define BLOCK_SIZE_LOG2 BL 25 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 26 | #else 27 | #define BLOCK_SIZE_LOG2 8 28 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 29 | #define BL BLOCK_SIZE_LOG2 30 | #endif 31 | 32 | // Data type 33 | #ifdef INT32 34 | #define T int32_t 35 | #define MUL 2 // Shift left to divide by sizeof(T) 36 | #define DIV 2 // Shift right to divide by sizeof(T) 37 | #elif FLOAT 38 | #define T float 39 | #define MUL 2 // Shift left to divide by sizeof(T) 40 | #define DIV 2 // Shift right to divide by sizeof(T) 41 | #endif 42 | 43 | #ifndef ENERGY 44 | #define ENERGY 0 45 | #endif 46 | #define PRINT 0 47 | 48 | #define ANSI_COLOR_RED "\x1b[31m" 49 | #define ANSI_COLOR_GREEN "\x1b[32m" 50 | #define ANSI_COLOR_RESET "\x1b[0m" 51 | 52 | #define divceil(n, m) (((n)-1) / (m) + 1) 53 | #define roundup(n, m) ((n / m) * m + m) 54 | 55 | // fixed point arithmetic 56 | #define SHIFT_AMOUNT 11 57 | #define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) 58 | 59 | // avoid overflow 60 | #define OFFSET 0 61 | #define OVERFLOW_SHIFT (SHIFT_AMOUNT + OFFSET) 62 | 63 | #define MAX_ROWS 24 64 | 65 | #define SIGMOID_BOUNDARY 20 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_SUSY_quantization/LogReg_int8_builtin_SUSY/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | }Params; 12 | 13 | static void usage() { 14 | fprintf(stderr, 15 | "\nUsage: ./program [options]" 16 | "\n" 17 | "\nGeneral options:" 18 | "\n -h help" 19 | "\n" 20 | "\nBenchmark-specific options:" 21 | "\n -i iteration time (default=600)" 22 | "\n -l learning rate (default=0.002)" 23 | "\n -m m_size (default=5000000)" 24 | "\n -n n_size (default=18, max=24)" 25 | "\n"); 26 | } 27 | 28 | struct Params input_params(int argc, char **argv) { 29 | struct Params p; 30 | 31 | p.iter_time = 600; 32 | p.learning_rate = 0.002; 33 | p.m_size = 5000000; 34 | p.n_size = 18; 35 | 36 | int opt; 37 | while((opt = getopt(argc, argv, "hi:l:m:n:")) >= 0) { 38 | switch(opt) { 39 | case 'h': 40 | usage(); 41 | exit(0); 42 | break; 43 | case 'i': p.iter_time = atoi(optarg); break; 44 | case 'l': p.learning_rate = atof(optarg); break; 45 | case 'm': p.m_size = atoi(optarg); break; 46 | case 'n': p.n_size = atoi(optarg); break; 47 | default: 48 | fprintf(stderr, "\nUnrecognized option!\n"); 49 | usage(); 50 | exit(0); 51 | } 52 | } 53 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 54 | if (p.n_size > MAX_ROWS) { 55 | printf("max num of rows is %d!\n", MAX_ROWS); 56 | exit(0); 57 | } 58 | 59 | return p; 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_SUSY_quantization/LogReg_int32_SUSY/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | }Params; 12 | 13 | static void usage() { 14 | fprintf(stderr, 15 | "\nUsage: ./program [options]" 16 | "\n" 17 | "\nGeneral options:" 18 | "\n -h help" 19 | "\n" 20 | "\nBenchmark-specific options:" 21 | "\n -i iteration time (default=350)" 22 | "\n -l learning rate (default=0.0000001)" 23 | "\n -m m_size (default=5000000)" 24 | "\n -n n_size (default=18, max=24)" 25 | "\n"); 26 | } 27 | 28 | struct Params input_params(int argc, char **argv) { 29 | struct Params p; 30 | 31 | p.iter_time = 350; 32 | p.learning_rate = 0.0000001; 33 | p.m_size = 5000000; 34 | p.n_size = 18; 35 | 36 | int opt; 37 | while((opt = getopt(argc, argv, "hi:l:m:n:")) >= 0) { 38 | switch(opt) { 39 | case 'h': 40 | usage(); 41 | exit(0); 42 | break; 43 | case 'i': p.iter_time = atoi(optarg); break; 44 | case 'l': p.learning_rate = atof(optarg); break; 45 | case 'm': p.m_size = atoi(optarg); break; 46 | case 'n': p.n_size = atoi(optarg); break; 47 | default: 48 | fprintf(stderr, "\nUnrecognized option!\n"); 49 | usage(); 50 | exit(0); 51 | } 52 | } 53 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 54 | if (p.n_size > MAX_ROWS) { 55 | printf("max num of rows is %d!\n", MAX_ROWS); 56 | exit(0); 57 | } 58 | 59 | return p; 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int32LUT_float/support/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H_ 2 | #define _COMMON_H_ 3 | 4 | // Structures used by both the host and the dpu to communicate information 5 | typedef struct { 6 | uint32_t n_size; 7 | uint32_t n_size_pad; 8 | uint32_t nr_rows; 9 | uint32_t max_rows; 10 | uint32_t start_row[NR_TASKLETS]; 11 | uint32_t rows_per_tasklet[NR_TASKLETS]; 12 | } dpu_arguments_t; 13 | 14 | // Specific information for each DPU 15 | struct dpu_info_t { 16 | uint32_t rows_per_dpu; 17 | uint32_t rows_per_dpu_pad; 18 | uint32_t prev_rows_dpu; 19 | }; 20 | struct dpu_info_t *dpu_info; 21 | 22 | // Transfer size between MRAM and WRAM 23 | #ifdef BL 24 | #define BLOCK_SIZE_LOG2 BL 25 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 26 | #else 27 | #define BLOCK_SIZE_LOG2 8 28 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 29 | #define BL BLOCK_SIZE_LOG2 30 | #endif 31 | 32 | // Data type 33 | #ifdef INT32 34 | #define T int32_t 35 | #define MUL 2 // Shift left to divide by sizeof(T) 36 | #define DIV 2 // Shift right to divide by sizeof(T) 37 | #elif FLOAT 38 | #define T float 39 | #define MUL 2 // Shift left to divide by sizeof(T) 40 | #define DIV 2 // Shift right to divide by sizeof(T) 41 | #endif 42 | 43 | #ifndef ENERGY 44 | #define ENERGY 0 45 | #endif 46 | #define PRINT 0 47 | 48 | #define ANSI_COLOR_RED "\x1b[31m" 49 | #define ANSI_COLOR_GREEN "\x1b[32m" 50 | #define ANSI_COLOR_RESET "\x1b[0m" 51 | 52 | #define divceil(n, m) (((n)-1) / (m) + 1) 53 | #define roundup(n, m) ((n / m) * m + m) 54 | 55 | // fixed point arithmetic 56 | #define SHIFT_AMOUNT 10 57 | #define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) 58 | 59 | // avoid overflow 60 | #define OFFSET 0 61 | #define OVERFLOW_SHIFT (SHIFT_AMOUNT + OFFSET) 62 | 63 | #define MAX_ROWS 24 64 | 65 | #define SIGMOID_BOUNDARY 20 66 | #define LUT_SIZE (SIGMOID_BOUNDARY< iteration time (default=500)" 25 | "\n -l learning rate (default=0.2)" 26 | "\n -m m_size (default=5000000)" 27 | "\n -n n_size (default=18, max=18)" 28 | "\n"); 29 | } 30 | 31 | struct Params input_params(int argc, char **argv) { 32 | struct Params p; 33 | 34 | p.iter_time = 500; 35 | p.learning_rate = 0.2; 36 | p.m_size = 5000000; 37 | p.n_size = 18; 38 | 39 | p.n_warmup = 1; 40 | p.n_reps = 3; 41 | p.exp = 1; 42 | 43 | int opt; 44 | while((opt = getopt(argc, argv, "hi:l:m:n:")) >= 0) { 45 | switch(opt) { 46 | case 'h': 47 | usage(); 48 | exit(0); 49 | break; 50 | case 'i': p.iter_time = atoi(optarg); break; 51 | case 'l': p.learning_rate = atof(optarg); break; 52 | case 'm': p.m_size = atoi(optarg); break; 53 | case 'n': p.n_size = atoi(optarg); break; 54 | default: 55 | fprintf(stderr, "\nUnrecognized option!\n"); 56 | usage(); 57 | exit(0); 58 | } 59 | } 60 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 61 | if (p.n_size > MAX_ROWS) { 62 | printf("Max num of rows is %d!\n", MAX_ROWS); 63 | exit(0); 64 | } 65 | 66 | return p; 67 | } 68 | #endif 69 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_SUSY_quantization/LogReg_int32_SUSY/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n" 23 | "\nBenchmark-specific options:" 24 | "\n -i iteration time (default=500)" 25 | "\n -l learning rate (default=0.01)" 26 | "\n -m m_size (default=5000000)" 27 | "\n -n n_size (default=18, max=18)" 28 | "\n"); 29 | } 30 | 31 | struct Params input_params(int argc, char **argv) { 32 | struct Params p; 33 | 34 | p.iter_time = 500; 35 | p.learning_rate = 0.01; 36 | p.m_size = 5000000; 37 | p.n_size = 18; 38 | 39 | p.n_warmup = 1; 40 | p.n_reps = 3; 41 | p.exp = 1; 42 | 43 | int opt; 44 | while((opt = getopt(argc, argv, "hi:l:m:n:")) >= 0) { 45 | switch(opt) { 46 | case 'h': 47 | usage(); 48 | exit(0); 49 | break; 50 | case 'i': p.iter_time = atoi(optarg); break; 51 | case 'l': p.learning_rate = atof(optarg); break; 52 | case 'm': p.m_size = atoi(optarg); break; 53 | case 'n': p.n_size = atoi(optarg); break; 54 | default: 55 | fprintf(stderr, "\nUnrecognized option!\n"); 56 | usage(); 57 | exit(0); 58 | } 59 | } 60 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 61 | if (p.n_size > MAX_ROWS) { 62 | printf("Max num of rows is %d!\n", MAX_ROWS); 63 | exit(0); 64 | } 65 | 66 | return p; 67 | } 68 | #endif 69 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int8/support/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H_ 2 | #define _COMMON_H_ 3 | 4 | // Structures used by both the host and the dpu to communicate information 5 | typedef struct { 6 | uint32_t n_size; 7 | uint32_t n_size_pad; 8 | uint32_t nr_rows; 9 | uint32_t max_rows; 10 | uint32_t start_row[NR_TASKLETS]; 11 | uint32_t rows_per_tasklet[NR_TASKLETS]; 12 | } dpu_arguments_t; 13 | 14 | // Specific information for each DPU 15 | struct dpu_info_t { 16 | uint32_t rows_per_dpu; 17 | uint32_t rows_per_dpu_pad; 18 | uint32_t prev_rows_dpu; 19 | }; 20 | struct dpu_info_t *dpu_info; 21 | 22 | // Transfer size between MRAM and WRAM 23 | #ifdef BL 24 | #define BLOCK_SIZE_LOG2 BL 25 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 26 | #else 27 | #define BLOCK_SIZE_LOG2 8 28 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 29 | #define BL BLOCK_SIZE_LOG2 30 | #endif 31 | 32 | // Data type 33 | // #ifdef UINT32 34 | // #define T uint32_t 35 | // #define DIV 2 // Shift right to divide by sizeof(T) 36 | // #elif UINT64 37 | // #define T uint64_t 38 | // #define DIV 3 // Shift right to divide by sizeof(T) 39 | // #elif INT32 40 | // #define T int32_t 41 | // #define DIV 2 // Shift right to divide by sizeof(T) 42 | // #elif INT64 43 | // #define T int64_t 44 | // #define DIV 3 // Shift right to divide by sizeof(T) 45 | #ifdef INT8 46 | #define T int8_t 47 | #define DIV 0 // Shift right to divide by sizeof(T) 48 | #define MUL 0 // Shift left to multiply by sizeof(T) 49 | // #elif SHORT 50 | // #define T short 51 | // #define DIV 1 // Shift right to divide by sizeof(T) 52 | #endif 53 | 54 | #ifndef ENERGY 55 | #define ENERGY 0 56 | #endif 57 | #define PRINT 0 58 | 59 | #define ANSI_COLOR_RED "\x1b[31m" 60 | #define ANSI_COLOR_GREEN "\x1b[32m" 61 | #define ANSI_COLOR_RESET "\x1b[0m" 62 | 63 | #define divceil(n, m) (((n)-1) / (m) + 1) 64 | #define roundup(n, m) ((n / m) * m + m) 65 | 66 | // fixed point arithmetic 67 | #define SHIFT_AMOUNT 10 68 | #define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) 69 | 70 | // avoid overflow 71 | #define OFFSET 6 72 | #define OVERFLOW_SHIFT (SHIFT_AMOUNT + OFFSET) 73 | 74 | #define MAX_ROWS 16 75 | 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int32_float/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n" 23 | "\nBenchmark-specific options:" 24 | "\n -i iteration time (default=100)" 25 | "\n -l learning rate (default=0.1)" 26 | "\n -m m_size (default=8192)" 27 | "\n -n n_size (default=16, max=16)" 28 | "\n"); 29 | } 30 | 31 | struct Params input_params(int argc, char **argv) { 32 | struct Params p; 33 | 34 | p.iter_time = 100; 35 | p.learning_rate = 0.1; 36 | p.m_size = 8192; 37 | p.n_size = 16; 38 | 39 | // p.n_warmup = 1; 40 | // p.n_reps = 3; 41 | // p.exp = 1; 42 | 43 | int opt; 44 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 45 | switch(opt) { 46 | case 'h': 47 | usage(); 48 | exit(0); 49 | break; 50 | case 'i': p.iter_time = atoi(optarg); break; 51 | case 'l': p.learning_rate = atof(optarg); break; 52 | case 'm': p.m_size = atoi(optarg); break; 53 | case 'n': p.n_size = atoi(optarg); break; 54 | case 'w': p.n_warmup = atoi(optarg); break; 55 | case 'e': p.n_reps = atoi(optarg); break; 56 | case 'x': p.exp = atoi(optarg); break; 57 | default: 58 | fprintf(stderr, "\nUnrecognized option!\n"); 59 | usage(); 60 | exit(0); 61 | } 62 | } 63 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 64 | if (p.n_size > MAX_ROWS) { 65 | printf("Max num of rows is 16!\n"); 66 | exit(0); 67 | } 68 | 69 | return p; 70 | } 71 | #endif 72 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_SUSY_quantization/LogReg_int8_SUSY/support/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H_ 2 | #define _COMMON_H_ 3 | 4 | // Structures used by both the host and the dpu to communicate information 5 | typedef struct { 6 | uint32_t n_size; 7 | uint32_t n_size_pad; 8 | uint32_t nr_rows; 9 | uint32_t max_rows; 10 | uint32_t start_row[NR_TASKLETS]; 11 | uint32_t rows_per_tasklet[NR_TASKLETS]; 12 | } dpu_arguments_t; 13 | 14 | // Specific information for each DPU 15 | struct dpu_info_t { 16 | uint32_t rows_per_dpu; 17 | uint32_t rows_per_dpu_pad; 18 | uint32_t prev_rows_dpu; 19 | }; 20 | struct dpu_info_t *dpu_info; 21 | 22 | // Transfer size between MRAM and WRAM 23 | #ifdef BL 24 | #define BLOCK_SIZE_LOG2 BL 25 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 26 | #else 27 | #define BLOCK_SIZE_LOG2 8 28 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 29 | #define BL BLOCK_SIZE_LOG2 30 | #endif 31 | 32 | // Data type 33 | // #ifdef UINT32 34 | // #define T uint32_t 35 | // #define DIV 2 // Shift right to divide by sizeof(T) 36 | // #elif UINT64 37 | // #define T uint64_t 38 | // #define DIV 3 // Shift right to divide by sizeof(T) 39 | // #elif INT32 40 | // #define T int32_t 41 | // #define DIV 2 // Shift right to divide by sizeof(T) 42 | // #elif INT64 43 | // #define T int64_t 44 | // #define DIV 3 // Shift right to divide by sizeof(T) 45 | #ifdef INT8 46 | #define T int8_t 47 | #define DIV 0 // Shift right to divide by sizeof(T) 48 | #define MUL 0 // Shift left to multiply by sizeof(T) 49 | // #elif SHORT 50 | // #define T short 51 | // #define DIV 1 // Shift right to divide by sizeof(T) 52 | #endif 53 | 54 | #ifndef ENERGY 55 | #define ENERGY 0 56 | #endif 57 | #define PRINT 0 58 | 59 | #define ANSI_COLOR_RED "\x1b[31m" 60 | #define ANSI_COLOR_GREEN "\x1b[32m" 61 | #define ANSI_COLOR_RESET "\x1b[0m" 62 | 63 | #define divceil(n, m) (((n)-1) / (m) + 1) 64 | #define roundup(n, m) ((n / m) * m + m) 65 | 66 | // // fixed point arithmetic 67 | // #define SHIFT_AMOUNT 1000 68 | 69 | // // avoid overflow 70 | // #define OVERFLOW_SHIFT 3 71 | // #define OVERFLOW_MASK (1 << OVERFLOW_SHIFT) 72 | 73 | // fixed point arithmetic 74 | #define SHIFT_AMOUNT 10 75 | #define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) 76 | 77 | // avoid overflow 78 | #define OFFSET 0 79 | #define OVERFLOW_SHIFT (SHIFT_AMOUNT + OFFSET) 80 | 81 | #define MAX_ROWS 24 82 | 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int8_builtin/support/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H_ 2 | #define _COMMON_H_ 3 | 4 | // Structures used by both the host and the dpu to communicate information 5 | typedef struct { 6 | uint32_t n_size; 7 | uint32_t n_size_pad; 8 | uint32_t nr_rows; 9 | uint32_t max_rows; 10 | uint32_t start_row[NR_TASKLETS]; 11 | uint32_t rows_per_tasklet[NR_TASKLETS]; 12 | } dpu_arguments_t; 13 | 14 | // Specific information for each DPU 15 | struct dpu_info_t { 16 | uint32_t rows_per_dpu; 17 | uint32_t rows_per_dpu_pad; 18 | uint32_t prev_rows_dpu; 19 | }; 20 | struct dpu_info_t *dpu_info; 21 | 22 | // Transfer size between MRAM and WRAM 23 | #ifdef BL 24 | #define BLOCK_SIZE_LOG2 BL 25 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 26 | #else 27 | #define BLOCK_SIZE_LOG2 8 28 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 29 | #define BL BLOCK_SIZE_LOG2 30 | #endif 31 | 32 | // Data type 33 | // #ifdef UINT32 34 | // #define T uint32_t 35 | // #define DIV 2 // Shift right to divide by sizeof(T) 36 | // #elif UINT64 37 | // #define T uint64_t 38 | // #define DIV 3 // Shift right to divide by sizeof(T) 39 | // #elif INT32 40 | // #define T int32_t 41 | // #define DIV 2 // Shift right to divide by sizeof(T) 42 | // #elif INT64 43 | // #define T int64_t 44 | // #define DIV 3 // Shift right to divide by sizeof(T) 45 | #ifdef INT8 46 | #define T int8_t 47 | #define DIV 0 // Shift right to divide by sizeof(T) 48 | #define MUL 0 // Shift left to multiply by sizeof(T) 49 | // #elif SHORT 50 | // #define T short 51 | // #define DIV 1 // Shift right to divide by sizeof(T) 52 | #endif 53 | 54 | #ifndef ENERGY 55 | #define ENERGY 0 56 | #endif 57 | #define PRINT 0 58 | 59 | #define ANSI_COLOR_RED "\x1b[31m" 60 | #define ANSI_COLOR_GREEN "\x1b[32m" 61 | #define ANSI_COLOR_RESET "\x1b[0m" 62 | 63 | #define divceil(n, m) (((n)-1) / (m) + 1) 64 | #define roundup(n, m) ((n / m) * m + m) 65 | 66 | // // fixed point arithmetic 67 | // #define SHIFT_AMOUNT 1000 68 | 69 | // // avoid overflow 70 | // #define OVERFLOW_SHIFT 3 71 | // #define OVERFLOW_MASK (1 << OVERFLOW_SHIFT) 72 | 73 | // fixed point arithmetic 74 | #define SHIFT_AMOUNT 10 75 | #define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) 76 | 77 | // avoid overflow 78 | #define OFFSET 3 79 | #define OVERFLOW_SHIFT (SHIFT_AMOUNT + OFFSET) 80 | 81 | #define MAX_ROWS 16 82 | 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_SUSY_quantization/LogReg_int8_builtin_SUSY/support/common.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_H_ 2 | #define _COMMON_H_ 3 | 4 | // Structures used by both the host and the dpu to communicate information 5 | typedef struct { 6 | uint32_t n_size; 7 | uint32_t n_size_pad; 8 | uint32_t nr_rows; 9 | uint32_t max_rows; 10 | uint32_t start_row[NR_TASKLETS]; 11 | uint32_t rows_per_tasklet[NR_TASKLETS]; 12 | } dpu_arguments_t; 13 | 14 | // Specific information for each DPU 15 | struct dpu_info_t { 16 | uint32_t rows_per_dpu; 17 | uint32_t rows_per_dpu_pad; 18 | uint32_t prev_rows_dpu; 19 | }; 20 | struct dpu_info_t *dpu_info; 21 | 22 | // Transfer size between MRAM and WRAM 23 | #ifdef BL 24 | #define BLOCK_SIZE_LOG2 BL 25 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 26 | #else 27 | #define BLOCK_SIZE_LOG2 8 28 | #define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2) 29 | #define BL BLOCK_SIZE_LOG2 30 | #endif 31 | 32 | // Data type 33 | // #ifdef UINT32 34 | // #define T uint32_t 35 | // #define DIV 2 // Shift right to divide by sizeof(T) 36 | // #elif UINT64 37 | // #define T uint64_t 38 | // #define DIV 3 // Shift right to divide by sizeof(T) 39 | // #elif INT32 40 | // #define T int32_t 41 | // #define DIV 2 // Shift right to divide by sizeof(T) 42 | // #elif INT64 43 | // #define T int64_t 44 | // #define DIV 3 // Shift right to divide by sizeof(T) 45 | #ifdef INT8 46 | #define T int8_t 47 | #define DIV 0 // Shift right to divide by sizeof(T) 48 | #define MUL 0 // Shift left to multiply by sizeof(T) 49 | // #elif SHORT 50 | // #define T short 51 | // #define DIV 1 // Shift right to divide by sizeof(T) 52 | #endif 53 | 54 | #ifndef ENERGY 55 | #define ENERGY 0 56 | #endif 57 | #define PRINT 0 58 | 59 | #define ANSI_COLOR_RED "\x1b[31m" 60 | #define ANSI_COLOR_GREEN "\x1b[32m" 61 | #define ANSI_COLOR_RESET "\x1b[0m" 62 | 63 | #define divceil(n, m) (((n)-1) / (m) + 1) 64 | #define roundup(n, m) ((n / m) * m + m) 65 | 66 | // // fixed point arithmetic 67 | // #define SHIFT_AMOUNT 1000 68 | 69 | // // avoid overflow 70 | // #define OVERFLOW_SHIFT 3 71 | // #define OVERFLOW_MASK (1 << OVERFLOW_SHIFT) 72 | 73 | // fixed point arithmetic 74 | #define SHIFT_AMOUNT 10 75 | #define SHIFT_MASK ((1 << SHIFT_AMOUNT) - 1) 76 | 77 | // avoid overflow 78 | #define OFFSET 0 79 | #define OVERFLOW_SHIFT (SHIFT_AMOUNT + OFFSET) 80 | 81 | #define MAX_ROWS 24 82 | 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int8/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.0001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("max num of rows is 16!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int8/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.0001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("max num of rows is 16!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int8/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("Max num of rows is 16!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int8_builtin/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.0001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("max num of rows is 16!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int8/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("Max num of rows is 16!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int32_float/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.0001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("Max num of rows is 16!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int8_builtin/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.0001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("max num of rows is 16!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int32_float/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.0001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("Max num of rows is 24!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int8_builtin/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("Max num of rows is 16!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int32LUT_float/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("Max num of rows is 24!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int32_float/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.0001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("Max num of rows is 24!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int8_builtin/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("Max num of rows is 16!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int32LUTMRAM_float/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("Max num of rows is 24!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int32LUT_float/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("Max num of rows is 24!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int32LUTMRAM_float/support/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | #include "common.h" 5 | 6 | typedef struct Params { 7 | unsigned int iter_time; 8 | float learning_rate; 9 | unsigned int m_size; 10 | unsigned int n_size; 11 | int n_warmup; 12 | int n_reps; 13 | int exp; 14 | }Params; 15 | 16 | static void usage() { 17 | fprintf(stderr, 18 | "\nUsage: ./program [options]" 19 | "\n" 20 | "\nGeneral options:" 21 | "\n -h help" 22 | "\n -w # of untimed warmup iterations (default=1)" 23 | "\n -e # of timed repetition iterations (default=3)" 24 | "\n -x Weak (0) or strong (1) scaling (default=0)" 25 | "\n" 26 | "\nBenchmark-specific options:" 27 | "\n -i iteration time (default=100)" 28 | "\n -l learning rate (default=0.0001)" 29 | "\n -m m_size (default=8192)" 30 | "\n -n n_size (default=16, max=16)" 31 | "\n"); 32 | } 33 | 34 | struct Params input_params(int argc, char **argv) { 35 | struct Params p; 36 | 37 | p.iter_time = 100; 38 | p.learning_rate = 0.001; 39 | p.m_size = 8192; 40 | p.n_size = 16; 41 | 42 | p.n_warmup = 1; 43 | p.n_reps = 3; 44 | p.exp = 1; 45 | 46 | int opt; 47 | while((opt = getopt(argc, argv, "hi:l:m:n:w:e:x:")) >= 0) { 48 | switch(opt) { 49 | case 'h': 50 | usage(); 51 | exit(0); 52 | break; 53 | case 'i': p.iter_time = atoi(optarg); break; 54 | case 'l': p.learning_rate = atof(optarg); break; 55 | case 'm': p.m_size = atoi(optarg); break; 56 | case 'n': p.n_size = atoi(optarg); break; 57 | case 'w': p.n_warmup = atoi(optarg); break; 58 | case 'e': p.n_reps = atoi(optarg); break; 59 | case 'x': p.exp = atoi(optarg); break; 60 | default: 61 | fprintf(stderr, "\nUnrecognized option!\n"); 62 | usage(); 63 | exit(0); 64 | } 65 | } 66 | assert(NR_DPUS > 0 && "Invalid # of dpus!"); 67 | if (p.n_size > MAX_ROWS) { 68 | printf("Max num of rows is 24!\n"); 69 | exit(0); 70 | } 71 | 72 | return p; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Linear_Regression/Baseline/CPU_MKL/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | // #include "common.h" 5 | #include 6 | 7 | typedef struct Params { 8 | unsigned int iter_time; 9 | float learning_rate; 10 | unsigned int m_size; 11 | unsigned int n_size; 12 | unsigned int thread_num; 13 | // int n_warmup; 14 | // int n_reps; 15 | // int exp; 16 | }Params; 17 | 18 | static void usage() { 19 | fprintf(stderr, 20 | "\nUsage: ./program [options]" 21 | // "\n" 22 | // "\nGeneral options:" 23 | // "\n -h help" 24 | // "\n -w # of untimed warmup iterations (default=1)" 25 | // "\n -e # of timed repetition iterations (default=3)" 26 | // "\n -x Weak (0) or strong (1) scaling (default=0)" 27 | "\n" 28 | "\nBenchmark-specific options:" 29 | "\n -t thread number (default=1)" 30 | "\n -i iteration time (default=100)" 31 | "\n -l learning rate (default=0.0001)" 32 | "\n -m m_size (default=8192)" 33 | "\n -n n_size (default=16, max=16)" 34 | "\n"); 35 | } 36 | 37 | struct Params input_params(int argc, char **argv) { 38 | struct Params p; 39 | 40 | p.iter_time = 100; 41 | p.learning_rate = 0.0001; 42 | p.m_size = 8192; 43 | p.n_size = 16; 44 | p.thread_num = 1; 45 | 46 | // p.n_warmup = 1; 47 | // p.n_reps = 3; 48 | // p.exp = 1; 49 | 50 | int opt; 51 | while((opt = getopt(argc, argv, "ht:i:l:m:n:")) >= 0) { 52 | switch(opt) { 53 | case 'h': 54 | usage(); 55 | exit(0); 56 | break; 57 | case 't': p.thread_num = atoi(optarg); break; 58 | case 'i': p.iter_time = atoi(optarg); break; 59 | case 'l': p.learning_rate = atof(optarg); break; 60 | case 'm': p.m_size = atoi(optarg); break; 61 | case 'n': p.n_size = atoi(optarg); break; 62 | // case 'w': p.n_warmup = atoi(optarg); break; 63 | // case 'e': p.n_reps = atoi(optarg); break; 64 | // case 'x': p.exp = atoi(optarg); break; 65 | default: 66 | fprintf(stderr, "\nUnrecognized option!\n"); 67 | usage(); 68 | exit(0); 69 | } 70 | } 71 | // assert(NR_DPUS > 0 && "Invalid # of dpus!"); 72 | // if (p.n_size > MAX_ROWS) { 73 | // printf("max num of rows is 16!\n"); 74 | // exit(0); 75 | // } 76 | 77 | return p; 78 | } 79 | #endif 80 | -------------------------------------------------------------------------------- /Logistic_Regression/Baseline/CPU_MKL/params.h: -------------------------------------------------------------------------------- 1 | #ifndef _PARAMS_H_ 2 | #define _PARAMS_H_ 3 | 4 | // #include "common.h" 5 | #include 6 | 7 | typedef struct Params { 8 | unsigned int iter_time; 9 | float learning_rate; 10 | unsigned int m_size; 11 | unsigned int n_size; 12 | unsigned int thread_num; 13 | // int n_warmup; 14 | // int n_reps; 15 | // int exp; 16 | }Params; 17 | 18 | static void usage() { 19 | fprintf(stderr, 20 | "\nUsage: ./program [options]" 21 | // "\n" 22 | // "\nGeneral options:" 23 | // "\n -h help" 24 | // "\n -w # of untimed warmup iterations (default=1)" 25 | // "\n -e # of timed repetition iterations (default=3)" 26 | // "\n -x Weak (0) or strong (1) scaling (default=0)" 27 | "\n" 28 | "\nBenchmark-specific options:" 29 | "\n -t thread number (default=auto)" 30 | "\n -i iteration time (default=100)" 31 | "\n -l learning rate (default=0.001)" 32 | "\n -m m_size (default=8192)" 33 | "\n -n n_size (default=16, max=16)" 34 | "\n"); 35 | } 36 | 37 | struct Params input_params(int argc, char **argv) { 38 | struct Params p; 39 | 40 | p.iter_time = 100; 41 | p.learning_rate = 0.001; 42 | p.m_size = 8192; 43 | p.n_size = 16; 44 | p.thread_num = 0; 45 | 46 | // p.n_warmup = 1; 47 | // p.n_reps = 3; 48 | // p.exp = 1; 49 | 50 | int opt; 51 | while((opt = getopt(argc, argv, "ht:i:l:m:n:")) >= 0) { 52 | switch(opt) { 53 | case 'h': 54 | usage(); 55 | exit(0); 56 | break; 57 | case 't': p.thread_num = atoi(optarg); break; 58 | case 'i': p.iter_time = atoi(optarg); break; 59 | case 'l': p.learning_rate = atof(optarg); break; 60 | case 'm': p.m_size = atoi(optarg); break; 61 | case 'n': p.n_size = atoi(optarg); break; 62 | // case 'w': p.n_warmup = atoi(optarg); break; 63 | // case 'e': p.n_reps = atoi(optarg); break; 64 | // case 'x': p.exp = atoi(optarg); break; 65 | default: 66 | fprintf(stderr, "\nUnrecognized option!\n"); 67 | usage(); 68 | exit(0); 69 | } 70 | } 71 | // assert(NR_DPUS > 0 && "Invalid # of dpus!"); 72 | // if (p.n_size > MAX_ROWS) { 73 | // printf("max num of rows is 16!\n"); 74 | // exit(0); 75 | // } 76 | 77 | return p; 78 | } 79 | #endif 80 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int8/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int32_float/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int8/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int8/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_SUSY_quantization/LogReg_int32_SUSY/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_SUSY_quantization/LogReg_int8_SUSY/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int32_float/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int8_builtin/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_SUSY_quantization/LogReg_int8_SUSY/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int32_float/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int32LUT_float/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int32_float/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int8_builtin/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_SUSY_quantization/LogReg_int32_SUSY/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int32LUT_float/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int8_builtin/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int32LUTMRAM_float/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_SUSY_quantization/LogReg_int8_builtin_SUSY/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int32LUTMRAM_float/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[6]; 41 | struct timeval stopTime[6]; 42 | double time[6]; 43 | 44 | }Timer; 45 | 46 | void start(Timer *timer, int i, int rep) { 47 | if(rep == 0) { 48 | timer->time[i] = 0.0; 49 | } 50 | gettimeofday(&timer->startTime[i], NULL); 51 | } 52 | 53 | void stop(Timer *timer, int i) { 54 | gettimeofday(&timer->stopTime[i], NULL); 55 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 56 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 57 | } 58 | 59 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 60 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int8/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[4]; 41 | struct timeval stopTime[4]; 42 | double time[4]; 43 | // struct timeval startTime[5]; 44 | // struct timeval stopTime[5]; 45 | // double time[5]; 46 | 47 | }Timer; 48 | 49 | void start(Timer *timer, int i, int rep) { 50 | if(rep == 0) { 51 | timer->time[i] = 0.0; 52 | } 53 | gettimeofday(&timer->startTime[i], NULL); 54 | } 55 | 56 | void stop(Timer *timer, int i) { 57 | gettimeofday(&timer->stopTime[i], NULL); 58 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 59 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 60 | } 61 | 62 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 63 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int8_builtin/support/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 University of Cordoba and University of Illinois 3 | * All rights reserved. 4 | * 5 | * Developed by: IMPACT Research Group 6 | * University of Cordoba and University of Illinois 7 | * http://impact.crhc.illinois.edu/ 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * with the Software without restriction, including without limitation the 12 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | * sell copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * > Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimers. 18 | * > Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimers in the 20 | * documentation and/or other materials provided with the distribution. 21 | * > Neither the names of IMPACT Research Group, University of Cordoba, 22 | * University of Illinois nor the names of its contributors may be used 23 | * to endorse or promote products derived from this Software without 24 | * specific prior written permission. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH 32 | * THE SOFTWARE. 33 | * 34 | */ 35 | 36 | #include 37 | 38 | typedef struct Timer{ 39 | 40 | struct timeval startTime[4]; 41 | struct timeval stopTime[4]; 42 | double time[4]; 43 | // struct timeval startTime[5]; 44 | // struct timeval stopTime[5]; 45 | // double time[5]; 46 | 47 | }Timer; 48 | 49 | void start(Timer *timer, int i, int rep) { 50 | if(rep == 0) { 51 | timer->time[i] = 0.0; 52 | } 53 | gettimeofday(&timer->startTime[i], NULL); 54 | } 55 | 56 | void stop(Timer *timer, int i) { 57 | gettimeofday(&timer->stopTime[i], NULL); 58 | timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 + 59 | (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec); 60 | } 61 | 62 | void print(Timer *timer, int i, int REP) { printf("Time (ms): %f ", timer->time[i] / (1000 * REP)); } 63 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int8/run_weak.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import getpass 4 | 5 | rootdir = "." # Include path to repo 6 | 7 | applications = {"LRGD": ["NR_DPUS=X TYPE=Z make all", "./bin/host_code -i 500 -m M"]} 8 | 9 | def run(app_name): 10 | TYPE = ["INT8"] 11 | NR_DPUS = [1, 4, 16, 64] 12 | 13 | if app_name in applications: 14 | print ("------------------------ Running: "+app_name+"----------------------") 15 | print ("--------------------------------------------------------------------") 16 | if(len(applications[app_name]) > 1): 17 | make = applications[app_name][0] 18 | run_cmd = applications[app_name][1] 19 | 20 | os.chdir(rootdir + "/") 21 | os.getcwd() 22 | 23 | os.system("make clean") 24 | 25 | try: 26 | os.mkdir(rootdir + "/"+ "bin") 27 | except OSError: 28 | print ("Creation of the direction /bin failed") 29 | 30 | try: 31 | os.mkdir(rootdir + "/profile") 32 | except OSError: 33 | print ("Creation of the direction /profile failed") 34 | 35 | for t in TYPE: 36 | for r in NR_DPUS: 37 | os.system("make clean") 38 | 39 | m = make.replace("X", str(r)) 40 | m = m.replace("Z", str(t)) 41 | print ("Running = " + m) 42 | try: 43 | os.system(m) 44 | except: 45 | pass 46 | 47 | m_size = 2048 * r # 2048 data samples per DPU 48 | r_cmd = run_cmd.replace("M", str(m_size)) 49 | r_cmd = r_cmd + " >> profile/outw_type"+str(t)+"_dpus"+str(r)+"_m"+str(m_size) 50 | 51 | print ("Running = " + app_name + " -> "+ r_cmd) 52 | try: 53 | os.system(r_cmd) 54 | except: 55 | pass 56 | else: 57 | make = applications[app_name] 58 | 59 | os.chdir(rootdir + "/"+app_name) 60 | os.getcwd() 61 | 62 | try: 63 | os.mkdir(rootdir + "/"+ app_name +"/bin") 64 | # os.mkdir(rootdir + "/"+ app_name +"/log") 65 | # os.mkdir(rootdir + "/"+ app_name +"/log/host") 66 | os.mkdir(rootdir + "/"+ app_name +"/profile") 67 | except OSError: 68 | print ("Creation of the direction failed") 69 | 70 | print (make) 71 | os.system(make + ">& profile/out") 72 | 73 | else: 74 | print ( "Application "+app_name+" not available" ) 75 | 76 | def main(): 77 | if(len(sys.argv) < 2): 78 | print ("Usage: python run.py application") 79 | print ("Applications available: ") 80 | for key, value in applications.iteritems(): 81 | print (key ) 82 | print ("All") 83 | 84 | else: 85 | cmd = sys.argv[1] 86 | print ("Application to run is: " + cmd ) 87 | if cmd == "All": 88 | for key, value in applications.iteritems(): 89 | run(key) 90 | os.chdir(rootdir) 91 | else: 92 | run(cmd) 93 | 94 | if __name__ == "__main__": 95 | main() 96 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int8/run_weak.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import getpass 4 | 5 | rootdir = "." # Include path to repo 6 | 7 | applications = {"LRGD": ["NR_DPUS=X TYPE=Z make all", "./bin/host_code -i 500 -m M"]} 8 | 9 | def run(app_name): 10 | TYPE = ["INT8"] 11 | NR_DPUS = [1, 4, 16, 64] 12 | 13 | if app_name in applications: 14 | print ("------------------------ Running: "+app_name+"----------------------") 15 | print ("--------------------------------------------------------------------") 16 | if(len(applications[app_name]) > 1): 17 | make = applications[app_name][0] 18 | run_cmd = applications[app_name][1] 19 | 20 | os.chdir(rootdir + "/") 21 | os.getcwd() 22 | 23 | os.system("make clean") 24 | 25 | try: 26 | os.mkdir(rootdir + "/"+ "bin") 27 | except OSError: 28 | print ("Creation of the direction /bin failed") 29 | 30 | try: 31 | os.mkdir(rootdir + "/profile") 32 | except OSError: 33 | print ("Creation of the direction /profile failed") 34 | 35 | for t in TYPE: 36 | for r in NR_DPUS: 37 | os.system("make clean") 38 | 39 | m = make.replace("X", str(r)) 40 | m = m.replace("Z", str(t)) 41 | print ("Running = " + m) 42 | try: 43 | os.system(m) 44 | except: 45 | pass 46 | 47 | m_size = 2048 * r # 2048 data samples per DPU 48 | r_cmd = run_cmd.replace("M", str(m_size)) 49 | r_cmd = r_cmd + " >> profile/outw_type"+str(t)+"_dpus"+str(r)+"_m"+str(m_size) 50 | 51 | print ("Running = " + app_name + " -> "+ r_cmd) 52 | try: 53 | os.system(r_cmd) 54 | except: 55 | pass 56 | else: 57 | make = applications[app_name] 58 | 59 | os.chdir(rootdir + "/"+app_name) 60 | os.getcwd() 61 | 62 | try: 63 | os.mkdir(rootdir + "/"+ app_name +"/bin") 64 | # os.mkdir(rootdir + "/"+ app_name +"/log") 65 | # os.mkdir(rootdir + "/"+ app_name +"/log/host") 66 | os.mkdir(rootdir + "/"+ app_name +"/profile") 67 | except OSError: 68 | print ("Creation of the direction failed") 69 | 70 | print (make) 71 | os.system(make + ">& profile/out") 72 | 73 | else: 74 | print ( "Application "+app_name+" not available" ) 75 | 76 | def main(): 77 | if(len(sys.argv) < 2): 78 | print ("Usage: python run.py application") 79 | print ("Applications available: ") 80 | for key, value in applications.iteritems(): 81 | print (key ) 82 | print ("All") 83 | 84 | else: 85 | cmd = sys.argv[1] 86 | print ("Application to run is: " + cmd ) 87 | if cmd == "All": 88 | for key, value in applications.iteritems(): 89 | run(key) 90 | os.chdir(rootdir) 91 | else: 92 | run(cmd) 93 | 94 | if __name__ == "__main__": 95 | main() 96 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int8/run_weak.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import getpass 4 | 5 | rootdir = "." # Include path to repo 6 | 7 | applications = {"LogReg": ["NR_DPUS=X TYPE=Z make all", "./bin/host_code -i 500 -m M"]} 8 | 9 | def run(app_name): 10 | TYPE = ["INT8"] 11 | NR_DPUS = [1, 4, 16, 64] 12 | 13 | if app_name in applications: 14 | print ("------------------------ Running: "+app_name+"----------------------") 15 | print ("--------------------------------------------------------------------") 16 | if(len(applications[app_name]) > 1): 17 | make = applications[app_name][0] 18 | run_cmd = applications[app_name][1] 19 | 20 | os.chdir(rootdir + "/") 21 | os.getcwd() 22 | 23 | os.system("make clean") 24 | 25 | try: 26 | os.mkdir(rootdir + "/"+ "bin") 27 | except OSError: 28 | print ("Creation of the direction /bin failed") 29 | 30 | try: 31 | os.mkdir(rootdir + "/profile") 32 | except OSError: 33 | print ("Creation of the direction /profile failed") 34 | 35 | for t in TYPE: 36 | for r in NR_DPUS: 37 | os.system("make clean") 38 | 39 | m = make.replace("X", str(r)) 40 | m = m.replace("Z", str(t)) 41 | print ("Running = " + m) 42 | try: 43 | os.system(m) 44 | except: 45 | pass 46 | 47 | m_size = 2048 * r # 2048 data samples per DPU 48 | r_cmd = run_cmd.replace("M", str(m_size)) 49 | r_cmd = r_cmd + " >> profile/outw_type"+str(t)+"_dpus"+str(r)+"_m"+str(m_size) 50 | 51 | print ("Running = " + app_name + " -> "+ r_cmd) 52 | try: 53 | os.system(r_cmd) 54 | except: 55 | pass 56 | else: 57 | make = applications[app_name] 58 | 59 | os.chdir(rootdir + "/"+app_name) 60 | os.getcwd() 61 | 62 | try: 63 | os.mkdir(rootdir + "/"+ app_name +"/bin") 64 | # os.mkdir(rootdir + "/"+ app_name +"/log") 65 | # os.mkdir(rootdir + "/"+ app_name +"/log/host") 66 | os.mkdir(rootdir + "/"+ app_name +"/profile") 67 | except OSError: 68 | print ("Creation of the direction failed") 69 | 70 | print (make) 71 | os.system(make + ">& profile/out") 72 | 73 | else: 74 | print ( "Application "+app_name+" not available" ) 75 | 76 | def main(): 77 | if(len(sys.argv) < 2): 78 | print ("Usage: python run.py application") 79 | print ("Applications available: ") 80 | for key, value in applications.iteritems(): 81 | print (key ) 82 | print ("All") 83 | 84 | else: 85 | cmd = sys.argv[1] 86 | print ("Application to run is: " + cmd ) 87 | if cmd == "All": 88 | for key, value in applications.iteritems(): 89 | run(key) 90 | os.chdir(rootdir) 91 | else: 92 | run(cmd) 93 | 94 | if __name__ == "__main__": 95 | main() 96 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int8/run_weak.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import getpass 4 | 5 | rootdir = "." # Include path to repo 6 | 7 | applications = {"LogReg": ["NR_DPUS=X TYPE=Z make all", "./bin/host_code -i 500 -m M"]} 8 | 9 | def run(app_name): 10 | TYPE = ["INT8"] 11 | NR_DPUS = [1, 4, 16, 64] 12 | 13 | if app_name in applications: 14 | print ("------------------------ Running: "+app_name+"----------------------") 15 | print ("--------------------------------------------------------------------") 16 | if(len(applications[app_name]) > 1): 17 | make = applications[app_name][0] 18 | run_cmd = applications[app_name][1] 19 | 20 | os.chdir(rootdir + "/") 21 | os.getcwd() 22 | 23 | os.system("make clean") 24 | 25 | try: 26 | os.mkdir(rootdir + "/"+ "bin") 27 | except OSError: 28 | print ("Creation of the direction /bin failed") 29 | 30 | try: 31 | os.mkdir(rootdir + "/profile") 32 | except OSError: 33 | print ("Creation of the direction /profile failed") 34 | 35 | for t in TYPE: 36 | for r in NR_DPUS: 37 | os.system("make clean") 38 | 39 | m = make.replace("X", str(r)) 40 | m = m.replace("Z", str(t)) 41 | print ("Running = " + m) 42 | try: 43 | os.system(m) 44 | except: 45 | pass 46 | 47 | m_size = 2048 * r # 2048 data samples per DPU 48 | r_cmd = run_cmd.replace("M", str(m_size)) 49 | r_cmd = r_cmd + " >> profile/outw_type"+str(t)+"_dpus"+str(r)+"_m"+str(m_size) 50 | 51 | print ("Running = " + app_name + " -> "+ r_cmd) 52 | try: 53 | os.system(r_cmd) 54 | except: 55 | pass 56 | else: 57 | make = applications[app_name] 58 | 59 | os.chdir(rootdir + "/"+app_name) 60 | os.getcwd() 61 | 62 | try: 63 | os.mkdir(rootdir + "/"+ app_name +"/bin") 64 | # os.mkdir(rootdir + "/"+ app_name +"/log") 65 | # os.mkdir(rootdir + "/"+ app_name +"/log/host") 66 | os.mkdir(rootdir + "/"+ app_name +"/profile") 67 | except OSError: 68 | print ("Creation of the direction failed") 69 | 70 | print (make) 71 | os.system(make + ">& profile/out") 72 | 73 | else: 74 | print ( "Application "+app_name+" not available" ) 75 | 76 | def main(): 77 | if(len(sys.argv) < 2): 78 | print ("Usage: python run.py application") 79 | print ("Applications available: ") 80 | for key, value in applications.iteritems(): 81 | print (key ) 82 | print ("All") 83 | 84 | else: 85 | cmd = sys.argv[1] 86 | print ("Application to run is: " + cmd ) 87 | if cmd == "All": 88 | for key, value in applications.iteritems(): 89 | run(key) 90 | os.chdir(rootdir) 91 | else: 92 | run(cmd) 93 | 94 | if __name__ == "__main__": 95 | main() 96 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_no_quantization/LogReg_int8_builtin/run_weak.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import getpass 4 | 5 | rootdir = "." # Include path to repo 6 | 7 | applications = {"LRGD": ["NR_DPUS=X TYPE=Z make all", "./bin/host_code -i 500 -m M"]} 8 | 9 | def run(app_name): 10 | TYPE = ["INT8"] 11 | NR_DPUS = [1, 4, 16, 64] 12 | 13 | if app_name in applications: 14 | print ("------------------------ Running: "+app_name+"----------------------") 15 | print ("--------------------------------------------------------------------") 16 | if(len(applications[app_name]) > 1): 17 | make = applications[app_name][0] 18 | run_cmd = applications[app_name][1] 19 | 20 | os.chdir(rootdir + "/") 21 | os.getcwd() 22 | 23 | os.system("make clean") 24 | 25 | try: 26 | os.mkdir(rootdir + "/"+ "bin") 27 | except OSError: 28 | print ("Creation of the direction /bin failed") 29 | 30 | try: 31 | os.mkdir(rootdir + "/profile") 32 | except OSError: 33 | print ("Creation of the direction /profile failed") 34 | 35 | for t in TYPE: 36 | for r in NR_DPUS: 37 | os.system("make clean") 38 | 39 | m = make.replace("X", str(r)) 40 | m = m.replace("Z", str(t)) 41 | print ("Running = " + m) 42 | try: 43 | os.system(m) 44 | except: 45 | pass 46 | 47 | m_size = 2048 * r # 2048 data samples per DPU 48 | r_cmd = run_cmd.replace("M", str(m_size)) 49 | r_cmd = r_cmd + " >> profile/outw_type"+str(t)+"_dpus"+str(r)+"_m"+str(m_size) 50 | 51 | print ("Running = " + app_name + " -> "+ r_cmd) 52 | try: 53 | os.system(r_cmd) 54 | except: 55 | pass 56 | else: 57 | make = applications[app_name] 58 | 59 | os.chdir(rootdir + "/"+app_name) 60 | os.getcwd() 61 | 62 | try: 63 | os.mkdir(rootdir + "/"+ app_name +"/bin") 64 | # os.mkdir(rootdir + "/"+ app_name +"/log") 65 | # os.mkdir(rootdir + "/"+ app_name +"/log/host") 66 | os.mkdir(rootdir + "/"+ app_name +"/profile") 67 | except OSError: 68 | print ("Creation of the direction failed") 69 | 70 | print (make) 71 | os.system(make + ">& profile/out") 72 | 73 | else: 74 | print ( "Application "+app_name+" not available" ) 75 | 76 | def main(): 77 | if(len(sys.argv) < 2): 78 | print ("Usage: python run.py application") 79 | print ("Applications available: ") 80 | for key, value in applications.iteritems(): 81 | print (key ) 82 | print ("All") 83 | 84 | else: 85 | cmd = sys.argv[1] 86 | print ("Application to run is: " + cmd ) 87 | if cmd == "All": 88 | for key, value in applications.iteritems(): 89 | run(key) 90 | os.chdir(rootdir) 91 | else: 92 | run(cmd) 93 | 94 | if __name__ == "__main__": 95 | main() 96 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int8_builtin/run_weak.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import getpass 4 | 5 | rootdir = "." # Include path to repo 6 | 7 | applications = {"LRGD": ["NR_DPUS=X TYPE=Z make all", "./bin/host_code -i 500 -m M"]} 8 | 9 | def run(app_name): 10 | TYPE = ["INT8"] 11 | NR_DPUS = [1, 4, 16, 64] 12 | 13 | if app_name in applications: 14 | print ("------------------------ Running: "+app_name+"----------------------") 15 | print ("--------------------------------------------------------------------") 16 | if(len(applications[app_name]) > 1): 17 | make = applications[app_name][0] 18 | run_cmd = applications[app_name][1] 19 | 20 | os.chdir(rootdir + "/") 21 | os.getcwd() 22 | 23 | os.system("make clean") 24 | 25 | try: 26 | os.mkdir(rootdir + "/"+ "bin") 27 | except OSError: 28 | print ("Creation of the direction /bin failed") 29 | 30 | try: 31 | os.mkdir(rootdir + "/profile") 32 | except OSError: 33 | print ("Creation of the direction /profile failed") 34 | 35 | for t in TYPE: 36 | for r in NR_DPUS: 37 | os.system("make clean") 38 | 39 | m = make.replace("X", str(r)) 40 | m = m.replace("Z", str(t)) 41 | print ("Running = " + m) 42 | try: 43 | os.system(m) 44 | except: 45 | pass 46 | 47 | m_size = 2048 * r # 2048 data samples per DPU 48 | r_cmd = run_cmd.replace("M", str(m_size)) 49 | r_cmd = r_cmd + " >> profile/outw_type"+str(t)+"_dpus"+str(r)+"_m"+str(m_size) 50 | 51 | print ("Running = " + app_name + " -> "+ r_cmd) 52 | try: 53 | os.system(r_cmd) 54 | except: 55 | pass 56 | else: 57 | make = applications[app_name] 58 | 59 | os.chdir(rootdir + "/"+app_name) 60 | os.getcwd() 61 | 62 | try: 63 | os.mkdir(rootdir + "/"+ app_name +"/bin") 64 | # os.mkdir(rootdir + "/"+ app_name +"/log") 65 | # os.mkdir(rootdir + "/"+ app_name +"/log/host") 66 | os.mkdir(rootdir + "/"+ app_name +"/profile") 67 | except OSError: 68 | print ("Creation of the direction failed") 69 | 70 | print (make) 71 | os.system(make + ">& profile/out") 72 | 73 | else: 74 | print ( "Application "+app_name+" not available" ) 75 | 76 | def main(): 77 | if(len(sys.argv) < 2): 78 | print ("Usage: python run.py application") 79 | print ("Applications available: ") 80 | for key, value in applications.iteritems(): 81 | print (key ) 82 | print ("All") 83 | 84 | else: 85 | cmd = sys.argv[1] 86 | print ("Application to run is: " + cmd ) 87 | if cmd == "All": 88 | for key, value in applications.iteritems(): 89 | run(key) 90 | os.chdir(rootdir) 91 | else: 92 | run(cmd) 93 | 94 | if __name__ == "__main__": 95 | main() 96 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int8_builtin/run_weak.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import getpass 4 | 5 | rootdir = "." # Include path to repo 6 | 7 | applications = {"LogReg": ["NR_DPUS=X TYPE=Z make all", "./bin/host_code -i 500 -m M"]} 8 | 9 | def run(app_name): 10 | TYPE = ["INT8"] 11 | NR_DPUS = [1, 4, 16, 64] 12 | 13 | if app_name in applications: 14 | print ("------------------------ Running: "+app_name+"----------------------") 15 | print ("--------------------------------------------------------------------") 16 | if(len(applications[app_name]) > 1): 17 | make = applications[app_name][0] 18 | run_cmd = applications[app_name][1] 19 | 20 | os.chdir(rootdir + "/") 21 | os.getcwd() 22 | 23 | os.system("make clean") 24 | 25 | try: 26 | os.mkdir(rootdir + "/"+ "bin") 27 | except OSError: 28 | print ("Creation of the direction /bin failed") 29 | 30 | try: 31 | os.mkdir(rootdir + "/profile") 32 | except OSError: 33 | print ("Creation of the direction /profile failed") 34 | 35 | for t in TYPE: 36 | for r in NR_DPUS: 37 | os.system("make clean") 38 | 39 | m = make.replace("X", str(r)) 40 | m = m.replace("Z", str(t)) 41 | print ("Running = " + m) 42 | try: 43 | os.system(m) 44 | except: 45 | pass 46 | 47 | m_size = 2048 * r # 2048 data samples per DPU 48 | r_cmd = run_cmd.replace("M", str(m_size)) 49 | r_cmd = r_cmd + " >> profile/outw_type"+str(t)+"_dpus"+str(r)+"_m"+str(m_size) 50 | 51 | print ("Running = " + app_name + " -> "+ r_cmd) 52 | try: 53 | os.system(r_cmd) 54 | except: 55 | pass 56 | else: 57 | make = applications[app_name] 58 | 59 | os.chdir(rootdir + "/"+app_name) 60 | os.getcwd() 61 | 62 | try: 63 | os.mkdir(rootdir + "/"+ app_name +"/bin") 64 | # os.mkdir(rootdir + "/"+ app_name +"/log") 65 | # os.mkdir(rootdir + "/"+ app_name +"/log/host") 66 | os.mkdir(rootdir + "/"+ app_name +"/profile") 67 | except OSError: 68 | print ("Creation of the direction failed") 69 | 70 | print (make) 71 | os.system(make + ">& profile/out") 72 | 73 | else: 74 | print ( "Application "+app_name+" not available" ) 75 | 76 | def main(): 77 | if(len(sys.argv) < 2): 78 | print ("Usage: python run.py application") 79 | print ("Applications available: ") 80 | for key, value in applications.iteritems(): 81 | print (key ) 82 | print ("All") 83 | 84 | else: 85 | cmd = sys.argv[1] 86 | print ("Application to run is: " + cmd ) 87 | if cmd == "All": 88 | for key, value in applications.iteritems(): 89 | run(key) 90 | os.chdir(rootdir) 91 | else: 92 | run(cmd) 93 | 94 | if __name__ == "__main__": 95 | main() 96 | -------------------------------------------------------------------------------- /Linear_Regression/LinReg_quantization/LogReg_int32_float/run_weak.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import getpass 4 | 5 | rootdir = "." # Include path to repo 6 | 7 | applications = {"LRGD": ["NR_DPUS=X TYPE=Z make all", "./bin/host_code -i 500 -m M"]} 8 | 9 | def run(app_name): 10 | TYPE = ["INT32", "FLOAT"] 11 | NR_DPUS = [1, 4, 16, 64] 12 | 13 | if app_name in applications: 14 | print ("------------------------ Running: "+app_name+"----------------------") 15 | print ("--------------------------------------------------------------------") 16 | if(len(applications[app_name]) > 1): 17 | make = applications[app_name][0] 18 | run_cmd = applications[app_name][1] 19 | 20 | os.chdir(rootdir + "/") 21 | os.getcwd() 22 | 23 | os.system("make clean") 24 | 25 | try: 26 | os.mkdir(rootdir + "/"+ "bin") 27 | except OSError: 28 | print ("Creation of the direction /bin failed") 29 | 30 | try: 31 | os.mkdir(rootdir + "/profile") 32 | except OSError: 33 | print ("Creation of the direction /profile failed") 34 | 35 | for t in TYPE: 36 | for r in NR_DPUS: 37 | os.system("make clean") 38 | 39 | m = make.replace("X", str(r)) 40 | m = m.replace("Z", str(t)) 41 | print ("Running = " + m) 42 | try: 43 | os.system(m) 44 | except: 45 | pass 46 | 47 | m_size = 2048 * r # 2048 data samples per DPU 48 | r_cmd = run_cmd.replace("M", str(m_size)) 49 | r_cmd = r_cmd + " >> profile/outw_type"+str(t)+"_dpus"+str(r)+"_m"+str(m_size) 50 | 51 | print ("Running = " + app_name + " -> "+ r_cmd) 52 | try: 53 | os.system(r_cmd) 54 | except: 55 | pass 56 | else: 57 | make = applications[app_name] 58 | 59 | os.chdir(rootdir + "/"+app_name) 60 | os.getcwd() 61 | 62 | try: 63 | os.mkdir(rootdir + "/"+ app_name +"/bin") 64 | # os.mkdir(rootdir + "/"+ app_name +"/log") 65 | # os.mkdir(rootdir + "/"+ app_name +"/log/host") 66 | os.mkdir(rootdir + "/"+ app_name +"/profile") 67 | except OSError: 68 | print ("Creation of the direction failed") 69 | 70 | print (make) 71 | os.system(make + ">& profile/out") 72 | 73 | else: 74 | print ( "Application "+app_name+" not available" ) 75 | 76 | def main(): 77 | if(len(sys.argv) < 2): 78 | print ("Usage: python run.py application") 79 | print ("Applications available: ") 80 | for key, value in applications.iteritems(): 81 | print (key ) 82 | print ("All") 83 | 84 | else: 85 | cmd = sys.argv[1] 86 | print ("Application to run is: " + cmd ) 87 | if cmd == "All": 88 | for key, value in applications.iteritems(): 89 | run(key) 90 | os.chdir(rootdir) 91 | else: 92 | run(cmd) 93 | 94 | if __name__ == "__main__": 95 | main() 96 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_no_quantization/LogReg_int8_builtin/run_weak.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import getpass 4 | 5 | rootdir = "." # Include path to repo 6 | 7 | applications = {"LogReg": ["NR_DPUS=X TYPE=Z make all", "./bin/host_code -i 500 -m M"]} 8 | 9 | def run(app_name): 10 | TYPE = ["INT8"] 11 | NR_DPUS = [1, 4, 16, 64] 12 | 13 | if app_name in applications: 14 | print ("------------------------ Running: "+app_name+"----------------------") 15 | print ("--------------------------------------------------------------------") 16 | if(len(applications[app_name]) > 1): 17 | make = applications[app_name][0] 18 | run_cmd = applications[app_name][1] 19 | 20 | os.chdir(rootdir + "/") 21 | os.getcwd() 22 | 23 | os.system("make clean") 24 | 25 | try: 26 | os.mkdir(rootdir + "/"+ "bin") 27 | except OSError: 28 | print ("Creation of the direction /bin failed") 29 | 30 | try: 31 | os.mkdir(rootdir + "/profile") 32 | except OSError: 33 | print ("Creation of the direction /profile failed") 34 | 35 | for t in TYPE: 36 | for r in NR_DPUS: 37 | os.system("make clean") 38 | 39 | m = make.replace("X", str(r)) 40 | m = m.replace("Z", str(t)) 41 | print ("Running = " + m) 42 | try: 43 | os.system(m) 44 | except: 45 | pass 46 | 47 | m_size = 2048 * r # 2048 data samples per DPU 48 | r_cmd = run_cmd.replace("M", str(m_size)) 49 | r_cmd = r_cmd + " >> profile/outw_type"+str(t)+"_dpus"+str(r)+"_m"+str(m_size) 50 | 51 | print ("Running = " + app_name + " -> "+ r_cmd) 52 | try: 53 | os.system(r_cmd) 54 | except: 55 | pass 56 | else: 57 | make = applications[app_name] 58 | 59 | os.chdir(rootdir + "/"+app_name) 60 | os.getcwd() 61 | 62 | try: 63 | os.mkdir(rootdir + "/"+ app_name +"/bin") 64 | # os.mkdir(rootdir + "/"+ app_name +"/log") 65 | # os.mkdir(rootdir + "/"+ app_name +"/log/host") 66 | os.mkdir(rootdir + "/"+ app_name +"/profile") 67 | except OSError: 68 | print ("Creation of the direction failed") 69 | 70 | print (make) 71 | os.system(make + ">& profile/out") 72 | 73 | else: 74 | print ( "Application "+app_name+" not available" ) 75 | 76 | def main(): 77 | if(len(sys.argv) < 2): 78 | print ("Usage: python run.py application") 79 | print ("Applications available: ") 80 | for key, value in applications.iteritems(): 81 | print (key ) 82 | print ("All") 83 | 84 | else: 85 | cmd = sys.argv[1] 86 | print ("Application to run is: " + cmd ) 87 | if cmd == "All": 88 | for key, value in applications.iteritems(): 89 | run(key) 90 | os.chdir(rootdir) 91 | else: 92 | run(cmd) 93 | 94 | if __name__ == "__main__": 95 | main() 96 | -------------------------------------------------------------------------------- /Logistic_Regression/LogReg_quantization/LogReg_int32LUT_float/run_weak.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import getpass 4 | 5 | rootdir = "." # Include path to repo 6 | 7 | applications = {"LogReg": ["NR_DPUS=X TYPE=Z make all", "./bin/host_code -i 500 -m M"]} 8 | 9 | def run(app_name): 10 | TYPE = ["INT32"] 11 | NR_DPUS = [1, 4, 16, 64] 12 | 13 | if app_name in applications: 14 | print ("------------------------ Running: "+app_name+"----------------------") 15 | print ("--------------------------------------------------------------------") 16 | if(len(applications[app_name]) > 1): 17 | make = applications[app_name][0] 18 | run_cmd = applications[app_name][1] 19 | 20 | os.chdir(rootdir + "/") 21 | os.getcwd() 22 | 23 | os.system("make clean") 24 | 25 | try: 26 | os.mkdir(rootdir + "/"+ "bin") 27 | except OSError: 28 | print ("Creation of the direction /bin failed") 29 | 30 | try: 31 | os.mkdir(rootdir + "/profile") 32 | except OSError: 33 | print ("Creation of the direction /profile failed") 34 | 35 | for t in TYPE: 36 | for r in NR_DPUS: 37 | os.system("make clean") 38 | 39 | m = make.replace("X", str(r)) 40 | m = m.replace("Z", str(t)) 41 | print ("Running = " + m) 42 | try: 43 | os.system(m) 44 | except: 45 | pass 46 | 47 | m_size = 2048 * r # 2048 data samples per DPU 48 | r_cmd = run_cmd.replace("M", str(m_size)) 49 | r_cmd = r_cmd + " >> profile/outw_type"+str(t)+"_dpus"+str(r)+"_m"+str(m_size) 50 | 51 | print ("Running = " + app_name + " -> "+ r_cmd) 52 | try: 53 | os.system(r_cmd) 54 | except: 55 | pass 56 | else: 57 | make = applications[app_name] 58 | 59 | os.chdir(rootdir + "/"+app_name) 60 | os.getcwd() 61 | 62 | try: 63 | os.mkdir(rootdir + "/"+ app_name +"/bin") 64 | # os.mkdir(rootdir + "/"+ app_name +"/log") 65 | # os.mkdir(rootdir + "/"+ app_name +"/log/host") 66 | os.mkdir(rootdir + "/"+ app_name +"/profile") 67 | except OSError: 68 | print ("Creation of the direction failed") 69 | 70 | print (make) 71 | os.system(make + ">& profile/out") 72 | 73 | else: 74 | print ( "Application "+app_name+" not available" ) 75 | 76 | def main(): 77 | if(len(sys.argv) < 2): 78 | print ("Usage: python run.py application") 79 | print ("Applications available: ") 80 | for key, value in applications.iteritems(): 81 | print (key ) 82 | print ("All") 83 | 84 | else: 85 | cmd = sys.argv[1] 86 | print ("Application to run is: " + cmd ) 87 | if cmd == "All": 88 | for key, value in applications.iteritems(): 89 | run(key) 90 | os.chdir(rootdir) 91 | else: 92 | run(cmd) 93 | 94 | if __name__ == "__main__": 95 | main() 96 | --------------------------------------------------------------------------------