diff example/share_task/spe/Load.cc @ 109:5c194c71eca8

Cerium cvs version
author gongo@gendarme.local
date Wed, 12 Nov 2008 17:39:33 +0900
parents
children 58fd16298954
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/share_task/spe/Load.cc	Wed Nov 12 17:39:33 2008 +0900
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <string.h>
+#include "Load.h"
+#include "Func.h"
+
+/* これは必須 */
+SchedDefineTask(Load);
+
+int
+Load::run(void *rbuf, void *wbuf)
+{
+    int *idata = (int*)get_input(rbuf, 0);
+    int *odata;
+    int length = get_param(0);
+
+    // SPU LS 内に領域確保し、データをコピー
+    odata = (int*)global_alloc(DATA_ID, sizeof(int)*length);
+    memcpy(odata, idata, sizeof(int)*length);
+
+    printf("[TASK_LOAD]    ");
+    for (int i = 0; i < length; i++) {
+	printf("%03d ", odata[i]);
+    }
+    printf("\n");
+
+    return 0;
+}