Mercurial > hg > Game > Cerium
view example/Bulk/spe/Twice.cc @ 2069:26aa08c9a1de draft default tip
cuda example fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 12 Feb 2017 10:04:55 +0900 |
parents | 64f1d80dc650 |
children |
line wrap: on
line source
#include <stdio.h> #include "SchedTaskArray.h" #include "Twice.h" #include "Func.h" /* これは必須 */ SchedDefineTask(Twice); static int run(SchedTask *s,void *rbuf, void *wbuf) { // SchedTaskArray *a = (SchedTaskArray *)s; int *i_data; int *o_data; long length; int data_count = (int)s->get_param(0); for(int j = 0; j<data_count; j++) { i_data = (int*)s->get_input(rbuf, j); o_data = (int*)s->get_output(wbuf, j); length = (long)s->get_param(j+1); for (int i = 0; i < length; i++) { o_data[i] = i_data[i] * 2; } } return 0; }