diff ppe/Menu.cc @ 0:68a98d68d62a

commit
author yutaka@localhost.localdomain
date Sun, 28 Mar 2010 19:47:00 +0900
parents
children dcd83cefb980
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ppe/Menu.cc	Sun Mar 28 19:47:00 2010 +0900
@@ -0,0 +1,98 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "Menu.h"
+#include "Sys.h"
+#include "params.h"
+
+//headk_num と send_param_head の値を必ず返さないと、動作しない
+
+send_params_head_t*
+menu(int &head_num) {
+
+  head_num = SPE_NUM;
+  int all_task_num = SPE_NUM*1000;
+  //int all_task_num = 1;
+  //int task_size = MAX_DMA_SIZE;
+  int task_size = 16*1024;
+  int in_size  = (task_size - sizeof(send_params_head_t)) * all_task_num;
+  int out_size = (task_size - sizeof(send_params_head_t)) * all_task_num;
+
+  float *in;
+  float *out = (float*)allocate(out_size);
+
+  int partition_size = task_size - sizeof(send_params_head_t);
+  send_params_t *send_params = (send_params_t*)allocate(sizeof(send_params_t)*all_task_num);
+
+  send_params_head_t *head = (send_params_head_t*)allocate(sizeof(send_params_head_t)*head_num);
+
+  for (int i = 0; i < all_task_num; i++) {
+
+    send_params[i] = task_allocate(task_size); // header と、in サイズを確保するよ。
+    in = (float*)send_params[i].buff;
+    
+    for (int j = 0; j < partition_size / sizeof(float); j++) {
+      in[j] = j;
+      //printf("%f\n",in[j]);
+    }
+
+  }
+
+  int task_list_length = all_task_num / head_num;
+  int index = 0;
+
+  for (int i = 0; i < head_num; i++) {
+
+    head[i].next_task = (unsigned long) send_params[index].head;
+    head[i].next_task_size = task_size;
+
+    head[i].ea_out   = (unsigned long) &out[(index * partition_size) / sizeof(float)];
+    head[i].size_out = partition_size;
+
+    head[i].pin_in   = 0;
+    head[i].pin_out  = 0;
+
+
+    for (int j = 0; j < task_list_length - 1; j++) {
+
+      //Cerium を要チェック
+
+      send_params[index].head->next_task      = (unsigned long) send_params[index+1].head;
+      send_params[index].head->next_task_size = task_size;
+
+      send_params[index].head->ea_out = (unsigned long) &out[((index) * partition_size) / sizeof(float)];
+      send_params[index].head->size_out = partition_size;
+
+      send_params[index].head->pin_in = 0;
+      send_params[index].head->pin_out = 0;
+
+      index++;
+     
+
+    }
+
+    
+    send_params[index].head->next_task      = 0;
+    send_params[index].head->next_task_size = 0;
+
+    send_params[index].head->ea_out = (unsigned long) &out[(index) * partition_size / sizeof(float)];
+
+    //printf("[PPE] %p\n",(unsigned long)send_params[index].head->ea_out);
+
+    //send_params[index].head->ea_out = 0;
+    send_params[index].head->size_out = partition_size;
+    
+    send_params[index].head->pin_in = 0;
+    send_params[index].head->pin_out = 0;
+
+    //send_params[index].head = NULL;
+    
+    index++;
+
+    
+  }
+
+  printf("return run\n");
+  
+  return head;
+
+}