예제 #1
0
파일: ocl.cpp 프로젝트: jcxz/DIP
void printDeviceInfo(const boost::compute::device & dev)
{
  INFOM("====================================================================");

  INFOM("name                                      : " << dev.name());

  // misc information
  INFOM("--- misc info -----------------------------");
  INFOM("CL_DEVICE_ERROR_CORRECTION_SUPPORT        : " << dev.get_info<cl_bool>(CL_DEVICE_ERROR_CORRECTION_SUPPORT));
  INFOM("CL_DEVICE_HOST_UNIFIED_MEMORY             : " << dev.get_info<cl_bool>(CL_DEVICE_HOST_UNIFIED_MEMORY));
  INFOM("CL_DEVICE_MAX_COMPUTE_UNITS               : " << dev.get_info<cl_uint>(CL_DEVICE_MAX_COMPUTE_UNITS));
  INFOM("CL_DEVICE_PROFILING_TIMER_RESOLUTION (ns) : " << dev.get_info<size_t>(CL_DEVICE_PROFILING_TIMER_RESOLUTION));

  // global memory information
  INFOM("--- global memory info --------------------");
  INFOM("CL_DEVICE_GLOBAL_MEM_CACHE_SIZE (KB)      : " << dev.get_info<cl_ulong>(CL_DEVICE_GLOBAL_MEM_CACHE_SIZE) / 1024);
  INFOM("CL_DEVICE_GLOBAL_MEM_CACHE_TYPE           : " << cacheTypeToString(dev.get_info<cl_device_mem_cache_type>(CL_DEVICE_GLOBAL_MEM_CACHE_TYPE)));
  INFOM("CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE (B)   : " << dev.get_info<cl_uint>(CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE));
  INFOM("CL_DEVICE_GLOBAL_MEM_SIZE (MB)            : " << dev.get_info<cl_ulong>(CL_DEVICE_GLOBAL_MEM_SIZE) / 1024 / 1024);

  // local memory information
  INFOM("--- local memory info ---------------------");
  INFOM("CL_DEVICE_LOCAL_MEM_SIZE (KB)             : " << dev.get_info<cl_ulong>(CL_DEVICE_LOCAL_MEM_SIZE) / 1024);
  INFOM("CL_DEVICE_LOCAL_MEM_TYPE                  : " << localMemTypeToString(dev.get_info<cl_device_local_mem_type>(CL_DEVICE_LOCAL_MEM_TYPE)));

  // constant memory information
  INFOM("--- constant memory info ------------------");
  INFOM("CL_DEVICE_MAX_CONSTANT_ARGS               : " << dev.get_info<cl_uint>(CL_DEVICE_MAX_CONSTANT_ARGS));
  INFOM("CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE (KB)   : " << dev.get_info<cl_ulong>(CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE) / 1024);

  // memory object information
  INFOM("--- memory object info --------------------");
  INFOM("CL_DEVICE_MAX_MEM_ALLOC_SIZE (MB)         : " << dev.get_info<cl_ulong>(CL_DEVICE_MAX_MEM_ALLOC_SIZE) / 1024 / 1024);

  // work group information
  INFOM("--- work group info -----------------------");
  INFOM("CL_DEVICE_MAX_WORK_GROUP_SIZE             : " << dev.get_info<size_t>(CL_DEVICE_MAX_WORK_GROUP_SIZE));
  INFOM("CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS        : " << dev.get_info<size_t>(CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS));
  INFOM("CL_DEVICE_MAX_WORK_ITEM_SIZES             : " << dev.get_info<std::vector<size_t>>(CL_DEVICE_MAX_WORK_ITEM_SIZES));

  INFOM("====================================================================");
}
예제 #2
0
파일: ocl.cpp 프로젝트: jcxz/DIP
bool findGPUDevice(boost::compute::device & dev)
{
  std::vector<boost::compute::device> devs(boost::compute::system::devices());

  for (const boost::compute::device & dev_ : devs)
  {
    if (dev_.type() == CL_DEVICE_TYPE_GPU)
    {
      INFOM("Using device: " << dev_.name());
      dev = dev_;
      return true;
    }
  }

  dev = boost::compute::system::default_device();

  WARNM("Could not find any GPU device. Using device: " << dev.name());

  return false;
}
예제 #3
0
 bool operator()(const boost::compute::device &d) const {
     return d.name().find(devname) != std::string::npos;
 }