Mercurial > hg > Game > Cerium
changeset 1101:1da96a535437 draft
fix.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 31 Dec 2010 16:29:20 +0900 |
parents | dcb025b46cae |
children | 8d2a1f5edf10 |
files | example/ResizeWritebuf/main.cc |
diffstat | 1 files changed, 0 insertions(+), 100 deletions(-) [+] |
line wrap: on
line diff
--- a/example/ResizeWritebuf/main.cc Fri Dec 31 16:24:01 2010 +0900 +++ b/example/ResizeWritebuf/main.cc Fri Dec 31 16:29:20 2010 +0900 @@ -13,7 +13,6 @@ static int data_length = 1; extern TaskManager *manager; -int use_task_creater = 0; const char *usr_help_str = "Usage: ./resize [-cpu spe_num] [-count N]\n\ -cpu Number of SPE (default 1) \n\ @@ -36,105 +35,6 @@ } -static void simple_task_creater(int in_total_size, int out_total_size, - int command, int in_data_size, int out_data_size, - void *in_data, void *out_data, TaskManager *manager, - HTask *wait_i, HTask *wait_me) { - - - int in_task_size = 0; - int out_task_size = 0; - - if (in_total_size != 0) { - in_task_size = in_total_size / in_data_size; - if (in_total_size != in_task_size * in_data_size) { - printf("mismatch of in_total_size and in_data_size\n"); - } - } - - if (out_total_size != 0) { - out_task_size = out_total_size / out_data_size; - if (out_total_size != out_task_size * out_data_size) { - printf("mismatch of out_total_size and out_data_size\n"); - } - } - - /*in, out の大きい方に合わせるのがいいかな? Taskの数は1Task分に使うデータの大きいほうを取るような仕様がいいかな*/ - int task_num = (in_task_size > out_task_size) ? in_task_size : out_task_size; - - if (task_num == 0) task_num = 1; - - /*spe分あればいいのかな?*/ - - int array_num = spe_num; - if (task_num < array_num) { - array_num = task_num; - } - - - int array_length = task_num / array_num; - int rest = task_num % array_num; - - HTaskPtr *task_array = (HTask**)manager->allocate(sizeof(HTask*)*array_num); - TaskPtr *t_exec = (Task**)manager->allocate(sizeof(Task*)*array_length*array_num); - - int index = 0; - - for (int k = 0; k < array_num; k++) { - - task_array[k] = manager->create_task_array(command,array_length,0,1,1); - t_exec[k] = 0; - - if (wait_me != 0) { - wait_me->wait_for(task_array[k]); - } - if (wait_i != 0) { - task_array[k]->wait_for(wait_i); - } - - } - - for (int j = 0; j < array_length; j++) { - for (int k = 0; k < array_num; k++) { - - t_exec[k] = task_array[k]->next_task_array(command,t_exec[k]); - t_exec[k]->set_inData(0,(char*)in_data + index*in_data_size, in_data_size); - t_exec[k]->set_outData(0,(char*)out_data + index*out_data_size, out_data_size); - - index++; - - } - } - - for (int k = 0; k < array_num; k++) { - task_array[k]->spawn_task_array(t_exec[k]->next()); - task_array[k]->set_cpu(SPE_ANY); - task_array[k]->spawn(); - } - - for (int k = 0; k < rest; k++) { - HTaskPtr t_exec = manager->create_task(command); - - t_exec->set_inData(0,(char*)in_data + index*in_data_size, in_data_size); - t_exec->set_outData(0,(char*)out_data + index*out_data_size, out_data_size); - - index++; - - if (wait_me != 0) { - wait_me->wait_for(t_exec); - } - if (wait_i != 0) { - t_exec->wait_for(wait_i); - } - - t_exec->set_cpu(SPE_ANY); - t_exec->spawn(); - - } - - -} - static void checkData(SchedTask *s, void *data, void *arg1) {