Mercurial > hg > Game > Cerium
view example/word_count/ppe/Print.cc @ 786:043c98537bc5 draft
fix early free of TaskArray, add SchedTaskArrayNop stage.
author | yutaka@localhost.localdomain |
---|---|
date | Sat, 24 Apr 2010 15:24:33 +0900 |
parents | f02b3338b91b |
children | 852ed17d8af1 |
line wrap: on
line source
#include <stdio.h> #include <string.h> #include "Print.h" #include "Func.h" /* これは必須 */ SchedDefineTask(Print); static int run(SchedTask *s, void *rbuf, void *wbuf) { unsigned long long *idata = (unsigned long long*)s->get_input(rbuf, 0); long task_num = (long)s->get_param(0); long status_num = (long)s->get_param(1); unsigned long long word_data[task_num]; s->printf("start sum\n"); for (int i = 0; i < status_num; i++) { word_data[i] = 0; } for (int i = 0; i < task_num*status_num; i += status_num) { for (int j = 0; j < status_num; j++) { word_data[j] += idata[i+j]; } } for (int i = 0; i < status_num; i++) { s->printf("%llu ",word_data[status_num - i - 1]); } s->printf("\n"); return 0; }