Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ci/blackbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ROOT_DIR=$SCRIPT_DIR/..
show_usage()
{
echo "Vortex BlackBox Test Driver v1.0"
echo "Usage: $0 [[--clusters=#n] [--cores=#n] [--warps=#n] [--threads=#n] [--l2cache] [--l3cache] [[--driver=#name] [--app=#app] [--args=#args] [--debug=#level] [--scope] [--perf=#class] [--log=logfile] [--nohup] [--help]]"
echo "Usage: $0 [[--clusters=#n] [--cores=#n] [--warps=#n] [--threads=#n] [--l2cache] [--l3cache] [[--driver=#name] [--app=#app] [--args=#args] [--debug=#level] [--np=#num of MPI processes] [--scope] [--perf=#class] [--log=logfile] [--nohup] [--help]]"
}

show_help()
Expand Down Expand Up @@ -47,6 +47,7 @@ DEFAULTS() {
DEBUG_LEVEL=0
SCOPE=0
HAS_ARGS=0
HAS_NP=0
PERF_CLASS=0
CONFIGS="$CONFIGS"
TEMPBUILD=0
Expand All @@ -69,6 +70,7 @@ parse_args() {
--debug=*) DEBUG=1; DEBUG_LEVEL=${i#*=} ;;
--scope) SCOPE=1; ;;
--args=*) HAS_ARGS=1; ARGS=${i#*=} ;;
--np=*) HAS_NP=1; NP=${i#*=} ;;
--log=*) LOGFILE=${i#*=} ;;
--nohup) TEMPBUILD=1 ;;
--help) show_help; exit 0 ;;
Expand Down Expand Up @@ -123,6 +125,7 @@ run_app() {
[ $DEBUG -eq 1 ] && cmd_opts=$(add_option "$cmd_opts" "DEBUG=1")
[ $TEMPBUILD -eq 1 ] && cmd_opts=$(add_option "$cmd_opts" "VORTEX_RT_PATH=\"$TEMPDIR\"")
[ $HAS_ARGS -eq 1 ] && cmd_opts=$(add_option "$cmd_opts" "OPTS=\"$ARGS\"")
[ $HAS_NP -eq 1 ] && cmd_opts=$(add_option "$cmd_opts" "NP=$NP")
cmd_opts=$(add_option "$cmd_opts" "make -C \"$APP_PATH\" run-$DRIVER")
[ $DEBUG -ne 0 ] && cmd_opts=$(add_option "$cmd_opts" "> $LOGFILE 2>&1")
echo "Running: $cmd_opts"
Expand Down
3 changes: 2 additions & 1 deletion miscs/apptainer/vortex.def
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ From: ubuntu:22.04
openjdk-11-jre-zero libtheora0 libavcodec58 libcairo-gobject2 \
ca-certificates-java libchromaprint1 software-properties-common perl-modules bzip2 \
unzip zlib1g-dev libtinfo5 g++ usbutils pciutils gawk bison gcc make tar python3.9 locales zstd uuid-dev ccache \
libboost-filesystem1.74.0 libboost-program-options1.74.0 libboost-system1.74.0 libboost-chrono1.74.0 libboost-thread1.74.0 environment-modules || true
libboost-filesystem1.74.0 libboost-program-options1.74.0 libboost-system1.74.0 libboost-chrono1.74.0 libboost-thread1.74.0 \
environment-modules openmpi-bin libopenmpi-dev || true

ln -s /usr/bin/python3 /usr/bin/python

Expand Down
24 changes: 24 additions & 0 deletions tests/regression/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,23 @@ all:
$(MAKE) -C dogfood
$(MAKE) -C dropout
$(MAKE) -C dotproduct
$(MAKE) -C mpi_dotproduct
$(MAKE) -C mpi_put_dotproduct
$(MAKE) -C mstress
$(MAKE) -C io_addr
$(MAKE) -C printf
$(MAKE) -C diverge
$(MAKE) -C mpi_diverge
$(MAKE) -C sort
$(MAKE) -C fence
$(MAKE) -C vecadd
$(MAKE) -C mpi_vecadd
$(MAKE) -C sgemm
$(MAKE) -C mpi_sgemm
$(MAKE) -C mpi_blocked_sgemm
$(MAKE) -C conv3
$(MAKE) -C mpi_conv3
$(MAKE) -C mpi_neighbor_a2a_conv3
$(MAKE) -C relu
$(MAKE) -C sgemv
$(MAKE) -C sgemm2
Expand All @@ -28,15 +36,23 @@ run-simx:
$(MAKE) -C dogfood run-simx
$(MAKE) -C dropout run-simx
$(MAKE) -C dotproduct run-simx
$(MAKE) -C mpi_dotproduct run-simx
$(MAKE) -C mpi_put_dotproduct run-simx
$(MAKE) -C mstress run-simx
$(MAKE) -C io_addr run-simx
$(MAKE) -C printf run-simx
$(MAKE) -C diverge run-simx
$(MAKE) -C mpi_diverge run-simx
$(MAKE) -C sort run-simx
$(MAKE) -C fence run-simx
$(MAKE) -C vecadd run-simx
$(MAKE) -C mpi_vecadd run-simx
$(MAKE) -C sgemm run-simx
$(MAKE) -C mpi_sgemm run-simx
$(MAKE) -C mpi_blocked_sgemm run-simx
$(MAKE) -C conv3 run-simx
$(MAKE) -C mpi_conv3 run-simx
$(MAKE) -C mpi_neighbor_a2a_conv3 run-simx
$(MAKE) -C relu run-simx
$(MAKE) -C sgemv run-simx
$(MAKE) -C sgemm2 run-simx
Expand Down Expand Up @@ -70,15 +86,23 @@ clean:
$(MAKE) -C dogfood clean
$(MAKE) -C dropout clean
$(MAKE) -C dotproduct clean
$(MAKE) -C mpi_dotproduct clean
$(MAKE) -C mpi_put_dotproduct clean
$(MAKE) -C mstress clean
$(MAKE) -C io_addr clean
$(MAKE) -C printf clean
$(MAKE) -C diverge clean
$(MAKE) -C mpi_diverge clean
$(MAKE) -C sort clean
$(MAKE) -C fence clean
$(MAKE) -C vecadd clean
$(MAKE) -C mpi_vecadd clean
$(MAKE) -C sgemm clean
$(MAKE) -C mpi_sgemm clean
$(MAKE) -C mpi_blocked_sgemm clean
$(MAKE) -C conv3 clean
$(MAKE) -C mpi_neighbor_a2a_conv3 clean
$(MAKE) -C mpi_conv3 clean
$(MAKE) -C relu clean
$(MAKE) -C sgemv clean
$(MAKE) -C sgemm2 clean
Expand Down
8 changes: 7 additions & 1 deletion tests/regression/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ CXXFLAGS += $(CONFIGS)

LDFLAGS += -L$(VORTEX_RT_PATH) -lvortex

ifdef MPI
MPIRUN = mpirun --allow-run-as-root --oversubscribe -np $(NP)
else
MPIRUN =
endif

# Debugging
ifdef DEBUG
CXXFLAGS += -g -O0
Expand Down Expand Up @@ -99,7 +105,7 @@ $(PROJECT): $(SRCS)
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@

run-simx: $(PROJECT) kernel.vxbin
LD_LIBRARY_PATH=$(VORTEX_RT_PATH):$(LD_LIBRARY_PATH) VORTEX_DRIVER=simx ./$(PROJECT) $(OPTS)
LD_LIBRARY_PATH=$(VORTEX_RT_PATH):$(LD_LIBRARY_PATH) VORTEX_DRIVER=simx $(MPIRUN) ./$(PROJECT) $(OPTS)

run-rtlsim: $(PROJECT) kernel.vxbin
LD_LIBRARY_PATH=$(VORTEX_RT_PATH):$(LD_LIBRARY_PATH) VORTEX_DRIVER=rtlsim ./$(PROJECT) $(OPTS)
Expand Down
21 changes: 21 additions & 0 deletions tests/regression/mpi_blocked_sgemm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ROOT_DIR := $(realpath ../../..)
include $(ROOT_DIR)/config.mk

PROJECT := mpi_blocked_sgemm

SRC_DIR := $(VORTEX_HOME)/tests/regression/$(PROJECT)

SRCS := $(SRC_DIR)/main.cpp

VX_SRCS := $(SRC_DIR)/kernel.cpp

OPTS ?= -n64

MPI ?= 0
NP ?= 1

ifdef MPI
CXX = mpic++
endif

include ../common.mk
16 changes: 16 additions & 0 deletions tests/regression/mpi_blocked_sgemm/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef _COMMON_H_
#define _COMMON_H_

#ifndef TYPE
#define TYPE float
#endif

typedef struct {
uint32_t grid_dim[2];
uint32_t size;
uint64_t A_addr;
uint64_t B_addr;
uint64_t C_addr;
} kernel_arg_t;

#endif
24 changes: 24 additions & 0 deletions tests/regression/mpi_blocked_sgemm/kernel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <vx_spawn.h>
#include "common.h"

void kernel_body(kernel_arg_t* __UNIFORM__ arg) {
auto A = reinterpret_cast<TYPE*>(arg->A_addr);
auto B = reinterpret_cast<TYPE*>(arg->B_addr);
auto C = reinterpret_cast<TYPE*>(arg->C_addr);
auto size = arg->size;

int col = blockIdx.x;
int row = blockIdx.y;

TYPE sum(0);
for (int e = 0; e < size; ++e) {
sum += A[row * size + e] * B[e * size + col];
}

C[row * size + col] = sum;
}

int main() {
kernel_arg_t* arg = (kernel_arg_t*)csr_read(VX_CSR_MSCRATCH);
return vx_spawn_threads(2, arg->grid_dim, nullptr, (vx_kernel_func_cb)kernel_body, arg);
}
Loading
Loading