diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2012-02-09 13:10:30 -0500 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2012-02-09 13:10:30 -0500 |
commit | 63fd66aa1a490748c4f4d2a4bd43d5b228b1e2ac (patch) | |
tree | 7faf4ec6841865cf25d8e02c5471622cbde3a4f3 | |
parent | a9836d7e0b4a34297c61f6a1fb5b49dbe4514869 (diff) |
Add makefile and update
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | hello_world.c | 17 |
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; } |