Mercurial > hg > Game > Cerium
changeset 1902:ef52a2b07344 draft
merge
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 16 Jan 2014 18:08:53 +0900 |
parents | b74327adede7 (current diff) 606f6f6cb784 (diff) |
children | bc1b9af7afb4 |
files | TaskManager/Makefile.parallel |
diffstat | 3 files changed, 21 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/example/word_count/gpu/Exec_Data_Parallel.cl Thu Jan 16 18:07:30 2014 +0900 +++ b/example/word_count/gpu/Exec_Data_Parallel.cl Thu Jan 16 18:08:53 2014 +0900 @@ -7,7 +7,6 @@ long division_size = param[1]; long length = param[2]; long out_size = param[3]; - printf("%ld\n",task_spwaned); long allocation = task_spwaned + (long)get_global_id(0); __global char *i_data = rbuf + allocation*division_size; __global unsigned long *o_data = wbuf + allocation*out_size;
--- a/example/word_count/main.cc Thu Jan 16 18:07:30 2014 +0900 +++ b/example/word_count/main.cc Thu Jan 16 18:08:53 2014 +0900 @@ -25,6 +25,7 @@ int use_task_creater = 0; int use_compat = 0; int use_iterate = 0; +int use_iterate_all = 0; int array_task_num = 8; int spe_num = 1; CPU_TYPE spe_cpu = SPE_ANY; @@ -131,14 +132,16 @@ h_exec->set_cpu(spe_cpu); h_exec->spawn(); } else if (use_iterate) { + if(use_iterate_all) + array_task_num = w->task_num; w->size -= size*array_task_num; if(w->size < 0) array_task_num -= 1; h_exec = manager->create_task(TASK_EXEC_DATA_PARALLEL); - // h_exec->flip(); + h_exec->flip(); h_exec->set_inData(0,w->file_mmap,w->file_size); - // h_exec->set_inData(1,w->o_data,w->out_size_); - // h_exec->set_outData(0,w->file_mmap,w->file_size); - h_exec->set_outData(0,w->o_data,w->out_size_); + h_exec->set_inData(1,w->o_data,w->out_size_); + h_exec->set_outData(0,w->file_mmap,w->file_size); + h_exec->set_outData(1,w->o_data,w->out_size_); h_exec->set_param(0,(long)i); h_exec->set_param(1,(long)w->division_size); h_exec->set_param(2,(long)size); @@ -153,11 +156,11 @@ if(w->size < 0) { h_exec = manager->create_task(TASK_EXEC_DATA_PARALLEL); - // h_exec->flip(); + h_exec->flip(); h_exec->set_inData(0,w->file_mmap,w->file_size); - // h_exec->set_inData(1,w->o_data,w->out_size_); - // h_exec->set_outData(0,w->file_mmap,w->file_size); - h_exec->set_outData(0,w->o_data,w->out_size_); + h_exec->set_inData(1,w->o_data,w->out_size_); + h_exec->set_outData(0,w->file_mmap,w->file_size); + h_exec->set_outData(1,w->o_data,w->out_size_); h_exec->set_param(0,(long)w->task_spwaned); h_exec->set_param(1,(long)w->division_size); h_exec->set_param(2,(long)(size+w->size)); @@ -205,7 +208,9 @@ { WordCount *w = *(WordCount **)in; - if (w->task_num < w->task_blocks) { + if(use_iterate_all) { + run_tasks(manager, w, w->task_num, w->t_print, w->division_size); + } else if (w->task_num < w->task_blocks) { // last case while (w->size >= w->division_size) run_tasks(manager,w,w->task_num, w->t_print, w->division_size); @@ -289,8 +294,7 @@ t_print = manager->create_task(TASK_PRINT, (memaddr)&w->self,sizeof(memaddr),0,0); - w->t_print = t_print; - + w->t_print = t_print; for(int i=0;i<1;i++) { /* Task を task_blocks ずつ起動する Task */ /* serialize されていると仮定する... */ @@ -341,7 +345,11 @@ } else if (strcmp(argv[i], "-i") == 0) { use_iterate = 1; use_task_array = 0; - }/* else if (strcmp(argv[i], "-cpu") == 0) { + } else if (strcmp(argv[i], "-ia") == 0) { + use_iterate_all = 1; + use_iterate = 1; + use_task_array = 0; + } /* else if (strcmp(argv[i], "-cpu") == 0) { spe_num = atoi(argv[i+1]); i++; if (spe_num==0) spe_num = 1;
--- a/example/word_count/ppe/Exec_Data_Parallel.cc Thu Jan 16 18:07:30 2014 +0900 +++ b/example/word_count/ppe/Exec_Data_Parallel.cc Thu Jan 16 18:08:53 2014 +0900 @@ -13,10 +13,9 @@ long division_size = (long)s->get_param(1); long length = (long)s->get_param(2); long out_size = (long)s->get_param(3); - printf("%ld\n",task_spwaned); long allocation = task_spwaned + (long)s->x; char* i_data = (char*)s->get_input(rbuf,0) + allocation*division_size; - unsigned long long* o_data = (unsigned long long*)s->get_output(wbuf,0) + allocation*out_size; + unsigned long long* o_data = (unsigned long long*)s->get_output(wbuf,1) + allocation*out_size; unsigned long long *head_tail_flag = o_data +2; int word_flag = 0; int word_num = 0;