Mercurial > hg > Game > Cerium
annotate example/Prime/ppe/PrintTask.cc @ 1439:20e935f170c1 draft
add Makefile for gpu
author | Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 07 Apr 2012 11:43:05 +0900 |
parents | 24d323dfebea |
children |
rev | line source |
---|---|
1171 | 1 #include <stdio.h> |
2 #include "SchedTask.h" | |
3 #include "PrintTask.h" | |
4 #include "Func.h" | |
5 | |
6 SchedDefineTask1(PrintTask, print); | |
7 | |
8 static int | |
9 print(SchedTask *smanager, void *rbuf, void *wbuf) | |
10 { | |
1232 | 11 long print_flag = (long)smanager->get_param(1); //プリントするかどうか |
1194
7909536bf611
fix Prime/PrintTask
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
1189
diff
changeset
|
12 |
7909536bf611
fix Prime/PrintTask
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
1189
diff
changeset
|
13 if (print_flag < 0) { |
7909536bf611
fix Prime/PrintTask
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
1189
diff
changeset
|
14 return 0; |
7909536bf611
fix Prime/PrintTask
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
1189
diff
changeset
|
15 } |
7909536bf611
fix Prime/PrintTask
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
1189
diff
changeset
|
16 |
1232 | 17 long length = (long)smanager->get_param(0); /* 出力する範囲 */ |
18 bool *input = (bool*)smanager->get_input(rbuf, 0); /* 出力する配列 */ | |
1171 | 19 |
1243 | 20 input[0] = false; |
21 input[1] = false; | |
22 | |
1171 | 23 /* 素数の判定結果が1ならば出力する */ |
1232 | 24 for (long i = 0; i < length; i++) { |
25 if ( input[i] == true ) { | |
1263 | 26 printf("%ld ",i); |
1171 | 27 } |
28 } | |
1263 | 29 printf("\n"); |
1171 | 30 return 0; |
31 } |