Answer the question
In order to leave comments, you need to log in
Basics of OpenCL( C++, Qt 5). How to build a simple program?
Colleagues, it is not possible to fully launch an elementary program.
What is:
Windows 7 64
Qt 5.5.1 Desktop MSVC2013 64bit (tested with MinGW 32 bit as well)
Nvidia GeForce 540
CUDA drivers installed for 64 bit.
In Visual Studio 2013 CUDA, the examples compile and work.
This program is also assembled from QtCreator and launched, displaying the "Using platform: NVIDIA CUDA"
Pro file on the screen:
QT += core
QT -= gui
TARGET = QtTestCuda
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
QMAKE_CXXFLAGS += -std=c++0x
LIBS += -L$$PWD/ -L"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/lib/x64" -lOpenCL
INCLUDEPATH += $$PWD/ "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/include"
DEPENDPATH += $$PWD/ "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/include"
#include <CL/cl.hpp>
#include <iostream>
#include <vector>
//#define __NO_STD_VECTOR
int main(int argc, char *argv[])
{
//get all platforms (drivers)
std::vector<cl::Platform> all_platforms;
cl::Platform::get(&all_platforms);
if(all_platforms.size()==0){
std::cout<<" No platforms found. Check OpenCL installation!\n";
exit(1);
}
cl::Platform default_platform=all_platforms[0];
std::cout << "Using platform: "<<default_platform.getInfo<CL_PLATFORM_NAME>()<<"\n";
//get default device of the default platform
std::vector<cl::Device> all_devices;
default_platform.getDevices(CL_DEVICE_TYPE_ALL, &all_devices);//!!!!!!!!!!!!!!
return 0;
}
Answer the question
In order to leave comments, you need to log in
Judging by the error message, I would venture to suggest that you have an old / poorly installed OpenCL. As far as I remember, enumeration of platforms can only be done through the registry, OpenCL itself is not needed. But getting devices already requires OpenCL, and then the error falls out. Do you even have a file called opencl.dll?
The 540th GeFors should keep OpenCL 1.1. The first thing that comes to mind is to install up-to-date and stable drivers for the video card. I also advise you to install the Intel OpeCL SDK and / or AMD APP SDK (AMD supports both its processors and graphics, and Intel processors) - then you will have at least one platform with at least one device supporting OpenCL.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question