Posts

Showing posts from 2014

Hello World using OpenCL

I've recently acquired a new laptop with an API Radeon GPU. I'm always interested in HPC and how it is used in various industries and research areas. I had experience with MPI/OpenMP earlier but not got a chance to look into GPU style frameworks such as CUDA or OpenCL. I've a lot of free time these days, so I studied some online tutorials and got a little bit familiar with OpenCL and it's very interesting to me. I'm using AMD's APP SDK 2.9 for my work, my first OpenCL code as below, it can be compiled using gcc with -lOpenCL #include <stdio.h> #include <string.h> #include <CL/cl.h> const char source[] = " \ __kernel void hello( __global char* buf, __global char* buf2 ){ \ int x = get_global_id(0); \ buf2[x] = buf[x]; \ }"; int main() { char buf[]="Hello, World!"; char build_c[4096]; size_t srcsize, worksize=strlen(buf); cl_platform_id platform; cl_d