adding multi-GPU test

此提交包含在:
Evgeny
2019-12-29 04:09:10 -06:00
父節點 077f8ec6b6
當前提交 8280f47327
共有 6 個檔案被更改,包括 30 行新增368 行删除
+7 -7
查看文件
@@ -11,24 +11,24 @@ ifeq (,$(HIP_PATH))
endif
HIPCC=$(HIP_PATH)/bin/hipcc
TARGET=hcc
EXECUTABLE=./MatrixTranspose
OBJECTS = MatrixTranspose.o
FLAGS =-g -I$(ROOT_PATH) -I$(ROOT_PATH)/inc -I${HSA_KMT_INC_PATH} -DLOCAL_BUILD=1 -DHIP_VDI=${HIP_VDI} -DITERATIONS=$(ITERATIONS)
ifeq ($(C_TEST), 1)
COMP=gcc
SOURCES = MatrixTranspose.c
FLAGS += -DHIP_TEST=0 -D__HIP_PLATFORM_HCC__=1 -I/opt/rocm/hcc/include
EXECUTABLE=./MatrixTranspose_ctest
else
COMP=$(HIPCC)
FLAGS += -DHIP_TEST=1
SOURCES = MatrixTranspose.cpp
EXECUTABLE=./MatrixTranspose
FLAGS += -DHIP_TEST=1
endif
ifeq ($(MGPU_TEST), 1)
FLAGS += -DMGPU_TEST=1
endif
OBJECTS = MatrixTranspose.o
.PHONY: test
+19 -7
查看文件
@@ -84,21 +84,33 @@ int main() {
float* gpuMatrix;
float* gpuTransposeMatrix;
#if HIP_TEST
hipDeviceProp_t devProp;
HIP_CALL(hipGetDeviceProperties(&devProp, 0));
printf("Device name %s\n", devProp.name);
#endif
int i;
int errors;
init_tracing();
#if HIP_TEST
int gpuCount = 1;
#if MGPU_TEST
hipGetDeviceCount(&gpuCount);
printf("Number of GPUs: %d\n", gpuCount);
#endif
iterations *= gpuCount;
#endif
while (iterations-- > 0) {
start_tracing();
#if HIP_TEST
// set GPU
const int devIndex = iterations % gpuCount;
hipSetDevice(devIndex);
hipDeviceProp_t devProp;
HIP_CALL(hipGetDeviceProperties(&devProp, 0));
printf("Device %d name: %s\n", devIndex, devProp.name);
#endif
Matrix = (float*)malloc(NUM * sizeof(float));
TransposeMatrix = (float*)malloc(NUM * sizeof(float));
cpuTransposeMatrix = (float*)malloc(NUM * sizeof(float));