cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

illoran
Journeyman III

Trouble with cl::Platform

Hi all,

i am very new to OpenCL, so obviously my first step was to do the "Hello World!" thingy from

http://developer.amd.com/tools/hc/AMDAPPSDK/documentation/pages/TutorialOpenCL.aspx.

I'm using the recent AMD APP SDK on an Ubuntu 12.04 Installation. I Have a i7-3770-CPU and no

GPU installed. Everything seems to work fine except for two lines of code:

cl::vector<cl::Platform> platformList;

cl::Platform::get(&platformList);

The gcc-Compiler tell me that there is no method that can take the platformlist of the Type cl::vector<cl::Platform>, it also suggest to

use the STL-Vector, but when i do so there are hundreds of Compiler errors.

gcc -Wall -o hello -L /opt/AMDAPP/lib/ -I /opt/AMDAPP/include/ main.cpp

main.cpp: In Funktion »int main()«:

main.cpp:26:33: Fehler: keine passende Funktion für Aufruf von »cl::Platform::get(cl::vector<cl::Platform>*)«

main.cpp:26:33: Anmerkung: Kandidaten sind:

/opt/AMDAPP/include/CL/cl.hpp:1728:19: Anmerkung: static cl_int cl::Platform::get(std::vector<cl::Platform>*)

/opt/AMDAPP/include/CL/cl.hpp:1728:19: Anmerkung:   keine bekannte Umwandlung für Argument 1 von »cl::vector<cl::Platform>*« nach »std::vector<cl::Platform>*«

Any ideas might be helpful 😃

so long Illo

PS : Sry for german error-messages, i hope they become understandable from the context.

0 Likes
1 Solution
settle
Challenger

It seems you haven't set the library path correctly, either "-L /opt/AMDAPP/lib/x86" or "-L /opt/AMDAPP/lib/x86_64".  By the way, if you followed the installation instructions it should have already put the correct one in your library path and that part won't be necessary.  Next, you need to tell it to link to the libOpenCL.so using "-lOpenCL".

Lastly, unless you specify using macros not to use std::vector or std::string, don't use cl::vector or cl::string.

I hope that gets you up and running.

View solution in original post

0 Likes
3 Replies
settle
Challenger

It seems you haven't set the library path correctly, either "-L /opt/AMDAPP/lib/x86" or "-L /opt/AMDAPP/lib/x86_64".  By the way, if you followed the installation instructions it should have already put the correct one in your library path and that part won't be necessary.  Next, you need to tell it to link to the libOpenCL.so using "-lOpenCL".

Lastly, unless you specify using macros not to use std::vector or std::string, don't use cl::vector or cl::string.

I hope that gets you up and running.

0 Likes

Now it's working perfectly, thank you for the hint on the pathes 😃

0 Likes
harshita317
Journeyman III

Hi,
I wrote a very simple code for testing share resouces. My envorinment: i7-3770k win7 64-bit Intel OpenCL SDK 2013. The attached is my project. When OpenCL kernel ran on CPU device, the results are right. However, when it ran  on GPU device, the results are wrong. Anyone can help me explain this problem?

Thanks in advance.

By the way, when I wanted to debug the OpenCL source code, the debugger doesn't work. However, on the other PC it can work. I don't know why. Can Windows update  cause this issue. I also noticed that some one  met the same problem as well. http://redfort-software.intel.com/en-us/forums/showthread.php?t=101929

Sorry. I can not attach my project. So I posted the source code directly

Main.cpp

#define __CL_ENABLE_EXCEPTIONS

#define CL_USE_DEPRECATED_OPENCL_1_1_APIS

#include

#include

#include

#define DATASIZE 512

#define WORKSIZE 32

#define LOCALSIZE 16

//#define CPU

dainik bhasker

Message was edited by: harshita gupta

Message was edited by: harshita gupta

0 Likes