Friday, June 3, 2011

Anjuta Project Wizards for AMD, NVidia and Intel OpenCL SDK

Aiming at increasing the OpenCL developing, I created some wizards to start up an OpenCL application project using the SDK from NVidia, AMD or Intel. I've used Anjuta DevStudio on Linux.

This is just a first approach, so don't be disappointed if you need to do some changes. The wizards give you a simple functional code and you can work on this one.

System requirements (they depend on your goal):

OpenCL Syntax Highlighting
Usually, files with .cl extension don't have any associated language specification. Download the opencl.lang (http://www.streamcomputing.eu/downloads/?opencl.lang, by the way, thanks to streamcomputing blog) and copy it to your ~/.local/share/gtksourceview-2.0/language-specs directory. Make a test opening a .cl file with gedit.

Anjuta DevStudio

It is a versatile software development studio featuring a number of advanced programming facilities including project management, application wizard, interactive debugger, source editor, version control, GUI designer, profiler and many more tools. It focuses on providing simple and usable user interface, yet powerful for efficient development. [http://projects.gnome.org/anjuta/]

New OpenCL Wizards
Create (if that's not there) your ~/.local/share/anjuta/project
~/.local/share/anjuta/project$ tar xvzf OpenCLWizards.tgz

Open anjuta and try to create a New Project.



Now we can see new types of project wizard in the C tab: AMD and Intel and in the C++ tab: AMD, Intel and NVidia.

AMD APP SDK
Creating a C project:






For C++ applications the process is similar. The file templates are based on Template and TemplateC from the SDK and the projects will be created (default) in "samples/opencl/myprojects/app". If you change the default destination, please be careful of relative references in the Makefile.

NVidia SDK
For NVidia applications we have only the C++. Even though the samples' code are standard C, the provided Makefile and includes are made targeting g++. That's not a problem and you can write your code in C as well as C++. The wizard will ask you for the "NVIDIA_GPU_Computing_SDK" path. By default, projects will be created in "OpenCL/myprojects".

Intel SDK
Like for AMD SDK we have C and C++ wizards. But, they use Makefiles generated by the autotools. Intel SDK in Linux environments is not yet stable, so these wizards regard the folder where you have installed the lib64(yes, for Linux we have, until now, just the 64bits version) and include folders provided by the SDK package. By default projects will be installed at the same include and lib64 directory level.

Moreover, the Makefiles take into account these points:
  • CL includes: -I../../include
  • CL Dynamic Library: -lOpenCL (located at lib64/libOpenCL.so)



To run your OpenCL programs sometimes you need to define the work directory, executable and possible parameters.


Final Considerations
I hope these wizards give you some curiosity to start programming in OpenCL. Feel free to ask me if you have any questions or just to comment.

2 comments:

Vincent Hindriksen said...

You're welcome! Many thanks for making this tutorial to get it to work with Anjuta. Did not know it could use lang-files.

Unknown said...

Nice work!