Mercurial > hg > Game > Cerium
changeset 1795:0aefbf042eb3 draft
setting Data method change set_param to set_inData
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 04 Dec 2013 19:20:20 +0900 |
parents | 3d53b0ca02a2 |
children | 355304646b4b |
files | example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc |
diffstat | 2 files changed, 16 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/main.cc Wed Dec 04 18:01:17 2013 +0900 +++ b/example/regex_mas/main.cc Wed Dec 04 19:20:20 2013 +0900 @@ -30,18 +30,6 @@ int spe_num = 1; unsigned char *sword = 0; -/* - * set_inData_num - * task_array[k] = manager->create_task_array - * (TASK_EXEC,array_task_num,set_param_num,input_set_inData,1); - * create_task_arrayの第四引数でset_inDataの数を指定させている。 - * これにメチャクチャハマったので注意 - * いつかはcreate_task_arrayを消したい - */ -int set_inData_num = 3; -int set_param_num = 1; -int set_out_num = 1; - int task_count = 0; static int division = 16; // in Kbyte @@ -116,7 +104,7 @@ if (use_task_array) { int task_num = (w->size+size-1)/size; if (task_num>array_task_num) task_num = array_task_num; - task_array = manager->create_task_array(TASK_EXEC,task_num,4,1,1); + task_array = manager->create_task_array(TASK_EXEC,task_num,1,3,1); if (!all) { t_next->wait_for(task_array); } else { @@ -133,11 +121,10 @@ if (use_task_array) { t_exec = task_array->next_task_array(TASK_EXEC,t_exec); t_exec->set_inData(0,w->file_mmap + a*w->division_size, size); + t_exec->set_inData(1,w->search_word, w->search_word_len); + t_exec->set_inData(2,w->BMskip_table, 256); t_exec->set_param(0,(long)a); - t_exec->set_param(1,w->search_word); - t_exec->set_param(2,(long)w->search_word_len); - t_exec->set_param(3,w->BMskip_table); t_exec->set_outData(0,w->o_data + a*w->out_size, w->division_out_size); } else if (use_compat) { @@ -223,7 +210,7 @@ } static void -run_start(TaskManager *manager, char *filename,unsigned char *search_word) +run_start(TaskManager *manager, char *filename,unsigned char *search_word, int search_word_len) { HTaskPtr t_print; @@ -234,9 +221,9 @@ // bzero(w,sizeof(WordCount)); /* prepare BMSearch*/ - int *skip = (int*)manager->allocate(sizeof(int)*256); + int *skip = (int*)manager->allocate(256); w->search_word = search_word; - w->search_word_len = strlen((const char*)w->search_word); + w->search_word_len = search_word_len; w->BMskip_table = create_BMskiptable(w->search_word, w->search_word_len, skip); w->extra_len = w->search_word_len - 1; @@ -347,13 +334,14 @@ char *filename = init(argc, argv); - int sw_len = strlen((const char*)sword); - unsigned char *search_word = (unsigned char*)manager->allocate(sw_len); - memcpy(search_word, sword, sw_len + 1); + int sw_len = strlen((const char *)sword); + //int sw_len = 5; + unsigned char *search_word = (unsigned char*)manager->allocate(sw_len + 1); + memcpy(search_word, sword, sw_len); task_init(); st_time = getTime(); - run_start(manager, filename,search_word); + run_start(manager, filename, search_word, sw_len); manager->set_TMend(TMend); return 0; }
--- a/example/regex_mas/ppe/Exec.cc Wed Dec 04 18:01:17 2013 +0900 +++ b/example/regex_mas/ppe/Exec.cc Wed Dec 04 19:20:20 2013 +0900 @@ -34,19 +34,19 @@ { //get_inData unsigned char *i_data = (unsigned char *)s->get_input(rbuf,0); + unsigned char *search_word = (unsigned char *)s->get_input(rbuf,1); + int *skip_table = (int *)s->get_input(rbuf,2); + int length = (int)s->get_inputSize(0); + int sw_len = (int)s->get_inputSize(1); //get_param - long task_count = (long)s->get_param(0); - unsigned char *search_word = (unsigned char*)s->get_param(1); - long sw_len = (long)s->get_param(2); - int *skip_table = (int*)s->get_param(3); + long task_count = (long)s->get_param(0); s->printf("[task count: %lld]\n",task_count); s->printf("[search word: %s]\n",search_word); s->printf("[search word len : %d]\n",sw_len); - unsigned long long *o_data = (unsigned long long*)s->get_output(wbuf,0); o_data[0] = 0; o_data[0] = BM_method(i_data,length,search_word,sw_len,skip_table);