Mercurial > hg > Game > Cerium
changeset 1763:be15a4d33605 draft
worked except GPU
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 23 Nov 2013 01:08:32 +0900 |
parents | b53d197ec03d |
children | 6929e4c02c4d |
files | TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/kernel/ppe/TaskList.cc TaskManager/kernel/ppe/TaskList.h TaskManager/test/UtilizationTest/Makefile.gpu TaskManager/test/UtilizationTest/gpu/task_init.cc TaskManager/test/UtilizationTest/main.cc TaskManager/test/UtilizationTest/multiply |
diffstat | 7 files changed, 30 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Sat Nov 23 00:18:59 2013 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Sat Nov 23 01:08:32 2013 +0900 @@ -122,13 +122,13 @@ } } int dim ; - if ( (dim = ((TaskList*)(htask->rbuf))->ismultidim() ) && speid >= id_offset ) { + if ( (dim = ((TaskList*)(htask->rbuf))->ismultidim(cpu_num) ) && speid >= id_offset ) { // multi dimenstion task on CPU will be copied to all CPU for(int i=1; i < dim && i < cpu_num ; i++ ) { TaskList *tl = (TaskList*)(htask->rbuf); while(tl) { TaskListPtr dm = createTaskList(); - memcpy(tl,dm, ((memaddr)dm->last()) - (memaddr(dm))); + memcpy(dm,tl, ((memaddr)tl->last()) - (memaddr(tl))); taskListInfo[i+id_offset]->addLast(dm); tl = tl->next; }
--- a/TaskManager/kernel/ppe/TaskList.cc Sat Nov 23 00:18:59 2013 +0900 +++ b/TaskManager/kernel/ppe/TaskList.cc Sat Nov 23 01:08:32 2013 +0900 @@ -4,7 +4,7 @@ class HTask; -int TaskList::ismultidim() { +int TaskList::ismultidim(int cpu_num) { TaskList* p = this; int dim_count = 0; int dim_count_max = 0; @@ -12,6 +12,7 @@ if (p->dim>0) { dim_count = (p->x)*(p->y)*(p->z); if (dim_count_max < dim_count) dim_count_max = dim_count; + if (dim_count > cpu_num) dim_count = cpu_num; p->self->flag.dim_count = dim_count; } else p->self->flag.dim_count = 1; @@ -23,8 +24,14 @@ void TaskList::print() { printf("dim %d,x %d,y %d,z %d,cpu %d\n",dim,(int)x,(int)y,(int)z,cpu); Task* t = &tasks[0]; + Task* p = t; + int i = 0; while(t<last()) { printf("command %s\n",task_list[t->command].name); t = t->next(); + if (i++ & 1) p = p->next(); + if (t==p) { + printf(" ... looped\n"); break; + } } }
--- a/TaskManager/kernel/ppe/TaskList.h Sat Nov 23 00:18:59 2013 +0900 +++ b/TaskManager/kernel/ppe/TaskList.h Sat Nov 23 01:08:32 2013 +0900 @@ -29,7 +29,7 @@ void init() { lastTask = ((memaddr)&tasks[TASK_MAX_SIZE])-(memaddr)(tasks); waiter=this; dim=0;} void initOnce() { } void freeOnce() {} - int ismultidim(); + int ismultidim(int cpu_num); void print(); } ;
--- a/TaskManager/test/UtilizationTest/Makefile.gpu Sat Nov 23 00:18:59 2013 +0900 +++ b/TaskManager/test/UtilizationTest/Makefile.gpu Sat Nov 23 01:08:32 2013 +0900 @@ -5,12 +5,21 @@ SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) OBJS = $(SRCS:.cc=.o) -TASK_DIR = gpu +GPU_TASK_DIR = gpu +GPU_TASK_SRCS_TMP = $(wildcard $(GPU_TASK_DIR)/*.cc) +GPU_TASK_SRCS_EXCLUDE = +GPU_TASK_SRCS = $(filter-out $(GPU_TASK_DIR)/$(GPU_TASK_SRCS_EXCLUDE),$(GPU_TASK_SRCS_TMP)) +GPU_TASK_OBJS = $(GPU_TASK_SRCS:.cc=.o) + +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_OBJS = $(TASK_SRCS:.cc=.o) +CFLAGS += -DGPU + + LIBS += `sdl-config --libs` -lGpuManager -framework opencl .SUFFIXES: .cc .o @@ -20,8 +29,8 @@ all: $(TARGET) -$(TARGET): $(OBJS) $(TASK_OBJS) - $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS) +$(TARGET): $(OBJS) $(TASK_OBJS) $(GPU_TASK_OBJS) + $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(GPU_TASK_OBJS) $(LIBS) link: $(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
--- a/TaskManager/test/UtilizationTest/gpu/task_init.cc Sat Nov 23 00:18:59 2013 +0900 +++ b/TaskManager/test/UtilizationTest/gpu/task_init.cc Sat Nov 23 01:08:32 2013 +0900 @@ -10,7 +10,7 @@ */ void -task_init(void) +gpu_task_init(void) { GpuSchedRegister(MULTIPLY_TASK, "gpu/Multi.cl","multi"); }
--- a/TaskManager/test/UtilizationTest/main.cc Sat Nov 23 00:18:59 2013 +0900 +++ b/TaskManager/test/UtilizationTest/main.cc Sat Nov 23 01:08:32 2013 +0900 @@ -6,6 +6,9 @@ #include "Func.h" extern void task_init(void); +#ifdef GPU +extern void gpu_task_init(); +#endif static int task = 1; static int length = DATA_NUM; const char *usr_help_str = "Usage: ./multiply \n"; @@ -153,6 +156,9 @@ init(argc, argv); // Task Register task_init(); +#ifdef GPU + gpu_task_init(); +#endif for (int i = 0; i < task; ++i) { multi_init(manager); }