I am new to OpenCL, by now I am running the following code:
int main() {
std::vector<cl::Platform> platforms;
std::vector<cl::Device> devices;
cl::Platform::get(&platforms);
platforms[0].getDevices(CL_DEVICE_TYPE_ALL, &devices);
std::cout << "Name: " << devices[0].getInfo<CL_DEVICE_NAME>() << std::endl;
std::cout << "Vendor: " << devices[0].getInfo<CL_DEVICE_VENDOR>() << std::endl;
std::cout << "Device Version: " << devices[0].getInfo<CL_DEVICE_VERSION>() << std::endl;
std::cout << "Device Profile: " << devices[0].getInfo<CL_DEVICE_PROFILE>() << std::endl;
std::cout << "Driver Version: " << devices[0].getInfo<CL_DRIVER_VERSION>() << std::endl;
std::cout << "Image Support: " << devices[0].getInfo<CL_DEVICE_IMAGE_SUPPORT>() << std::endl;
std::cout << "Image Width: " << devices[0].getInfo<CL_DEVICE_IMAGE2D_MAX_WIDTH>() << std::endl;
std::cout << "Image Height: " << devices[0].getInfo<CL_DEVICE_IMAGE2D_MAX_HEIGHT>() << std::endl;
//std::cout << "Image Pitch: " << devices[0].getInfo<CL_DEVICE_IMAGE_PITCH_ALIGNMENT>() << std::endl;
}
which gives me the output:
Name: NVIDIA GeForce GTX 1060 6GB
Vendor: NVIDIA Corporation
Device Version: OpenCL 3.0 CUDA
Device Profile: FULL_PROFILE
Driver Version: 536.67
Image Support: 1
Image Width: 16384
Image Height: 32768
So far that is fine. But when I uncomment the line
std::cout << "Image Pitch: " << devices[0].getInfo<CL_DEVICE_IMAGE_PITCH_ALIGNMENT>() << std::endl;
I get a compiler error error C2672: 'cl::Device::getInfo': no matching overloaded function found
In fact I get such an error for all the options to getDevice()
which are marked in the Khronos Registry as “missing before version x.x”. But since we see in the output above we have OpenCL 3.0, how to get those lines compiled? What is the problem here?