Mercurial > hg > Game > Cerium
changeset 1702:f52904f8f03e draft
fix example.run ANY_ANY
author | Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Oct 2013 01:38:29 +0900 |
parents | e8ded21ac9a2 |
children | eab9b8205b85 |
files | TaskManager/test/GpuRunTest/GpuRunTest.cc TaskManager/test/GpuRunTest/gpu/twice.cl example/fft/Makefile.def example/fft/Makefile.gpu example/fft/gpu/gpu_task_init.cc example/fft/main.cc example/fft/output.pgm example/fft/task_init.cc example/multiply/Makefile.def example/multiply/Makefile.gpu example/multiply/gpu/task_init.cc example/multiply/main.cc |
diffstat | 12 files changed, 37 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/test/GpuRunTest/GpuRunTest.cc Mon Sep 30 19:01:12 2013 +0900 +++ b/TaskManager/test/GpuRunTest/GpuRunTest.cc Tue Oct 08 01:38:29 2013 +0900 @@ -11,7 +11,7 @@ static int length = DEFAULT; static int times = 2; static int task = 1; - +static CPU_TYPE spe_cpu = SPE_ANY; extern void gpu_task_init(void); extern void task_init(void); @@ -49,6 +49,8 @@ task = atoi(argv[++i]); } else if (strcmp(argv[i], "-t") == 0) { times = atoi(argv[++i]); + } else if (strcmp(argv[i], "-any") == 0) { + spe_cpu = ANY_ANY; } } @@ -86,7 +88,7 @@ HTaskPtr twice = manager->create_task(Twice); twice->set_param(0, (memaddr)length); - twice->set_param(3, (memaddr)times); + twice->set_param(1, (memaddr)times); /* twice->set_param(2, (memaddr)2); twice->set_param(3, (memaddr)3); @@ -100,7 +102,7 @@ //n[0]= 3; //twice->set_inData(1, n, sizeof (int)); twice->set_outData(0, outdata, sizeof (int)*length); - twice->set_cpu(GPU_0); + twice->set_cpu(spe_cpu); /* * set_post() で ppe task を渡せるようにしたい
--- a/TaskManager/test/GpuRunTest/gpu/twice.cl Mon Sep 30 19:01:12 2013 +0900 +++ b/TaskManager/test/GpuRunTest/gpu/twice.cl Tue Oct 08 01:38:29 2013 +0900 @@ -4,18 +4,16 @@ __global int *output_data) { long count = (long)param[0]; - long times = (long)param[3]; + long times = (long)param[1]; for (int i = 0; i<count; i++) { output_data[i] = input_data[i] * times; } - /* - output_data[0] = param[0]; + /* output_data[0] = param[0]; output_data[1] = param[1]; output_data[2] = param[2]; output_data[3] = param[3]; output_data[4] = param[4]; output_data[5] = param[5]; output_data[6] = param[6]; - output_data[7] = param[7]; - */ + output_data[7] = param[7];*/ }
--- a/example/fft/Makefile.def Mon Sep 30 19:01:12 2013 +0900 +++ b/example/fft/Makefile.def Tue Oct 08 01:38:29 2013 +0900 @@ -14,7 +14,7 @@ CFLAGS = -Wall $(OPT) -DUSE_SIMPLE_TASK CXXFLAGS = ${CFLAGS} -INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. +INCLUDE = -I. -I.. -I${CERIUM}/include/TaskManager LIBS = -L${CERIUM}/TaskManager ABIBIT = 64
--- a/example/fft/Makefile.gpu Mon Sep 30 19:01:12 2013 +0900 +++ b/example/fft/Makefile.gpu Tue Oct 08 01:38:29 2013 +0900 @@ -5,16 +5,16 @@ SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) OBJS = $(SRCS:.cc=.o) -TASK_DIR = gpu +GPU_TASK_DIR = gpu +TASK_DIR = ppe TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc) TASK_SRCS_EXCLUDE = -TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) +TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) $(wildcard $(GPU_TASK_DIR)/*.cc) TASK_OBJS = $(TASK_SRCS:.cc=.o) CC += $(ABI) CFLAGS += -D__CERIUM_GPU__ -INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. LIBS = -L${CERIUM}/TaskManager -DUSE_SIMPLE_TASK -lGpuManager -framework opencl `sdl-config --libs` .SUFFIXES: .cc .o
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/fft/gpu/gpu_task_init.cc Tue Oct 08 01:38:29 2013 +0900 @@ -0,0 +1,13 @@ +#include "Func.h" +#include "GpuScheduler.h" + +void +gpu_task_init(void) +{ + GpuSchedRegister(SPIN_FACT, "gpu/spinFact.cl", "spinFact"); + GpuSchedRegister(BIT_REVERSE, "gpu/bitReverse.cl", "bitReverse"); + GpuSchedRegister(NORMALIZATION, "gpu/norm.cl", "norm"); + GpuSchedRegister(BUTTERFLY, "gpu/butterfly.cl", "butterfly"); + GpuSchedRegister(TRANSPOSE, "gpu/transpose.cl", "transpose"); + GpuSchedRegister(HIGH_PASS_FILTER, "gpu/highPassFilter.cl", "highPassFilter"); +}
--- a/example/fft/main.cc Mon Sep 30 19:01:12 2013 +0900 +++ b/example/fft/main.cc Tue Oct 08 01:38:29 2013 +0900 @@ -15,6 +15,7 @@ #endif #include "pgm.h" extern void task_init(); +extern void gpu_task_init(); #define PI 3.14159265358979 @@ -170,6 +171,8 @@ filename = argv[i+1]; } else if (strcmp(argv[i], "-g") == 0) { spe_cpu = GPU_0; + } else if (strcmp(argv[i], "-any") == 0) { + spe_cpu = ANY_ANY; } } if ( (argc == 1)||(filename==0)) { @@ -275,6 +278,7 @@ int TMmain(TaskManager *manager, int argc, char** argv) { task_init(); + gpu_task_init(); char * pgm_file = init(argc,argv); /* Read image */ int err = readPGM(&ipgm, pgm_file);
--- a/example/fft/task_init.cc Mon Sep 30 19:01:12 2013 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#include "Func.h" -#include "Scheduler.h" -#include "GpuScheduler.h" - -#ifndef __CERIUM_GPU__ -SchedExternTask(setid); -SchedExternTask(spinFact); -SchedExternTask(bitReverse); -SchedExternTask(norm); -SchedExternTask(butterfly); -SchedExternTask(transpose); -SchedExternTask(highPassFilter); -#endif // not __CERIUM_GPU__ - -void -task_init(void) -{ -#ifdef __CERIUM_GPU__ - GpuSchedRegister(SPIN_FACT, "gpu/spinFact.cl", "spinFact"); - GpuSchedRegister(BIT_REVERSE, "gpu/bitReverse.cl", "bitReverse"); - GpuSchedRegister(NORMALIZATION, "gpu/norm.cl", "norm"); - GpuSchedRegister(BUTTERFLY, "gpu/butterfly.cl", "butterfly"); - GpuSchedRegister(TRANSPOSE, "gpu/transpose.cl", "transpose"); - GpuSchedRegister(HIGH_PASS_FILTER, "gpu/highPassFilter.cl", "highPassFilter"); -#else - SchedRegisterTask(SPIN_FACT,spinFact); - SchedRegisterTask(NORMALIZATION, norm); - SchedRegisterTask(BIT_REVERSE, bitReverse); - SchedRegisterTask(BUTTERFLY, butterfly); - SchedRegisterTask(TRANSPOSE, transpose); - SchedRegisterTask(HIGH_PASS_FILTER, highPassFilter); -#endif -}
--- a/example/multiply/Makefile.def Mon Sep 30 19:01:12 2013 +0900 +++ b/example/multiply/Makefile.def Tue Oct 08 01:38:29 2013 +0900 @@ -11,5 +11,5 @@ OPT = -g CFLAGS = $(OPT) -Wall -INCLUDE = -I. -I.. -I${CERIUM}/include/TaskManager +INCLUDE = -I.. -I. -I${CERIUM}/include/TaskManager LIBS = -L${CERIUM}/TaskManager
--- a/example/multiply/Makefile.gpu Mon Sep 30 19:01:12 2013 +0900 +++ b/example/multiply/Makefile.gpu Tue Oct 08 01:38:29 2013 +0900 @@ -5,10 +5,11 @@ SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) OBJS = $(SRCS:.cc=.o) -TASK_DIR = gpu +GPU_TASK_DIR = gpu +TASK_DIR = ppe TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc) TASK_SRCS_EXCLUDE = -TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) +TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) $(wildcard $(GPU_TASK_DIR)/*.cc) TASK_OBJS = $(TASK_SRCS:.cc=.o) LIBS += `sdl-config --libs` -lGpuManager -framework opencl
--- a/example/multiply/gpu/task_init.cc Mon Sep 30 19:01:12 2013 +0900 +++ b/example/multiply/gpu/task_init.cc Tue Oct 08 01:38:29 2013 +0900 @@ -1,16 +0,0 @@ -#include "Func.h" -#include "GpuScheduler.h" - -/* 必ずこの位置に書いて */ - -/** - * この関数は ../spe/spe-main と違って - * 自分で呼び出せばいい関数なので - * 好きな関数名でおk (SchedRegisterTask は必須) - */ - -void -task_init(void) -{ - GpuSchedRegister(MULTIPLY_TASK, "gpu/Multi.cl","multi"); -}
--- a/example/multiply/main.cc Mon Sep 30 19:01:12 2013 +0900 +++ b/example/multiply/main.cc Tue Oct 08 01:38:29 2013 +0900 @@ -6,6 +6,7 @@ #include "Func.h" extern void task_init(void); +extern void gpu_task_init(void); static int task = 1; static int length = DATA_NUM; static CPU_TYPE spe_cpu = SPE_ANY; @@ -58,6 +59,8 @@ task = atoi(argv[++i]); } else if (strcmp(argv[i], "-print") == 0) { print_flag = 1; + } else if (strcmp(argv[i], "-any") == 0) { + spe_cpu = ANY_ANY; } } } @@ -108,6 +111,7 @@ init(argc, argv); // Task Register task_init(); + gpu_task_init(); for (int i = 0; i < task; ++i) { multi_init(manager); }