Mercurial > hg > Members > kono > Cerium
changeset 635:8cc609285bbe
SimpleTask worked on Mac OS X
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 18 Nov 2009 18:36:25 +0900 |
parents | 0558abba673c |
children | d433fc37587d |
files | TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Cell/PpeScheduler.cc TaskManager/Cell/PpeScheduler.h TaskManager/Cell/spe/CellScheduler.cc TaskManager/Fifo/FifoTaskManagerImpl.cc TaskManager/Fifo/MainScheduler.cc TaskManager/Fifo/MainScheduler.h TaskManager/kernel/ppe/TaskManagerImpl.cc TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTask.h TaskManager/kernel/schedule/Scheduler.cc TaskManager/kernel/schedule/Scheduler.h example/Simple/ppe/Twice.cc example/Simple/spe/Twice.cc |
diffstat | 14 files changed, 23 insertions(+), 65 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Wed Nov 18 17:29:14 2009 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Wed Nov 18 18:36:25 2009 +0900 @@ -7,7 +7,7 @@ #include "CellTaskListInfo.h" #include "HTaskInfo.h" #include "SchedTask.h" -#include "PpeScheduler.h" +#include "MainScheduler.h" #include "types.h" CellTaskManagerImpl::~CellTaskManagerImpl() @@ -53,7 +53,7 @@ // PPE 側の管理をする Manager ppeManager = new FifoTaskManagerImpl(machineNum); // 大半のTaskQueueInfoは、共有される - ppeManager->init(new PpeScheduler, this); + ppeManager->init(new MainScheduler, this); ppeManager->get_scheduler()->set_manager(this); schedTaskManager = new SchedTask(); @@ -276,6 +276,7 @@ void* CellTaskManagerImpl::allocate(int size, int alignment) { + if (size==0) return 0; void *buff; posix_memalign(&buff, alignment, size); return buff; @@ -284,6 +285,7 @@ void* CellTaskManagerImpl::allocate(int size) { + if (size==0) return 0; void *buff; posix_memalign(&buff, DEFAULT_ALIGNMENT, size);
--- a/TaskManager/Cell/PpeScheduler.cc Wed Nov 18 17:29:14 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -#include <stdlib.h> -#include <string.h> -#include "PpeScheduler.h" - -void* -PpeScheduler::allocate(int size) -{ - void *buff; - - posix_memalign(&buff, DEFAULT_ALIGNMENT, size); - bzero(buff, size); - - return buff; -}
--- a/TaskManager/Cell/PpeScheduler.h Wed Nov 18 17:29:14 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#ifndef INCLUDED_PPE_SCHEDULER -#define INCLUDED_PPE_SCHEDULER - -#include "MainScheduler.h" - -class PpeScheduler : public MainScheduler { -public: - void *allocate(int size); -}; - -#endif
--- a/TaskManager/Cell/spe/CellScheduler.cc Wed Nov 18 17:29:14 2009 +0900 +++ b/TaskManager/Cell/spe/CellScheduler.cc Wed Nov 18 18:36:25 2009 +0900 @@ -20,12 +20,6 @@ // Fifo ではSPEは無いので呼び出されない } -void* -CellScheduler::allocate(int size) -{ - return memalign(DEFAULT_ALIGNMENT, size); -} - /** * メインメモリ領域を allocate する。 * allocate した領域のアドレスは mainMem_get で取得するが、
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc Wed Nov 18 17:29:14 2009 +0900 +++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc Wed Nov 18 18:36:25 2009 +0900 @@ -30,10 +30,9 @@ mailManager->init(20); scheduler = new MainScheduler(); - scheduler->init(); + scheduler->init(this); scheduler->set_mailManager(mailManager); scheduler->id = 0; - scheduler->set_manager(this); taskListImpl = new TaskListInfo; taskQueueImpl = new TaskQueueInfo; @@ -60,7 +59,7 @@ //scheduler = new MainScheduler(); scheduler = _sched; - scheduler->init(); + scheduler->init(this); scheduler->set_mailManager(mailManager); taskListImpl = tm-> taskListImpl ; @@ -224,7 +223,8 @@ void* FifoTaskManagerImpl::allocate(int size, int alignment) { -#ifdef __APPLE__ + if (size==0) return 0; +#if defined(__APPLE__) && ! defined(HAS_POSIZ_MEMALIGN) return malloc(size); #else void *buff; @@ -236,7 +236,8 @@ void* FifoTaskManagerImpl::allocate(int size) { -#ifdef __APPLE__ + if (size==0) return 0; +#if defined(__APPLE__) && ! defined(HAS_POSIZ_MEMALIGN) return malloc(size); #else void *buff;
--- a/TaskManager/Fifo/MainScheduler.cc Wed Nov 18 17:29:14 2009 +0900 +++ b/TaskManager/Fifo/MainScheduler.cc Wed Nov 18 18:36:25 2009 +0900 @@ -38,19 +38,6 @@ } -void* -MainScheduler::allocate(int size) -{ -#ifdef HAS_POSIX_MEMALIGN - void *ptr; - posix_memalign(&ptr,SPE_ALIGNMENT_FULL, size); -#else - void *ptr = malloc(size); -#endif - - return ptr; -} - /** * メインメモリ領域を allocate する。
--- a/TaskManager/Fifo/MainScheduler.h Wed Nov 18 17:29:14 2009 +0900 +++ b/TaskManager/Fifo/MainScheduler.h Wed Nov 18 18:36:25 2009 +0900 @@ -13,7 +13,6 @@ void send_mailList(MailQueuePtr mail_list); MailQueuePtr recv_mailList(void); - virtual void *allocate(int size); void mainMem_alloc(int id, int size); };
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Wed Nov 18 17:29:14 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Wed Nov 18 18:36:25 2009 +0900 @@ -101,7 +101,7 @@ append_waitTask(task); } - systask_finish->wait_for(task); + // systask_finish->wait_for(task); } /**
--- a/TaskManager/kernel/schedule/SchedTask.cc Wed Nov 18 17:29:14 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Wed Nov 18 18:36:25 2009 +0900 @@ -126,13 +126,13 @@ // 書き込む領域がなければ無視 #ifdef SIMPLE_TASK + if (task->w_size > 0) { + scheduler->dma_store(writebuf, task->wbuf,task->w_size, DMA_READ); + } +#else if (outListData->length > 0) { scheduler->dma_storeList(outListData, writebuf, DMA_WRITE); } -#else - if (task->w_size > 0) { - scheduler->dma_store(writebuf, task->wbuf,task->w_size, DMA_READ); - } #endif }
--- a/TaskManager/kernel/schedule/SchedTask.h Wed Nov 18 17:29:14 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.h Wed Nov 18 18:36:25 2009 +0900 @@ -90,8 +90,6 @@ int get_outputSize(int index); memaddr get_param(int index); - - void* global_alloc(int id, int size); void* global_get(int id); void global_set(int id, void *addr);
--- a/TaskManager/kernel/schedule/Scheduler.cc Wed Nov 18 17:29:14 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Wed Nov 18 18:36:25 2009 +0900 @@ -22,9 +22,10 @@ */ void -Scheduler::init() +Scheduler::init(TaskManagerImpl *m) { hash = 0; + set_manager(m); init_impl(); for (int i = 0; i < 2; i++) { @@ -403,7 +404,8 @@ } void Scheduler::spawn_task(HTask * t) { manager->spawn_task(t); } void Scheduler::set_task_cpu(HTask * t, CPU_TYPE cpu) { manager->set_task_cpu(t,cpu); } -void* Scheduler::allocate(int size,int align) { return allocate(size); } +void* Scheduler::allocate(int size,int align) { return manager->allocate(size,align); } +void* Scheduler::allocate(int size) { return manager->allocate(size,DEFAULT_ALIGNMENT); } long Scheduler::get_random() { #if defined(__SPU__) return 0;
--- a/TaskManager/kernel/schedule/Scheduler.h Wed Nov 18 17:29:14 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Wed Nov 18 18:36:25 2009 +0900 @@ -78,7 +78,7 @@ SchedTaskBase* task3; /* functions */ - void init(); + void init(TaskManagerImpl *m); void run(); virtual void init_impl() {}; void finish(); @@ -99,7 +99,6 @@ void global_set(int id, void *addr); void global_free(int id); MemList* createMemList(int size, int count); - virtual void *allocate(int size) { return NULL; }; void free_(void *p) { free(p); } virtual void mainMem_alloc(int id, int size) {}; @@ -136,6 +135,7 @@ void set_task_depend(HTask * master, HTask * slave) ; void spawn_task(HTask * t) ; void set_task_cpu(HTask * t, CPU_TYPE cpu) ; + void *allocate(int size); void* allocate(int size,int align) ; long get_random() ; Scheduler *get_scheduler() { return this; };
--- a/example/Simple/ppe/Twice.cc Wed Nov 18 17:29:14 2009 +0900 +++ b/example/Simple/ppe/Twice.cc Wed Nov 18 18:36:25 2009 +0900 @@ -15,7 +15,7 @@ i_data = (int*)rbuf; o_data = (int*)wbuf; - length = s->read_size(); + length = s->read_size()/sizeof(int); for (int i = 0; i < length; i++) { o_data[i] = i_data[i] * 2;
--- a/example/Simple/spe/Twice.cc Wed Nov 18 17:29:14 2009 +0900 +++ b/example/Simple/spe/Twice.cc Wed Nov 18 18:36:25 2009 +0900 @@ -15,7 +15,7 @@ i_data = (int*)rbuf; o_data = (int*)wbuf; - length = s->read_size(); + length = s->read_size()/sizeof(int); for (int i = 0; i < length; i++) { o_data[i] = i_data[i] * 2;