diff example/share_task/spe/Load.cc @ 0:04e28d8d3c6f

first commit
author Daiki KINJYO <e085722@ie.u-ryukyu.ac.jp>
date Mon, 08 Nov 2010 01:23:25 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/share_task/spe/Load.cc	Mon Nov 08 01:23:25 2010 +0900
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <string.h>
+#include "Load.h"
+#include "Func.h"
+
+/* これは必須 */
+SchedDefineTask(Load);
+
+static int
+run(SchedTask *s, void *rbuf, void *wbuf)
+{
+    int *idata = (int*)s->get_input(rbuf, 0);
+    int *odata;
+    int length = (long)s->get_param(0);
+
+    // SPU LS 内に領域確保し、データをコピー
+    odata = (int*)s->global_alloc(DATA_ID, sizeof(int)*length);
+    memcpy(odata, idata, sizeof(int)*length);
+
+    s->printf("[TASK_LOAD]    ");
+    for (int i = 0; i < length; i++) {
+	s->printf("%03d ", odata[i]);
+    }
+    s->printf("\n");
+
+    return 0;
+}