An OpenCL hello world using cuda on arch linux

by Carson Reynolds

I’ve been maintaining cuda on arch linux for about a year now. One thing I’ve always wanted is a simple hello world example to get going. Recently, I found an OpenCL hello world written for Linux.

Here is a quick set of instructions to build and run the hello world on arch linux:

1) Install cuda using yaourt. (If you haven’t installed yaourt do so with these instructions).

yaourt -S cuda

2) After cuda is installed, download the hello world source file:

wget http://donkey.vernier.se/~yann/hellocl.c

3) Compile the file using nvcc:

nvcc -lOpenCL hellocl.c -o helloworld

4) If that succeeds, try to run the example:

./helloworld

It ought to output the following:

Uryyb, Jbeyq!
Hello, World!

Now you have a simple, working example of OpenCL code. Hope that helps get you hacking your GPU.

Advertisements