Mercurial > hg > Members > kono > Cerium
view example/word_count/ppe/Print.cc @ 666:4615489c5faa
simplify word_count
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 03 Dec 2009 02:11:31 +0900 |
parents | 60aa3f241b10 |
children | ccf78a465459 |
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 = status_num; i > 0; i--) { s->printf("%llu ",word_data[i-1]); } s->printf("\n"); return 0; }