comparison ppe/Menu.cc @ 2:1e1b0d280427

commit
author yutaka@localhost.localdomain
date Wed, 07 Apr 2010 05:18:52 +0900
parents dcd83cefb980
children 8b4d6bf8c43d
comparison
equal deleted inserted replaced
1:dcd83cefb980 2:1e1b0d280427
4 #include "Sys.h" 4 #include "Sys.h"
5 #include "params.h" 5 #include "params.h"
6 6
7 //headk_num と send_param_head の値を必ず返さないと、動作しない 7 //headk_num と send_param_head の値を必ず返さないと、動作しない
8 8
9 send_params_head_t* 9 task_head_t*
10 menu(int &head_num) { 10 menu(int &list_num) {
11 11
12 head_num = SPE_NUM; 12 list_num = SPE_NUM;
13 int all_task_num = SPE_NUM*1000; 13 int all_task_num = SPE_NUM*1000;
14 //int all_task_num = 1; 14 //int all_task_num = 1;
15 //int task_size = MAX_DMA_SIZE; 15 //int task_size = MAX_DMA_SIZE;
16 int task_size = 16*1024; 16 int task_size = 16*1024;
17 int in_size = (task_size - sizeof(send_params_head_t)) * all_task_num; 17 //int in_size = (task_size - sizeof(task_head_t)) * all_task_num;
18 int out_size = (task_size - sizeof(send_params_head_t)) * all_task_num; 18 //int out_size = (task_size - sizeof(task_head_t)) * all_task_num;
19 19
20 int *in; 20 int in_size = (task_size - sizeof(task_head_t));
21 int *out = (int*)allocate(out_size); 21 int out_size = (task_size - sizeof(task_head_t));
22 22
23 int partition_size = task_size - sizeof(send_params_head_t); 23 task_head_t *list_head = (task_head_t*)allocate(sizeof(task_head_t)*list_num);
24 send_params_t *send_params = (send_params_t*)allocate(sizeof(send_params_t)*all_task_num);
25 24
26 send_params_head_t *head = (send_params_head_t*)allocate(sizeof(send_params_head_t)*head_num); 25 int list_length = all_task_num / list_num;
27 26
28 for (int i = 0; i < all_task_num; i++) { 27 for (int i = 0; i < list_num; i++) {
29 28
30 send_params[i] = task_allocate(task_size); // header と、in サイズを確保するよ。 29 list_head[i].ea_out = 0;
31 in = (int*)send_params[i].buff; 30 list_head[i].size_out = 0;
32 31 list_head[i].pin_in = 0;
33 for (int j = 0; j < partition_size / sizeof(int); j++) { 32 list_head[i].pin_out = 0;
34 in[j] = j; 33
35 //printf("%f\n",in[j]); 34 task_t *tail = (task_t*)allocate(sizeof(task_t));
35 tail->head = &list_head[i];
36 tail->input = NULL;
37
38 for (int j = 0; j < list_length; j++) {
39
40 task_t *task = task_allocate(in_size, out_size);
41 int *in = (int*)task->input;
42
43 for (int k = 0; k < in_size / sizeof(int); k++) {
44 in[k] = k;
45 }
46
47 int pin_in = 0;
48 int pin_out = 0;
49
50 set_pin(task, pin_in, pin_out);
51 tail = add_list(tail, task);
52
36 } 53 }
37 54
38 } 55 }
39 56
40 int task_list_length = all_task_num / head_num;
41 int index = 0;
42
43 for (int i = 0; i < head_num; i++) {
44
45 head[i].next_task = (unsigned long) send_params[index].head;
46 head[i].next_task_size = task_size;
47
48 head[i].ea_out = (unsigned long) &out[(index * partition_size) / sizeof(int)];
49 head[i].size_out = partition_size;
50
51 head[i].pin_in = 0;
52 head[i].pin_out = 0;
53
54
55 for (int j = 0; j < task_list_length - 1; j++) {
56
57 //Cerium を要チェック
58
59 send_params[index].head->next_task = (unsigned long) send_params[index+1].head;
60 send_params[index].head->next_task_size = task_size;
61
62 send_params[index].head->ea_out = (unsigned long) &out[((index) * partition_size) / sizeof(int)];
63 send_params[index].head->size_out = partition_size;
64
65 send_params[index].head->pin_in = 0;
66 send_params[index].head->pin_out = 0;
67
68 index++;
69
70
71 }
72
73
74 send_params[index].head->next_task = 0;
75 send_params[index].head->next_task_size = 0;
76
77 send_params[index].head->ea_out = (unsigned long) &out[(index) * partition_size / sizeof(int)];
78
79 //printf("[PPE] %p\n",(unsigned long)send_params[index].head->ea_out);
80
81 //send_params[index].head->ea_out = 0;
82 send_params[index].head->size_out = partition_size;
83
84 send_params[index].head->pin_in = 0;
85 send_params[index].head->pin_out = 0;
86
87 //send_params[index].head = NULL;
88
89 index++;
90
91
92 }
93
94 printf("return run\n"); 57 printf("return run\n");
95 58
96 return head; 59 return list_head;
97 60
98 } 61 }