Mercurial > hg > Game > Cerium
view example/Prime/ppe/PrintTask.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 | 24d323dfebea |
children |
line wrap: on
line source
#include <stdio.h> #include "SchedTask.h" #include "PrintTask.h" #include "Func.h" SchedDefineTask1(PrintTask, print); static int print(SchedTask *smanager, void *rbuf, void *wbuf) { long print_flag = (long)smanager->get_param(1); //プリントするかどうか if (print_flag < 0) { return 0; } long length = (long)smanager->get_param(0); /* 出力する範囲 */ bool *input = (bool*)smanager->get_input(rbuf, 0); /* 出力する配列 */ input[0] = false; input[1] = false; /* 素数の判定結果が1ならば出力する */ for (long i = 0; i < length; i++) { if ( input[i] == true ) { printf("%ld ",i); } } printf("\n"); return 0; }