cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

mihzaha
Journeyman III

choosing the right tools, getting started with openCL

Hy there

I would like to get started with programming in oenCL and I'm not sure where to begin.

---1)First of all, what are my possibilities for openCL implementations and what are the inconvenients of using one of them?

I've heard of ATI stream, openTK and Nvidia's openCL.

ATI Stream is  incomplete, but I can wait until q4 of 2009.

I had trouble understanding if openTK has an implementation for openCL and if I can compile openCL code with it without needing more than a c compiler.

NVIDIA's is said to be kind of functional, but I have an ATI card and it is mentioned in the faq that I have to recompile a program in order for it to work on other cards:

"At this time, AMD does not plan to have the ATI Stream SDK support GPU products from other vendors; however, since OpenCL is an industry standard programming interface, programs written in OpenCL 1.0 can be recompiled and run with any OpenCL-compliant compiler and runtime."

but on other forum someone replied:
"They are just different implementations of the same API (the same as the difference between NVIDIA and AMD's OpenGL drivers). Programs written to the spec should run correctly on any hardware, this is one of the main advantages of OpenCL."

(I don't have to recompile a program using openGL in order to work on different cards, or is it about the runtime compilation that doesn't affect the user)

---2)Is there a tutorial or something to bring a bit of light into preparing the computer for compiling OpenCL code? And is the executable program portable to other GPU's?

Thank you, and sorry for the long and ambiguous question.

0 Likes
3 Replies
omkaranathan
Adept I

Originally posted by: mihzahaIThey are just different implementations of the same API (the same as the difference between NVIDIA and AMD's OpenGL drivers). Programs written to the spec should run correctly on any hardware, this is one of the main advantages of OpenCL." 

(I don't have to recompile a program using openGL in order to work on different cards

They are just different implementations of the same API.However, as of now the specification does not require the libraries from different vendors to be binary compatible with each other unlike OpenGL.This is a situation which is expected to be remedied soon and till then you will have to recompile the code to run with different implementations

 

Is there a tutorial or something to bring a bit of light into preparing the computer for compiling OpenCL code?

Compiling OpenCL code is straightforward, you just have to set the appropriate paths to the includes and libraries just like normal C/C++ applications. Location of headers and libraries can be found at ATI_Stream_SDK_Getting_Started_Guide included in the SDK.

 

 And is the executable program portable to other GPU's?

You will have to recompile the code to run in other GPUs



0 Likes

thank you

It seams I can wait untill 4th quarter... I don't have a SSE3 compliant proccessor The programs just fail with: "failed to initialize..."

0 Likes
Illusio
Journeyman III

Originally posted by: mihzahaI had trouble understanding if openTK has an implementation for openCL and if I can compile openCL code with it without needing more than a c compiler.


The OpenCL spec really is two things.

1. A specification of a compiler service that applications can use. That is, your application will either ship with OpenCL sourcecode, or automatically generate such sourcecode. Your application will make calls into OpenCL to compile that code to device specific kernels, either "just-in-time" or during installation. Your application can then extract references to compiled kernels and has access to methods to set arguments and actually execute the kernels.

2. Runtime support services for kernel execution. This includes such things as memory mapping and interop with graphics libraries like OpenGL and DirectX.

 

So, your question could get several conflicting answers, depending on what area the person answering is focusing on.

First, although the details are still being ironed out, there will be a single vendor-neutral OpenCL library to link your application to - your application will run unmodified on different vendor's hardware. Just like OpenGL. Although recompilation is necessary today due to some minor differences in symbol naming, by the time you have an actual application to ship - it won't be a problem. No source level changes should be required to obtain future interopability - just concentrate on programming to the spec.

Second, the binary programs that your application compiles using the OpenCL compiler service are platform specific. Not only are they not compatible between computers, but OpenCL may be compiling several incompatible kernels for different devices on one computer. One for GPU and one for CPU for example, or different code for different GPUs if you have several GPUs in your system.

Although it may sound confusing if you haven't looked at the spec yet, it really isn't, the procedure to compile kernels and possibly store the binary, is very straight forward, and when starting out, you don't even have to worry about managing binary images - that's just an optional optimization to cut startup time.

 

OpenTK is not an OpenCL implementation. It's just bindings to bridge in an OpenCL implementation, like AMDs, to .Net. I'm a bit surprised that you can't get examples to work. Have you had actually downloaded the Stream SDK and had OpenCL.dll in the path when you tried to execute your application. It seems odd that it should require SSE3, are you absolutely sure that's the issue? The reason I'm asking is that there is an issue using OpenCL from microsoft's managed debugger. I have to enable native debugging on the project's debugging page to execute managed OpenCL applications from within Visual Studio.

 

If you'd like to play and have a look at how OpenCL can work in a practical application(I.e., when OpenCL is wrapped in higher level classes), I dumped some of my own code into a sourceforge project at:

http://sourceforge.net/projects/openclnet/develop

The project is standalone, contains bindings to OpenCL, with two simple examples. One in C# and one in Visual basic.

Of course, if you're planning to code in C++, both OpenTK and my project are completely useless to you and your point of reference should be the include files from one of the OpenCL SDKs. Given those, a C compiler is more than sufficient to produce OpenCL applications.

 

0 Likes