cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

Highlighted
Adept I
Adept I

Error in 'cl.hpp'

Hello everyone, thanks again for taking me here. I am new in this world of GPGPU, I'm still learning a lot, briefly, I am wanting to use GPUs with application purpose in medical image processing, for algorithms that require high computational resource, such as segmentation algorithms and co-registration.

As said, i had installed the sdk amd-app-sdk 3.0, and started coding examples in C, and all worked very well.

However when enters in C ++, I'm having some problems, i am a newbie, if anyone can help me, I will be grateful.

My problem is 'simple' when I compile any code in C ++ does not work, the cl.hpp class encounters an error.

Here is a code of an empty main program (full_context.cpp) when it generates a compile error, i tried to install other versions amd-app-sdk sdk, but not changed: 

The comand:

make g++ -Wall -DUNIX -g -DDEBUG  -m64 -o full_context full_context.cpp -I. -I/opt/AMDAPPSDK-2.9-1/include -L/opt/AMDAPPSDK-2.9-1/lib/x86_64 -lOpenCL

The result:

/opt/AMDAPPSDK-2.9-1/include/CL/cl.hpp:477:1: error: expected unqualified-id before ‘{’ token

{

^

full_context.cpp:20:1: error: expected ‘}’ at end of input

}

^

make: ** [full_context] Erro 1

The code:

#define _CRT_SECURE_NO_WARNINGS

#define __CL_ENABLE_EXCEPTIONS

#define __NO_STD_STRING

#include <iostream>

#ifdef MAC

#include <OpenCL/cl.hpp>

#else

#include <CL/cl.hpp>

#endif

using namespace std;

int maind (void){

return 0;

}

--Some extra information

I working on UBUNTU mint

clinfo:

Platform Vendor:        Advanced Micro Devices, Inc.

Platform Version:       OpenCL 2.0 AMD-APP (1729.3)

Platform Name:         AMD Accelerated Parallel Proces

Device OpenCL C version: OpenCL C 2.0

Driver version:         1729.3 (VM)

I am newbie, maybe i forgetting to install something very simple for C++ codes, no C ++ code works, since the codes in C work very well.

if anyone can help me, I will be grateful.

0 Kudos
Reply
7 Replies
Highlighted
Challenger
Challenger

Re: Error in 'cl.hpp'

Alexandre,

First thing you need to do is run clinfo and see if you agree with its output.

Second thing is to go to /opt/AMDAPPSDK-3.0/samples/opencl and cmake everything under there. All the code is c++. This is to verify your installation.

Nikos

0 Kudos
Reply
Highlighted
Adept I
Adept I

Re: Error in 'cl.hpp'

Hi nibal,

I decided to uninstall everything and reinstall again.

Installed in the path "/opt/AMDAPPSDK-2.9-1/"

When i go to  "/opt/AMDAPPSDK-2.9-1/samples/opencl", i run the command cmake -G "Unix Makefiles"

sudo cmake -G "Unix Makefiles"

[sudo] password for alexandrefreitas:

-- The C compiler identification is GNU 4.8.4

-- The CXX compiler identification is GNU 4.8.4

-- Check for working C compiler: /usr/bin/cc

-- Check for working C compiler: /usr/bin/cc -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working CXX compiler: /usr/bin/c++

-- Check for working CXX compiler: /usr/bin/c++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.

Please set them or make sure they are set and tested correctly in the CMake files:

