adding multi-GPU test
此提交包含在:
@@ -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
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
新增問題並參考
封鎖使用者