summaryrefslogtreecommitdiff
path: root/NW
diff options
context:
space:
mode:
Diffstat (limited to 'NW')
-rw-r--r--NW/Makefile68
-rwxr-xr-xNW/benchmark-scripts/ccmcc25.sh29
-rw-r--r--NW/dpu/task.c2
-rw-r--r--NW/host/app.c49
-rw-r--r--[-rwxr-xr-x]NW/include/common.h (renamed from NW/support/common.h)0
-rw-r--r--NW/include/dfatool_host.ah30
-rw-r--r--NW/include/params.h (renamed from NW/support/params.h)0
-rw-r--r--[-rwxr-xr-x]NW/include/timer.h (renamed from NW/support/timer.h)118
8 files changed, 177 insertions, 119 deletions
diff --git a/NW/Makefile b/NW/Makefile
index 68f495a..10276b1 100644
--- a/NW/Makefile
+++ b/NW/Makefile
@@ -1,46 +1,56 @@
-DPU_DIR := dpu
-HOST_DIR := host
-BUILDDIR ?= bin
NR_TASKLETS ?= 13
-BL ?= 1024
-BL_IN ?= 4
-NR_DPUS ?= 1
+BL ?= 1024
+BL_IN ?= 4
+NR_DPUS ?= 1
ENERGY ?= 0
-define conf_filename
- ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3).conf
-endef
-CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL})
+HOST_SOURCES := $(wildcard host/*.c)
+DPU_SOURCES := $(wildcard dpu/*.c)
-HOST_TARGET := ${BUILDDIR}/nw_host
-DPU_TARGET := ${BUILDDIR}/nw_dpu
+aspectc ?= 0
+aspectc_timing ?= 0
-COMMON_INCLUDES := support
-HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c)
-DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c)
+HOST_CC := ${CC}
-.PHONY: all clean test
+COMMON_FLAGS := -Wall -Wextra -g -Iinclude -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL}
+HOST_FLAGS := ${COMMON_FLAGS} -O3 `dpu-pkg-config --cflags --libs dpu` -DENERGY=${ENERGY} -DASPECTC=${aspectc}
+DPU_FLAGS := ${COMMON_FLAGS} -O2 -DBL_IN=${BL_IN}
+
+ifeq (${aspectc_timing}, 1)
+ ASPECTC_HOST_FLAGS += -ainclude/dfatool_host_dpu.ah -ainclude/dfatool_host.ah
+endif
+
+ASPECTC_HOST_FLAGS ?= -a0
-__dirs := $(shell mkdir -p ${BUILDDIR})
+ifeq (${aspectc}, 1)
+ HOST_CC = ag++ -r repo.acp -v 0 ${ASPECTC_HOST_FLAGS} --c_compiler ${UPMEM_HOME}/bin/clang++ -p . --Xcompiler
+else
+ HOST_FLAGS += -std=c11
+endif
-COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES}
-HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -DENERGY=${ENERGY}
-DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -DBL_IN=${BL_IN}
+QUIET = @
-all: ${HOST_TARGET} ${DPU_TARGET}
+ifdef verbose
+ QUIET =
+endif
-${CONF}:
- $(RM) $(call conf_filename,*,*)
- touch ${CONF}
+all: bin/nw_host bin/nw_dpu
-${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF}
- $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS}
+bin:
+ ${QUIET}mkdir -p bin
-${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF}
- dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES}
+bin/nw_host: ${HOST_SOURCES} include bin
+ ${QUIET}cp ../include/dfatool_host_dpu.ah include
+ ${QUIET}${HOST_CC} -o $@ ${HOST_SOURCES} ${HOST_FLAGS}
+ ${QUIET}rm -f include/dfatool_host_dpu.ah
+
+bin/nw_dpu: ${DPU_SOURCES} include bin
+ ${QUIET}dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES}
clean:
$(RM) -r $(BUILDDIR)
test: all
- ./${HOST_TARGET}
+ bin/nw_host
+
+.PHONY: all clean test
diff --git a/NW/benchmark-scripts/ccmcc25.sh b/NW/benchmark-scripts/ccmcc25.sh
new file mode 100755
index 0000000..80df155
--- /dev/null
+++ b/NW/benchmark-scripts/ccmcc25.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# Generates huge logfiles and crashes frequently. Probably not helpful.
+exit 1
+
+mkdir -p log/$(hostname)
+fn=log/$(hostname)/ccmcc25
+
+source /opt/upmem/upmem-2025.1.0-Linux-x86_64/upmem_env.sh
+
+run_benchmark_nmc() {
+ local "$@"
+ set -e
+ sudo limit_ranks_to_numa_node ${numa_rank}
+ make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets} BL=32 BL_IN=2 \
+ dfatool_timing=0 aspectc=1 aspectc_timing=1
+ bin/nw_host -w 0 -e 50 -n ${nr_rows}
+}
+
+export -f run_benchmark_nmc
+
+echo "prim-benchmarks NW $(git describe --all --long) $(git rev-parse HEAD) $(date -R)" >> ${fn}.txt
+
+parallel -j1 --eta --joblog ${fn}.joblog --resume --header : \
+ run_benchmark_nmc nr_dpus={nr_dpus} nr_tasklets=16 numa_rank={numa_rank} nr_rows={nr_rows} \
+ ::: numa_rank any \
+ ::: nr_dpus 64 128 256 512 768 1024 1536 2048 2304 \
+ ::: nr_rows 32768 65536 131072 \
+>> ${fn}.txt
diff --git a/NW/dpu/task.c b/NW/dpu/task.c
index c022f70..fab163a 100644
--- a/NW/dpu/task.c
+++ b/NW/dpu/task.c
@@ -10,7 +10,7 @@
#include <perfcounter.h>
#include <barrier.h>
-#include "../support/common.h"
+#include "common.h"
__host dpu_arguments_t DPU_INPUT_ARGUMENTS;
diff --git a/NW/host/app.c b/NW/host/app.c
index 0e899ec..9de2918 100644
--- a/NW/host/app.c
+++ b/NW/host/app.c
@@ -7,20 +7,30 @@
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
+
+#if ASPECTC
+extern "C" {
+#endif
+
#include <dpu.h>
#include <dpu_log.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <assert.h>
-
-#include "../support/common.h"
-#include "../support/timer.h"
-#include "../support/params.h"
#if ENERGY
#include <dpu_probe.h>
#endif
+#if ASPECTC
+}
+#endif
+
+#include <unistd.h>
+#include <getopt.h>
+#include <assert.h>
+
+#include "common.h"
+#include "timer.h"
+#include "params.h"
+
// Define the DPU Binary path as DPU_BINARY here
#ifndef DPU_BINARY
#define DPU_BINARY "./bin/nw_dpu"
@@ -184,7 +194,7 @@ int main(int argc, char **argv) {
struct Params p = input_params(argc, argv);
struct dpu_set_t dpu_set, dpu;
- uint32_t nr_of_dpus, max_dpus;
+ uint32_t nr_of_dpus, nr_of_ranks, max_dpus;
#if ENERGY
struct dpu_probe_t probe;
@@ -195,6 +205,7 @@ int main(int argc, char **argv) {
DPU_ASSERT(dpu_alloc(NR_DPUS, NULL, &dpu_set));
DPU_ASSERT(dpu_load(dpu_set, DPU_BINARY, NULL));
DPU_ASSERT(dpu_get_nr_dpus(dpu_set, &nr_of_dpus));
+ DPU_ASSERT(dpu_get_nr_ranks(dpu_set, &nr_of_ranks));
printf("Allocated %d DPU(s)\n", nr_of_dpus);
printf("Allocated %d TASKLET(s) per DPU\n", NR_TASKLETS);
#if DYNAMIC
@@ -822,28 +833,6 @@ int main(int argc, char **argv) {
stop(&timer, 1);
}
-
- // Print timing results
- printf("CPU version ");
- print(&timer, 0, p.n_reps);
- printf("CPU-DPU ");
- print(&timer, 2, p.n_reps);
- printf("DPU Kernel ");
- print(&timer, 3, p.n_reps);
- printf("Inter-DPU ");
- print(&timer, 1, p.n_reps);
- printf("DPU-CPU ");
- print(&timer, 4, p.n_reps);
- printf("\n");
- printf("Longest Diagonal CPU-DPU ");
- print(&long_diagonal_timer, 2, p.n_reps);
- printf("Longest Diagonal DPU Kernel ");
- print(&long_diagonal_timer, 3, p.n_reps);
- printf("Longest Diagonal Inter-DPU ");
- print(&long_diagonal_timer, 1, p.n_reps);
- printf("Longest Diagonal DPU-CPU ");
- print(&long_diagonal_timer, 4, p.n_reps);
- printf("\n");
#if ENERGY
printf("DPU Energy (J): %f \t ", tavg_energy / p.n_reps);
diff --git a/NW/support/common.h b/NW/include/common.h
index 69069e7..69069e7 100755..100644
--- a/NW/support/common.h
+++ b/NW/include/common.h
diff --git a/NW/include/dfatool_host.ah b/NW/include/dfatool_host.ah
new file mode 100644
index 0000000..d45aef3
--- /dev/null
+++ b/NW/include/dfatool_host.ah
@@ -0,0 +1,30 @@
+#pragma once
+
+#include <sys/time.h>
+#include "dfatool_host_dpu.ah"
+
+aspect DfatoolHostTiming : public DfatoolHostDPUTiming {
+
+ unsigned long n_elements;
+ unsigned int element_size;
+
+ virtual int getKernel() { return 1; }
+
+ DfatoolHostTiming() {
+ element_size = sizeof(uint32_t);
+ }
+
+ advice call("% input_params(...)"): after() {
+ Params* p = tjp->result();
+ n_elements = p->max_rows;
+ printf("[>>] NW | n_dpus=%u n_elements=%lu\n", NR_DPUS, n_elements);
+ }
+
+ advice call("% srand(...)") : after() {
+ printf("[--] NW | n_dpus=%u n_elements=%lu\n", NR_DPUS, n_elements);
+ }
+
+ advice execution("% main(...)") : after() {
+ printf("[<<] NW | n_dpus=%u n_elements=%lu\n", NR_DPUS, n_elements);
+ }
+};
diff --git a/NW/support/params.h b/NW/include/params.h
index 8874248..8874248 100644
--- a/NW/support/params.h
+++ b/NW/include/params.h
diff --git a/NW/support/timer.h b/NW/include/timer.h
index efaefcd..2fc798f 100755..100644
--- a/NW/support/timer.h
+++ b/NW/include/timer.h
@@ -1,59 +1,59 @@
-/*
- * Copyright (c) 2016 University of Cordoba and University of Illinois
- * All rights reserved.
- *
- * Developed by: IMPACT Research Group
- * University of Cordoba and University of Illinois
- * http://impact.crhc.illinois.edu/
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * > Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimers.
- * > Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimers in the
- * documentation and/or other materials provided with the distribution.
- * > Neither the names of IMPACT Research Group, University of Cordoba,
- * University of Illinois nor the names of its contributors may be used
- * to endorse or promote products derived from this Software without
- * specific prior written permission.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH
- * THE SOFTWARE.
- *
- */
-
-#include <sys/time.h>
-
-typedef struct Timer{
-
- struct timeval startTime[5];
- struct timeval stopTime[5];
- double time[5];
-
-}Timer;
-
-void start(Timer *timer, int i, int rep) {
- if(rep == 0) {
- timer->time[i] = 0.0;
- }
- gettimeofday(&timer->startTime[i], NULL);
-}
-
-void stop(Timer *timer, int i) {
- gettimeofday(&timer->stopTime[i], NULL);
- timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 +
- (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec);
-}
-
-void print(Timer *timer, int i, int REP) { printf("Time (ms): %f\t", timer->time[i] / (1000 * REP)); }
+/*
+ * Copyright (c) 2016 University of Cordoba and University of Illinois
+ * All rights reserved.
+ *
+ * Developed by: IMPACT Research Group
+ * University of Cordoba and University of Illinois
+ * http://impact.crhc.illinois.edu/
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * with the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * > Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimers.
+ * > Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimers in the
+ * documentation and/or other materials provided with the distribution.
+ * > Neither the names of IMPACT Research Group, University of Cordoba,
+ * University of Illinois nor the names of its contributors may be used
+ * to endorse or promote products derived from this Software without
+ * specific prior written permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH
+ * THE SOFTWARE.
+ *
+ */
+
+#include <sys/time.h>
+
+typedef struct Timer{
+
+ struct timeval startTime[5];
+ struct timeval stopTime[5];
+ double time[5];
+
+}Timer;
+
+void start(Timer *timer, int i, int rep) {
+ if(rep == 0) {
+ timer->time[i] = 0.0;
+ }
+ gettimeofday(&timer->startTime[i], NULL);
+}
+
+void stop(Timer *timer, int i) {
+ gettimeofday(&timer->stopTime[i], NULL);
+ timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 +
+ (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec);
+}
+
+void print(Timer *timer, int i, int REP) { printf("Time (ms): %f\t", timer->time[i] / (1000 * REP)); }