view example/word_count/ppe/Print.cc @ 444:afbc6ec42c7f draft

test_render is not working...
author game@henri.cr.ie.u-ryukyu.ac.jp
date Fri, 25 Sep 2009 05:54:33 +0900
parents cb06748ba6cf
children 839e34d0cc3c
line wrap: on
line source

#include <stdio.h>
#include <string.h>
#include "Print.h"
#include "Func.h"

/* これは必須 */
SchedDefineTask(Print);

int
Print::run(void *rbuf, void *wbuf)
{
    unsigned long long *idata = (unsigned long long*)get_input(rbuf, 0);
    int task_num = get_param(0);
    int status_num = get_param(1);
    unsigned long long word_data[task_num];

    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++) {
	printf("%llu ",word_data[i]);
    }

    printf("\n");


    return 0;
}