Results 1 to 3 of 3

Thread: Errors Running AMD OpenCL Tutorial Code

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    5

    Errors Running AMD OpenCL Tutorial Code

    Hi folks

    It's been many years since I did any C++ coding. I've recently begun some work at grad school that requires me to learn openCL. I've installed the newest SDK, and I'm trying to run one of the example codes given in the ATi Parallel Processing Programming Guide (http://developer.amd.com/gpu_assets/ATI ... _Guide.pdf) at Section 1.9.1. I ran the code using
    Code :
    gcc -I../include/ eg1.cpp
    and I got the following error message.
    Code :
    /tmp/ccfkQlRl.o: In function `main':
    eg1.cpp:(.text+0x25): undefined reference to `clGetPlatformIDs'
    eg1.cpp:(.text+0x48): undefined reference to `clGetDeviceIDs'
    eg1.cpp:(.text+0x6f): undefined reference to `clCreateContext'
    eg1.cpp:(.text+0x90): undefined reference to `clCreateCommandQueue'
    eg1.cpp:(.text+0xb5): undefined reference to `clCreateProgramWithSource'
    eg1.cpp:(.text+0xdf): undefined reference to `clBuildProgram'
    eg1.cpp:(.text+0xf5): undefined reference to `clCreateKernel'
    eg1.cpp:(.text+0x11a): undefined reference to `clCreateBuffer'
    eg1.cpp:(.text+0x143): undefined reference to `clSetKernelArg'
    eg1.cpp:(.text+0x186): undefined reference to `clEnqueueNDRangeKernel'
    eg1.cpp:(.text+0x192): undefined reference to `clFinish'
    eg1.cpp:(.text+0x1dd): undefined reference to `clEnqueueMapBuffer'
    /tmp/ccfkQlRl.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
    collect2: ld returned 1 exit status
    And I haven't been able to figure out what I'm doing wrong. I would really appreciate any help.

    Thanks

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: Errors Running AMD OpenCL Tutorial Code

    You need to link against the OpenCL library. Surely the examples from the ATI SDK come with makefiles or similar. Why not use them?

    You can try

    Code :
    gcc -I../include/ eg1.cpp -lOpenCL

    and see if it works (it should work if OpenCL is installed in the usual location).
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3
    Junior Member
    Join Date
    Dec 2010
    Posts
    5

    Re: Errors Running AMD OpenCL Tutorial Code

    Thanks, it works now!

Similar Threads

  1. Replies: 1
    Last Post: 12-06-2010, 10:39 AM
  2. Convolution Example/Tutorial from AMD
    By dbs2 in forum OpenCL
    Replies: 3
    Last Post: 10-21-2009, 04:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •