summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--hello_world.c17
2 files changed, 20 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a89a9c9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,3 @@
+
+hello_world: hello_world.o
+ gcc -o hello_world $^ -L/home/tstellar/mesa/lib -lOpenCL
diff --git a/hello_world.c b/hello_world.c
index a6624b4..22ccea7 100644
--- a/hello_world.c
+++ b/hello_world.c
@@ -38,6 +38,9 @@ int main(int argc, char ** argv)
cl_command_queue command_queue;
+ cl_mem out_buffer;
+ float out_value = 0.0;
+
error = clGetPlatformIDs(
1, /* Max number of platform IDs to return */
&platform_id, /* Pointer to platform_id */
@@ -91,5 +94,19 @@ int main(int argc, char ** argv)
}
fprintf(stderr, "clCreateCommandQueue() succeeded.\n");
+
+ out_buffer = clCreateBuffer(context,
+ CL_MEM_WRITE_ONLY, /* Flags */
+ sizeof(float), /* Size of buffer */
+ NULL, /* Pointer to the data */
+ &error); /* error code */
+
+ if (error != CL_SUCCESS) {
+ fprintf(stderr, "clCreateBuffer() failed: %s\n", err_string(error));
+ return EXIT_FAILURE;
+ }
+
+ fprintf(stderr, "clCreateBuffer() succeeded.\n");
+
return EXIT_SUCCESS;
}