Compiling SDK source files

Hy Guys,
I’m pretty new to GPGPU Development but trying to make some GPU benchmarks on different CUDA languages in a scientific framework.
What I’m trying to do now is just to compile the bandwidth.cpp source file in the OpenCl SDK.

When I try to run the Makefile in ~/NVIDIA_GPU_Computing_SDK/OpenCL/bin/linux/release> it works fine but as soon as I try to compile bandwidth.cpp with

[font=“Courier New”]user@computer:~/NVIDIA_GPU_Computing_SDK/OpenCL/src/oclBandwidthTest> gcc -I ~/NVIDIA_GPU_Computing_SDK/OpenCL/common/inc/ -L ~/NVIDIA_GPU_Computing_SDK/OpenCL/common/lib -lOpenCL -L /usr/lib64/libOpenCL.so -I ~/NVIDIA_GPU_Computing_SDK/shared/inc/ oclBandwidthTest.cpp
[/font]

I always get in the console

[font=“Courier New”]/tmp/ccT9pYop.o: In function printHelp()': oclBandwidthTest.cpp:(.text+0x19): undefined reference to shrLog’
oclBandwidthTest.cpp:(.text+0x32): undefined reference to shrLog' oclBandwidthTest.cpp:(.text+0x4b): undefined reference to shrLog’
oclBandwidthTest.cpp:(.text+0x64): undefined reference to shrLog' oclBandwidthTest.cpp:(.text+0x7d): undefined reference to shrLog’
/tmp/ccT9pYop.o:oclBandwidthTest.cpp:(.text+0x96): more undefined references to shrLog' follow /tmp/ccT9pYop.o: In function testDeviceToDeviceTransfer(unsigned int)’:
oclBandwidthTest.cpp:(.text+0x8cd): undefined reference to shrDeltaT' oclBandwidthTest.cpp:(.text+0x954): undefined reference to shrDeltaT’
/tmp/ccT9pYop.o: In function testHostToDeviceTransfer(unsigned int, accessMode, memoryMode)': oclBandwidthTest.cpp:(.text+0xbea): undefined reference to shrDeltaT’
oclBandwidthTest.cpp:(.text+0xdc5): undefined reference to shrDeltaT' /tmp/ccT9pYop.o: In function testDeviceToHostTransfer(unsigned int, accessMode, memoryMode)’:
oclBandwidthTest.cpp:(.text+0x11c1): undefined reference to shrDeltaT' /tmp/ccT9pYop.o:oclBandwidthTest.cpp:(.text+0x134a): more undefined references to shrDeltaT’ follow
/tmp/ccT9pYop.o: In function testBandwidthShmoo(memcpyKind, printMode, accessMode, memoryMode, int, int)': oclBandwidthTest.cpp:(.text+0x16b1): undefined reference to shrLog’
oclBandwidthTest.cpp:(.text+0x16e7): undefined reference to shrLog' /tmp/ccT9pYop.o: In function runTest(int, char const**)’:
oclBandwidthTest.cpp:(.text+0x1b4e): undefined reference to shrCheckCmdLineFlag' oclBandwidthTest.cpp:(.text+0x1b79): undefined reference to shrCheckCmdLineFlag’
…[/font]

and I don’t know what to do to get it working.
Maybe you guys see what I forgot, so please help me, I need this to work desperatly.

Thank you so much!

Running OpenSuse 11.2 x64

OpenCL SW Info:

CL_PLATFORM_NAME: NVIDIA
CL_PLATFORM_VERSION: OpenCL 1.0
OpenCL SDK Version: 1.2.0.16

OpenCL Device Info:

of devices supporting OpenCL = 2:

CL_DEVICE_VENDOR: NVIDIA Corporation
CL_DEVICE_NAME: GeForce GTX 280
CL_DRIVER_VERSION: 190.29

try:

cd ~/NVIDIA_GPU_Computing_SDK/sdk/shared

make

then link ~/NVIDIA_GPU_Computing_SDK/sdk/shared/lib/libshrutil_x86_64.a to your gcc command

may be this will help

Thanks for your quick reply, I tried to link the library with

[font=“Courier New”]

gcc -I ~/NVIDIA_GPU_Computing_SDK/OpenCL/common/inc/ -L ~/NVIDIA_GPU_Computing_SDK/OpenCL/common/lib/liboclUtil.a -L~/NVIDIA_GPU_Computing_SDK/shared/lib/libshrutil.a -L /usr/lib64/libOpenCL.so -I~/NVIDIA_GPU_Computing_SDK/shared/lib/linux oclBandwidthTest.cpp[/font]

but I get the same errors over and over.

Any other suggestions?

Thank you very much!

-L is for directory containing the lib files and not to specify a lib file

-l is to specify a lib file

when using 64bit your libs must all be 64bit. eg OpenCL/common/lib must be lib64

i donot have opencl on linux, but please try my make file and see if it works

1.save this as ‘Makefile’

  1. then run ‘make’

  2. run ./oclBandwidthTest

to clean run make clean