annotate example/OpenCL/twice.cl @ 1455:2b886dcc0e7d draft

add OpenCL example
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Tue, 08 May 2012 18:40:10 +0900
parents
children a9da5c6bea91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1455
2b886dcc0e7d add OpenCL example
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 __kernel void
2b886dcc0e7d add OpenCL example
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 twice(__global int *input_data,
2b886dcc0e7d add OpenCL example
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 __global int *output_data,
2b886dcc0e7d add OpenCL example
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 __global int *data_count)
2b886dcc0e7d add OpenCL example
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 {
2b886dcc0e7d add OpenCL example
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 int count = *data_count;
2b886dcc0e7d add OpenCL example
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 for (int i = 0; i<count; i++) {
2b886dcc0e7d add OpenCL example
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 output_data[i] = input_data[i] * 2;
2b886dcc0e7d add OpenCL example
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 }
2b886dcc0e7d add OpenCL example
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
2b886dcc0e7d add OpenCL example
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 }