Ejemplo n.º 1
0
void OpenCLInterface::printOCLDeviceInfo(const cl::Device &device) const {
	std::string device_name;
	std::string device_vendor;
	cl_int error;
	error = device.getInfo(CL_DEVICE_NAME, &device_name);
	if (error != CL_SUCCESS) {
		Logger::writeLine("OpenCLInterface::printOCLDeviceInfo(): Error during query for CL_DEVICE_NAME: " + std::to_string(error));
	}
	error = device.getInfo(CL_DEVICE_VENDOR, &device_vendor);
	if (error != CL_SUCCESS) {
		Logger::writeLine("OpenCLInterface::printOCLDeviceInfo(): Error during query for CL_DEVICE_VENDOR: " + std::to_string(error));
	}
	Logger::writeLine("OpenCLInterface::printOCLDeviceInfo(): OpenCL device info: " + device_name + ", vendor " + device_vendor + ".");
}
Ejemplo n.º 2
0
std::string Convolution3DCLBuffer::getDeviceInfo(cl::Device device, cl_device_info info)
{
	std::string result;
	status = device.getInfo(info,&result);
	CHECK_ERROR(status, "cl::Device::getInfo");
	return result;
}
Ejemplo n.º 3
0
std::string Convolution3DCLBuffer::getDeviceName(cl::Device device)
{
	std::string result;
	cl_int status = device.getInfo(CL_DEVICE_NAME,&result);
	CHECK_ERROR(status, "cl::Device::getInfo");
	return result;
}
Ejemplo n.º 4
0
/*
 * Get the info from device dev
 */
void CLGL::CLGLGetDevicesInfo(cl::Device dev, cl_device_info name, std::string * info)
{
  try{
    dev.getInfo(name, info);
  }
  catch(cl::Error error){
    std::cout << error.what() << " " << CLGLError::errToStr(error.err()) << std::endl;
  }
  
  return;
}
Ejemplo n.º 5
0
	cl_ulong getLocalMemSize(const cl::Device &device)
	{
		cl_ulong localMemSize;
		device.getInfo(CL_DEVICE_LOCAL_MEM_SIZE, &localMemSize);
		return localMemSize;
	}
Ejemplo n.º 6
0
	size_t getMaxWorkGroupSize(const cl::Device &device)
	{
		size_t maxWorkGroupSize;
		device.getInfo(CL_DEVICE_MAX_WORK_GROUP_SIZE, &maxWorkGroupSize);
		return maxWorkGroupSize;
	}
Ejemplo n.º 7
0
	cl_uint getMaxComputeUnits(const cl::Device &device)
	{
		cl_uint nComputeUnits;
		device.getInfo(CL_DEVICE_MAX_COMPUTE_UNITS, &nComputeUnits);
		return nComputeUnits;
	}
Ejemplo n.º 8
0
	cl_device_type getType(const cl::Device &device)
	{
		cl_device_type deviceType;
		device.getInfo(CL_DEVICE_TYPE, &deviceType);
		return deviceType;
	}
