summaryrefslogtreecommitdiff
path: root/get_global_id_2d.c
diff options
context:
space:
mode:
Diffstat (limited to 'get_global_id_2d.c')
-rw-r--r--get_global_id_2d.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/get_global_id_2d.c b/get_global_id_2d.c
index ae940e7..be16038 100644
--- a/get_global_id_2d.c
+++ b/get_global_id_2d.c
@@ -5,6 +5,8 @@
#include "util.h"
+#define GLOBAL_DIM_X 10
+#define GLOBAL_DIM_Y 10
int main (int argc, char ** argv)
{
@@ -12,8 +14,9 @@ int main (int argc, char ** argv)
cl_int error;
cl_mem out_buffer;
- int out_data[10][10];
- size_t global_work_size[2] = {10, 10};
+ int out_data[GLOBAL_DIM_X * GLOBAL_DIM_Y];
+ size_t global_work_size[2] = {GLOBAL_DIM_X, GLOBAL_DIM_Y};
+ size_t local_work_size[2] = {5, 5};
struct clu_context context;
@@ -36,7 +39,7 @@ int main (int argc, char ** argv)
2, /* dimensions */
NULL,
global_work_size,
- global_work_size,
+ local_work_size,
0, NULL, NULL);
assert(error == CL_SUCCESS);
@@ -51,9 +54,9 @@ int main (int argc, char ** argv)
assert(error == CL_SUCCESS);
- for (i = 0; i < 10; i++) {
- for (j = 0; j < 10; j++) {
- fprintf(stderr, "%2u ", out_data[i][j]);
+ for (i = 0; i < GLOBAL_DIM_X; i++) {
+ for (j = 0; j < GLOBAL_DIM_Y; j++) {
+ fprintf(stderr, "%2u ", out_data[i * GLOBAL_DIM_Y + j]);
}
fprintf(stderr, "\n");
}