OPENCL_LIBRARIES (ADVANCED)

    linked by target "AtomicCounters" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/AtomicCounters

    linked by target "BasicDebug" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/BasicDebug

    linked by target "BinarySearch" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/BinarySearch

    linked by target "BinomialOption" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/BinomialOption

    linked by target "BinomialOptionMultiGPU" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/BinomialOptionMultiGPU

    linked by target "BitonicSort" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/BitonicSort

    linked by target "BlackScholes" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/BlackScholes

    linked by target "BlackScholesDP" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/BlackScholesDP

    linked by target "BoxFilter" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/BoxFilter

    linked by target "BoxFilterGL" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/BoxFilterGL

    linked by target "BufferBandwidth" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/BufferBandwidth

    linked by target "BufferImageInterop" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/BufferImageInterop

    linked by target "DCT" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/DCT

    linked by target "DeviceFission" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/DeviceFission

    linked by target "DeviceFission11Ext" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/DeviceFission11Ext

    linked by target "DwtHaar1D" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/DwtHaar1D

    linked by target "VectorAddition" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/DynamicOpenCLDetection

    linked by target "FastWalshTransform" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/FastWalshTransform

    linked by target "FloydWarshall" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/FloydWarshall

    linked by target "FluidSimulation2D" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/FluidSimulation2D

    linked by target "GaussianNoiseGL" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/GaussianNoiseGL

    linked by target "HelloWorld" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/HelloWorld

    linked by target "Histogram" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/Histogram

    linked by target "ImageBandwidth" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/ImageBandwidth

    linked by target "ImageOverlap" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/ImageOverlap

    linked by target "KernelLaunch" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/KernelLaunch

    linked by target "KmeansAutoclustering" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/KmeansAutoclustering

    linked by target "LUDecomposition" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/LUDecomposition

    linked by target "Mandelbrot" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/Mandelbrot

    linked by target "MatrixMulImage" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/MatrixMulImage

    linked by target "MatrixMultiplication" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/MatrixMultiplication

    linked by target "MatrixTranspose" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/MatrixTranspose

    linked by target "MemoryModel" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/MemoryModel

    linked by target "MonteCarloAsian" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/MonteCarloAsian

    linked by target "MonteCarloAsianDP" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/MonteCarloAsianDP

    linked by target "MonteCarloAsianMultiGPU" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/MonteCarloAsianMultiGPU

    linked by target "NBody" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/NBody

    linked by target "PrefixSum" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/PrefixSum

    linked by target "QuasiRandomSequence" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/QuasiRandomSequence

    linked by target "RadixSort" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/RadixSort

    linked by target "RecursiveGaussian" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/RecursiveGaussian

    linked by target "Reduction" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/Reduction

    linked by target "ScanLargeArrays" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/ScanLargeArrays

    linked by target "SimpleConvolution" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/SimpleConvolution

    linked by target "SimpleGL" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/SimpleGL

    linked by target "SimpleImage" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/SimpleImage

    linked by target "SimpleMultiDevice" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/SimpleMultiDevice

    linked by target "SobelFilter" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/SobelFilter

    linked by target "StringSearch" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/StringSearch

    linked by target "Template" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/Template

    linked by target "TransferOverlap" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/TransferOverlap

    linked by target "URNG" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cl/URNG

    linked by target "AsyncDataTransfer" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/AsyncDataTransfer

    linked by target "ConcurrentKernel" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/ConcurrentKernel

    linked by target "CplusplusWrapper" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/CplusplusWrapper

    linked by target "DwtHaar1DCPPKernel" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/DwtHaar1DCPPKernel

    linked by target "EigenValue" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/EigenValue

    linked by target "FFT" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/FFT

    linked by target "GaussianNoise" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/GaussianNoise

    linked by target "HDRToneMapping" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/HDRToneMapping

    linked by target "HistogramAtomics" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/HistogramAtomics

    linked by target "IntroStaticCPPKernel" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/IntroStaticCPPKernel

    linked by target "MatrixMulDouble" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/MatrixMulDouble

    linked by target "MatrixMultiplicationCPPKernel" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/MatrixMultiplicationCPPKernel

    linked by target "MersenneTwister" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/MersenneTwister

    linked by target "SoAversusAoS" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/SoAversusAoS

    linked by target "SobelFilterImage" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/SobelFilterImage

    linked by target "TransferOverlapCPP" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/TransferOverlapCPP

    linked by target "UnsharpMask" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/UnsharpMask

    linked by target "URNGNoiseGL" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/cpp_cl/URNGNoiseGL

    linked by target "ConstantBandwidth" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/benchmark/ConstantBandwidth

    linked by target "GlobalMemoryBandwidth" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/benchmark/GlobalMemoryBandwidth

    linked by target "LDSBandwidth" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/benchmark/LDSBandwidth

    linked by target "MemoryOptimizations" in directory /opt/AMDAPPSDK-2.9-1/samples/opencl/benchmark/MemoryOptimizations

-- Configuring incomplete, errors occurred!

See also "/opt/AMDAPPSDK-2.9-1/samples/opencl/CMakeFiles/CMakeOutput.log".

0 Kudos
Reply
Highlighted
Challenger
Challenger

Re: Error in 'cl.hpp'

Interesting. What is the value of OPENCL_LIBRARIES in your CMakeCache.txt?

Should be: /opt/AMDAPPSDK-2.9.1/lib/x86_64/libOpenCL.so

You will probably need to reinstall your SDK. This time uninstall from AMD_APP_SDK_Installation_Notes2.pdf and download a fresh copy of the sDK.

0 Kudos
Reply
Highlighted
Adept I
Adept I

Re: Error in 'cl.hpp'

Inside the folder "/ opt / AMD APP SDK-2.9.1 / lib / x86_64 /" there is only libOpenCL.so.1 and not libOpenCl.so, is there any difference?

When I open the CmakeCAche.txt file, OPENCL_LIBRARIES parameter is "NOT FOUND", so I tried to assign value to this libOpenCL.so.1, but he does not accept and continues as "NOT FOUND".

0 Kudos
Reply
Highlighted
Adept I
Adept I

Re: Error in 'cl.hpp'

This is how did the first time, I remember now.

At that point, I created a symbolic link:

sudo ln -s /opt/AMDAPPSDK-2.9-1/lib/x86_64/libOpenCL.so.1 libOpenCL.so

And so I can assign a value to the parameter OPENCL_LIBRARIES, the build works now, and the codes in C as well.

But the codes in C ++ still want to not work, displays that same initial problem

0 Kudos
Reply
Highlighted
Challenger
Challenger

Re: Error in 'cl.hpp'

Well, that link should be there from installation. Try reinstalling a fresh SDK after unistalling the old one from Installation notes.

You should try removing -DUNIX and -DDEBUG from your Cflags.

All the samples also include <CL/cl.hpp> and build OK. You can check their sources.

0 Kudos
Reply
Highlighted
Adept I
Adept I

Re: Error in 'cl.hpp'

Thank you nibal, now work.

The solution was created that link, and looked at the examples in C ++. Now it works great.

thankful

0 Kudos
Reply