3 Replies Latest reply on Sep 23, 2012 8:55 AM by illoran

    Trouble with cl::Platform

    illoran

      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.

        • Re: Trouble with cl::Platform
          settle

          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.

          • Re: Trouble with cl::Platform
            harshita317

            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

             

             

             

            [url="www.deshmeaaj.com"]dainik bhasker[/url]

             

            Message was edited by: harshita gupta

             

            Message was edited by: harshita gupta