Ejemplo n.º 9
0
 void printDeviceInfo(const cl::Device &device, cl_device_info info) {
     if (!initialized) {
         printf("not initialized. call initCLUtility().");
     }
     
     printf("%s: ", clDeviceInfoMetaInfos[info].name);
     
     switch (clDeviceInfoMetaInfos[info].infoType) {
         case CLDeviceInfoType_bool: {
             cl_bool val;
             device.getInfo(info, &val);
             printf(val != 0 ? "YES" : "NO");
             break;
         }
         case CLDeviceInfoType_uint: {
             cl_uint val;
             device.getInfo(info, &val);
             printf("%u", val);
             break;
         }
         case CLDeviceInfoType_ulong: {
             cl_ulong val;
             device.getInfo(info, &val);
             printf("%llu", val);
             break;
         }
         case CLDeviceInfoType_size_t: {
             size_t val;
             device.getInfo(info, &val);
             printf("%lu", val);
             break;
         }
         case CLDeviceInfoType_string: {
             std::string val;
             device.getInfo(info, &val);
             printf("%s", val.c_str());
             break;
         }
         case CLDeviceInfoType_size_t_vec: {
             VECTOR_CLASS<size_t> val;
             device.getInfo(info, &val);
             for (uint32_t i = 0; i < val.size() - 1; ++i) {
                 printf("%lu, ", val[i]);
             }
             printf("%lu", val.back());
             break;
         }
         case CLDeviceInfoType_device_id: {
             cl_device_id val;
             device.getInfo(info, &val);
             printf("%#018llx", (uint64_t)val);
             break;
         }
         case CLDeviceInfoType_platform_id: {
             cl_platform_id val;
             device.getInfo(info, &val);
             printf("%#018llx", (uint64_t)val);
             break;
         }
         case CLDeviceInfoType_device_type: {
             cl_device_type val;
             device.getInfo(info, &val);
             switch (val) {
                 case CL_DEVICE_TYPE_CPU:
                     printf("CPU");
                     break;
                 case CL_DEVICE_TYPE_GPU:
                     printf("GPU");
                     break;
                 case CL_DEVICE_TYPE_ACCELERATOR:
                     printf("Accelerator");
                     break;
                 case CL_DEVICE_TYPE_CUSTOM:
                     printf("Custom");
                     break;
                 default:
                     break;
             }
             break;
         }
         case CLDeviceInfoType_device_fp_config: {
             cl_device_fp_config val;
             device.getInfo(info, &val);
             if ((val & CL_FP_DENORM) != 0)
                 printf("CL_FP_DENORM ");
             if ((val & CL_FP_INF_NAN) != 0)
                 printf("CL_FP_INF_NAN ");
             if ((val & CL_FP_ROUND_TO_NEAREST) != 0)
                 printf("CL_FP_ROUND_TO_NEAREST ");
             if ((val & CL_FP_ROUND_TO_ZERO) != 0)
                 printf("CL_FP_ROUND_TO_ZERO ");
             if ((val & CL_FP_ROUND_TO_INF) != 0)
                 printf("CL_FP_ROUND_TO_INF ");
             if ((val & CL_FP_FMA) != 0)
                 printf("CL_FP_FMA ");
             if ((val & CL_FP_SOFT_FLOAT) != 0)
                 printf("CL_FP_SOFT_FLOAT ");
             if ((val & CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT) != 0)
                 printf("CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT ");
             break;
         }
         case CLDeviceInfoType_device_local_mem_type: {
             cl_device_local_mem_type val;
             device.getInfo(info, &val);
             switch (val) {
                 case CL_LOCAL:
                     printf("Local");
                     break;
                 case CL_GLOBAL:
                     printf("Global");
                 default:
                     break;
             }
             break;
         }
         case CLDeviceInfoType_device_mem_cache_type: {
             cl_device_mem_cache_type val;
             device.getInfo(info, &val);
             switch (val) {
                 case CL_NONE:
                     printf("None");
                     break;
                 case CL_READ_ONLY_CACHE:
                     printf("Read Only Cache");
                     break;
                 case CL_READ_WRITE_CACHE:
                     printf("Read Write Cache");
                     break;
                 default:
                     break;
             }
             break;
         }
         case CLDeviceInfoType_device_exec_capabilities: {
             cl_device_exec_capabilities val;
             device.getInfo(info, &val);
             if ((val & CL_EXEC_KERNEL) != 0)
                 printf("CL_EXEC_KERNEL ");
             if ((val & CL_EXEC_NATIVE_KERNEL) != 0)
                 printf("CL_EXEC_NATIVE_KERNEL ");
             break;
         }
         case CLDeviceInfoType_command_queue_properties: {
             cl_command_queue_properties val;
             device.getInfo(info, &val);
             if ((val & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) != 0)
                 printf("CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE ");
             if ((val & CL_QUEUE_PROFILING_ENABLE) != 0)
                 printf("CL_QUEUE_PROFILING_ENABLE ");
             break;
         }
         case CLDeviceInfoType_device_affinity_domain: {
             cl_device_affinity_domain val;
             device.getInfo(info, &val);
             if ((val & CL_DEVICE_AFFINITY_DOMAIN_NUMA) != 0)
                 printf("CL_DEVICE_AFFINITY_DOMAIN_NUMA ");
             if ((val & CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE) != 0)
                 printf("CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE ");
             if ((val & CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE) != 0)
                 printf("CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE ");
             if ((val & CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE) != 0)
                 printf("CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE ");
             if ((val & CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE) != 0)
                 printf("CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE ");
             if ((val & CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE) != 0)
                 printf("CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE ");
             break;
         }
         case CLDeviceInfoType_device_partition_property_vec: {
             VECTOR_CLASS<cl_device_partition_property> val;
             device.getInfo(info, &val);
             for (uint32_t i = 0; i < val.size(); ++i) {
                 switch (val[i]) {
                     case CL_DEVICE_PARTITION_EQUALLY:
                         printf("CL_DEVICE_PARTITION_EQUALLY");
                         break;
                     case CL_DEVICE_PARTITION_BY_COUNTS:
                         printf("CL_DEVICE_PARTITION_BY_COUNTS");
                         break;
                     case CL_DEVICE_PARTITION_BY_COUNTS_LIST_END:
                         printf("CL_DEVICE_PARTITION_BY_COUNTS_LIST_END");
                         break;
                     case CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN:
                         printf("CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN");
                         break;
                     default:
                         break;
                 }
                 if (i < val.size() - 1)
                     printf(", ");
             }
             break;
         }
         default:
             break;
     }
     printf("\n");
 }