cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

ysg
Adept I

Undefined behavior when running a simple OpenCL app

Hello,

Recently I stumbled upon this tutorial [ The Big Blob » Getting started with OpenCL and GPU Computing ].  I copied it and ran it (the only change made was changing the CL_DEVICE_TYPE_DEFAULT to CPU.)  Now, this is where the weirdness started.  I've attached the output and I don't understand why I'm seeing the results that I am.  Was there an uninitialized variable?

0 Likes
12 Replies
dipak
Big Boss

The sample code seems working fine on my setup. Please check the return value of each API (say clEnqueueNDRangeKernel) to ensure everything is working fine. If the problem doesn't solve, please share the setup details (cpu, gpu, driver, APP SDK, OS etc.) and output of clinfo.

Regards,

The method clGetPlatformIDs returns a value of -1001.  I don't think that that is a good thing :-] .

[edit]

Also, how can I get more info from these error messages?  I mean, I don't want to just see a number, I also want to see a message or more info of some sort from a number.  How can I get at that information?

This is the code in question:


  cl_platform_id platform_id = NULL;


  cl_device_id device_id = NULL;


  cl_uint ret_num_devices = 0;


  cl_uint ret_num_platforms = 0;


  cl_int ret = clGetPlatformIDs(1, & platform_id, & ret_num_platforms);



  if (CL_SUCCESS != ret)


  {


    printf("The retrieved platform IDs: %d\n\n", ret);



    exit(0);


  }




[edit]

Also, are all messages are moderated all the time or does one's messages stop being moderated after some time?  If so, when?

0 Likes

Refer to specification what error can function return. most of them are defined in cl.h. -1001 is CL_PLATFORM_NOT_FOUND_KHR. That mean OpenCL ICD can't find any valid platform.

Messages are moderated all the time.

0 Likes

Well, I'm officially confused .

Does that mean that my SDK is installed incorrectly?

0 Likes

there must be some problem. you can check if HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors registry key contain some values.

0 Likes

Hi bob smith

Yes, all messages are moderated all of the time. Even the moderators have to approve our own posts. Our current version of the forum platform doesn't give us the ability to whitelist regular users but we *hope* to be able to upgrade at some point where we would have this ability. Thanks for your patience with this. We don't enjoy moderating every post any more than you enjoy being moderated, but we have tried everything in the past and found that spammers (actual human beings, not bots) get very creative and very aggressive and this is our only option for now as no one wants to see an overflowing of posts about magic herbal remedies and worse. Again, we hope to be able to upgrade to a version that allows us to whitelist our regular posters at some point but no firm ETA on that yet. On a similar topic, we have an FAQ thread that may be of help with regard to other forum info at this link should you ever need it: FAQ: AMD Developer Forums

I see.  Thanks for the explanation.

nibal
Challenger

What is your clinfo output?

0 Likes

When you say clinfo, I'm assuming that you mean this executable:

/opt/AMDAPPSDK-2.9-1/bin/x86_64/clinfo

If so, here is its output:

$ ./clinfo

terminate called after throwing an instance of 'cl::Error'

  what():  clGetPlatformIDs

Aborted

0 Likes

There is also this utility:

http://sourceforge.net/projects/clinfo/

Which is best?  Does it matter?

0 Likes

If it's this link, then this is the output:

$ ./clinfo.sh

CPU Vendor : INTEL

CPU Family : xeon

CPU Model : N/A

CPU Gflops : N/A

CPU Cores :  4

GPU Vendor : AMD/ATI

GPU Family : fire

GPU Model : N/A

GPU Codename : N/A

GPU Gflops : 0

GPU OpenCL :

GPU Cores-TMU-ROP : N/A

GPU Mem Bandwidth: N/A

GPU Mem Interface: N/A

[edit]

Had a look at this as well:

http://graphics.stanford.edu/~yoel/notes/clInfo.c

This is the output:

$ ./clinfo

Unable to query the number of platforms: unknown error -1001

0 Likes

Just checking whether your issue has been resolved or not? Did you try the latest APP SDK 3.0 beta?

0 Likes