Mercurial > hg > Members > kono > Cerium
changeset 936:14fb1c888931
dead lock on spu/ppu mail
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 31 Jul 2010 05:31:12 +0900 |
parents | e54842e4d97b |
children | 9689cba44964 |
files | TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Cell/CellTaskManagerImpl.h TaskManager/Fifo/FifoTaskManagerImpl.cc TaskManager/Makefile.def example/many_task/ppe/QuickSort.cc example/many_task/sort.cc example/many_task/spe/Makefile example/many_task/spe/QuickSort.cc |
diffstat | 8 files changed, 37 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Sat Jul 31 03:13:24 2010 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Sat Jul 31 05:31:12 2010 +0900 @@ -56,6 +56,7 @@ // spe 側から Task create できない schedTaskManager = new SchedTask(); schedTaskManager->init(0,0,0,ppeManager->get_scheduler()); + ppeManager->schedTaskManager = schedTaskManager; } void @@ -114,7 +115,9 @@ CellTaskManagerImpl::sendTaskList() { for (int i = 0; i < machineNum; i++) { - if ( taskListInfo[i]->length() > 0 ) { + if (! taskListInfo[i]->empty() ) { + mail_check(i); + // SPE に送る TaskList の準備 send_taskList(i); spe_running++; } @@ -124,8 +127,6 @@ void CellTaskManagerImpl::poll() { - mail_check(); - // SPE に送る TaskList の準備 set_runTaskList(); // TaskList 待ちの SPE に TaskList を送る sendTaskList(); @@ -152,35 +153,33 @@ */ void -CellTaskManagerImpl::mail_check() +CellTaskManagerImpl::mail_check(int id) { memaddr data; // SPE Scheduler からの mail check - for (int id = 0; id < machineNum; id++) { - while (speThreads->has_mail(id, 1, &data)) { - if (data == (memaddr)MY_SPE_STATUS_READY) { - // MY_SPE_STATUS_READY: SPE が持ってた Task 全て終了 - // freeAll する前に循環リストに戻す - speTaskList[id]->getLast()->next = speTaskList[id]; - speTaskList[id]->freeAll(); - spe_running--; - } else if (data == (memaddr)MY_SPE_COMMAND_MALLOC) { - // MY_SPE_COMMAND_MALLOC SPE からのmain memory request - send_alloc_reply(this, id, speThreads); - } else if (data > (memaddr)MY_SPE_NOP) { + while (speThreads->has_mail(id, 1, &data)) { + if (data == (memaddr)MY_SPE_STATUS_READY) { + // MY_SPE_STATUS_READY: SPE が持ってた Task 全て終了 + // freeAll する前に循環リストに戻す + speTaskList[id]->getLast()->next = speTaskList[id]; + speTaskList[id]->freeAll(); + spe_running--; + } else if (data == (memaddr)MY_SPE_COMMAND_MALLOC) { + // MY_SPE_COMMAND_MALLOC SPE からのmain memory request + send_alloc_reply(this, id, speThreads); + } else if (data > (memaddr)MY_SPE_NOP) { #ifdef TASK_LIST_MAIL - TaskListPtr list = (TaskListPtr)data; - check_task_list_finish(schedTaskManager, list, waitTaskQueue); + TaskListPtr list = (TaskListPtr)data; + check_task_list_finish(schedTaskManager, list, waitTaskQueue); #else - // 終了したタスク(PPEにあるのでアドレス) - HTaskPtr task = (HTaskPtr)data; - task->post_func(schedTaskManager, task->post_arg1, task->post_arg2); - check_task_finish(task, waitTaskQueue); + // 終了したタスク(PPEにあるのでアドレス) + HTaskPtr task = (HTaskPtr)data; + task->post_func(schedTaskManager, task->post_arg1, task->post_arg2); + check_task_finish(task, waitTaskQueue); #endif - } - // MY_SPE_NOP: 特に意味のないコマンド } + // MY_SPE_NOP: 特に意味のないコマンド } } @@ -189,7 +188,9 @@ { // may call recursively check_task_list_finish() // we need fifo here - mail_check(); + for (int i = 0; i < machineNum; i++) { + mail_check(i); + } } static void
--- a/TaskManager/Cell/CellTaskManagerImpl.h Sat Jul 31 03:13:24 2010 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.h Sat Jul 31 05:31:12 2010 +0900 @@ -24,7 +24,7 @@ void init(); void run(); void poll(); - void mail_check(); + void mail_check(int id); void set_runTaskList(); void sendTaskList(); void append_activeTask(HTaskPtr);
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc Sat Jul 31 03:13:24 2010 +0900 +++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc Sat Jul 31 05:31:12 2010 +0900 @@ -66,9 +66,9 @@ taskListInfo = new TaskListInfo; ppeTaskList = new TaskListInfo; - schedTaskManager = new SchedTask(); + // schedTaskManager = new SchedTask(); others = tm; - schedTaskManager->init(0,0,0,mainScheduler); + // schedTaskManager->init(0,0,0,mainScheduler); }
--- a/TaskManager/Makefile.def Sat Jul 31 03:13:24 2010 +0900 +++ b/TaskManager/Makefile.def Sat Jul 31 05:31:12 2010 +0900 @@ -29,8 +29,8 @@ ABIBIT = 32 -OPT = -g -O9 -# OPT = -g -DTASK_LIST_MAIL -O9 +# OPT = -g -O9 +OPT = -g -DTASK_LIST_MAIL -O9 CC = g++ CFLAGS = -Wall `sdl-config --cflags` -m$(ABIBIT) $(OPT)
--- a/example/many_task/ppe/QuickSort.cc Sat Jul 31 03:13:24 2010 +0900 +++ b/example/many_task/ppe/QuickSort.cc Sat Jul 31 05:31:12 2010 +0900 @@ -21,7 +21,7 @@ // copy value int begin = 0; #if USE_SIMPLE_TASK - long end = s->read_size()/sizeof(Data); + int end = s->read_size()/sizeof(Data); Data *r_data = (Data*)rbuff; #ifdef USE_MEMCPY Data *w_data = (Data*)wbuff; @@ -34,7 +34,7 @@ #endif #endif - //printf("[PPE] Quick: length:%d addr->%x \n",end, (int*)rbuff); + printf("[PPE] Quick: length:%d addr->%x \n",end, (int)rbuff); //printf("[PPE] Quick: data[0]: %d addr->%x\n",sizeof(r_data),r_data); //show_data(r_data, end);
--- a/example/many_task/sort.cc Sat Jul 31 03:13:24 2010 +0900 +++ b/example/many_task/sort.cc Sat Jul 31 05:31:12 2010 +0900 @@ -74,7 +74,6 @@ int last_half_block_num = half_block_num+(last_block_num/2); if (--sort_count < 0) { - check_data(); return; } @@ -155,7 +154,6 @@ if (--sort_count < 0) { - check_data(); return; } @@ -220,7 +218,7 @@ } } - HTask restart = create_task(RESTART,0,0,0,0); + HTask *restart = manager->create_task(RESTART,0,0,0,0); for (int i = 0; i < split_num; i++) { if (!all) restart->wait_for(fsort[i]); fsort[i]->spawn();
--- a/example/many_task/spe/Makefile Sat Jul 31 03:13:24 2010 +0900 +++ b/example/many_task/spe/Makefile Sat Jul 31 05:31:12 2010 +0900 @@ -7,7 +7,7 @@ OBJS = $(SRCS:.cc=.o) CC = spu-g++ -CFLAGS = -O9 -g -Wall -fno-exceptions -fno-rtti #-DDEBUG +CFLAGS += -fno-exceptions -fno-rtti #-DDEBUG INCLUDE = -I../${CERIUM}/include/TaskManager -I. -I.. LIBS = -L../${CERIUM}/TaskManager -lspemanager
--- a/example/many_task/spe/QuickSort.cc Sat Jul 31 03:13:24 2010 +0900 +++ b/example/many_task/spe/QuickSort.cc Sat Jul 31 05:31:12 2010 +0900 @@ -21,7 +21,7 @@ // copy value int begin = 0; #if USE_SIMPLE_TASK - long end = s->read_size()/sizeof(Data); + int end = s->read_size()/sizeof(Data); Data *r_data = (Data*)rbuff; #ifdef USE_MEMCPY Data *w_data = (Data*)wbuff; @@ -34,7 +34,7 @@ #endif #endif - //printf("[PPE] Quick: length:%d addr->%x \n",end, (int*)rbuff); + printf("[SPE] Quick: length:%d addr->%x \n",end, (int)rbuff); //printf("[PPE] Quick: data[0]: %d addr->%x\n",sizeof(r_data),r_data); //show_data(r_data, end);