Mercurial > hg > Game > Cerium
changeset 1897:606f6f6cb784 draft
run wordcount used iterate
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 14 Jan 2014 19:20:56 +0900 |
parents | 7790ef405810 |
children | ef52a2b07344 |
files | TaskManager/Makefile.parallel example/word_count/gpu/Exec_Data_Parallel.cl example/word_count/main.cc example/word_count/ppe/Exec_Data_Parallel.cc |
diffstat | 4 files changed, 22 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Makefile.parallel Sun Jan 12 12:12:01 2014 +0900 +++ b/TaskManager/Makefile.parallel Tue Jan 14 19:20:56 2014 +0900 @@ -20,7 +20,7 @@ ALL_OBJS = $(KERN_MAIN_OBJS) $(KERN_PPE_OBJS) $(KERN_SCHED_OBJS) \ $(KERN_SYSTASK_OBJS) $(IMPL_MANYCORE_OBJS) $(KERN_MEM_OBJS) \ - Cell/CellTaskManagerImpl.o Cell/spe/SpeTaskManagerImpl.o + $(IMPL_MANYCORE_OBJS) Cell/CellTaskManagerImpl.o Cell/spe/SpeTaskManagerImpl.o Makefile.dep: make -f Makefile.parallel depend
--- a/example/word_count/gpu/Exec_Data_Parallel.cl Sun Jan 12 12:12:01 2014 +0900 +++ b/example/word_count/gpu/Exec_Data_Parallel.cl Tue Jan 14 19:20:56 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 Sun Jan 12 12:12:01 2014 +0900 +++ b/example/word_count/main.cc Tue Jan 14 19:20:56 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 Sun Jan 12 12:12:01 2014 +0900 +++ b/example/word_count/ppe/Exec_Data_Parallel.cc Tue Jan 14 19:20:56 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;