如何使用clGetDeviceInfo来获取CL_DEVICE_ADDRESS_BITS

How do you use clGetDeviceInfo to get CL_DEVICE_ADDRESS_BITS?

本文关键字:DEVICE ADDRESS BITS CL 获取 何使用 clGetDeviceInfo      更新时间:2023-10-16

如何使用clGetDeviceInfo来获取CL_DEVICE_ADDRESS_BITS?https://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/clGetDeviceInfo.html

下面的函数应该可以完成这个任务。

void print_address_device_bits(cl_device_id *mydevice)
{
    size_t size;
    cl_uint address_bits;
    clGetDeviceInfo(*mydevice, CL_DEVICE_ADDRESS_BITS, 0, NULL, &size);
    clGetDeviceInfo(*mydevice, CL_DEVICE_ADDRESS_BITS, size, &address_bits, NULL);
    printf("size: %lu ,, bits: %un", size, address_bits);
}

有问题或意见吗?