All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
device.hpp
Go to the documentation of this file.
#ifndef VIENNACL_OCL_DEVICE_HPP_
#define VIENNACL_OCL_DEVICE_HPP_
/* =========================================================================
Copyright (c) 2010-2016, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
-----------------
ViennaCL - The Vienna Computing Library
-----------------
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
#ifdef __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
#include<stdio.h>
#include <vector>
#include <string>
#include <sstream>
#include <assert.h>
#include "viennacl/ocl/device_utils.hpp"
#include "viennacl/ocl/handle.hpp"
#include "viennacl/ocl/error.hpp"
namespace viennacl
{
namespace ocl
{
class device
{
public:
explicit device() : device_(0) { flush_cache(); }
explicit device(cl_device_id dev) : device_(dev)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_DEVICE)
std::cout << "ViennaCL: Creating device object (CTOR with cl_device_id)" << std::endl;
#endif
flush_cache();
}
device(const device & other) : device_(0)
{
#if defined(VIENNACL_DEBUG_ALL) || defined(VIENNACL_DEBUG_DEVICE)
std::cout << "ViennaCL: Creating device object (Copy CTOR)" << std::endl;
#endif
if (device_ != other.device_)
{
device_ = other.device_;
flush_cache();
}
}
cl_uint address_bits() const
{
if (!address_bits_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_ADDRESS_BITS, sizeof(cl_uint), static_cast<void *>(&address_bits_), NULL);
VIENNACL_ERR_CHECK(err);
address_bits_valid_ = true;
}
return address_bits_;
}
cl_bool available() const
{
if (!available_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_AVAILABLE, sizeof(cl_bool), static_cast<void *>(&available_), NULL);
VIENNACL_ERR_CHECK(err);
available_valid_ = true;
}
return available_;
}
cl_bool compiler_available() const
{
if (!compiler_available_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_COMPILER_AVAILABLE , sizeof(cl_bool), static_cast<void *>(&compiler_available_), NULL);
VIENNACL_ERR_CHECK(err);
compiler_available_valid_ = true;
}
return compiler_available_;
}
#ifdef CL_DEVICE_DOUBLE_FP_CONFIG
cl_device_fp_config double_fp_config() const
{
if (double_support() && !double_fp_config_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_DOUBLE_FP_CONFIG, sizeof(cl_device_fp_config), static_cast<void *>(&double_fp_config_), NULL);
VIENNACL_ERR_CHECK(err);
double_fp_config_valid_ = true;
}
return double_fp_config_;
}
#endif
cl_bool endian_little() const
{
if (!endian_little_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_ENDIAN_LITTLE, sizeof(cl_bool), static_cast<void *>(&endian_little_), NULL);
VIENNACL_ERR_CHECK(err);
endian_little_valid_ = true;
}
return endian_little_;
}
cl_bool error_correction_support() const
{
if (!error_correction_support_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_ERROR_CORRECTION_SUPPORT , sizeof(cl_bool), static_cast<void *>(&error_correction_support_), NULL);
VIENNACL_ERR_CHECK(err);
error_correction_support_valid_ = true;
}
return error_correction_support_;
}
cl_device_exec_capabilities execution_capabilities() const
{
if (!execution_capabilities_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_EXECUTION_CAPABILITIES , sizeof(cl_device_exec_capabilities), static_cast<void *>(&execution_capabilities_), NULL);
VIENNACL_ERR_CHECK(err);
execution_capabilities_valid_ = true;
}
return execution_capabilities_;
}
std::string extensions() const
{
if (!extensions_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_EXTENSIONS, sizeof(char) * 2048, static_cast<void *>(&extensions_), NULL);
VIENNACL_ERR_CHECK(err);
extensions_valid_ = true;
}
return extensions_;
}
cl_ulong global_mem_cache_size() const
{
if (!global_mem_cache_size_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, sizeof(cl_ulong), static_cast<void *>(&global_mem_cache_size_), NULL);
VIENNACL_ERR_CHECK(err);
global_mem_cache_size_valid_ = true;
}
return global_mem_cache_size_;
}
cl_device_mem_cache_type global_mem_cache_type() const
{
if (!global_mem_cache_type_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, sizeof(cl_device_mem_cache_type), static_cast<void *>(&global_mem_cache_type_), NULL);
VIENNACL_ERR_CHECK(err);
global_mem_cache_type_valid_ = true;
}
return global_mem_cache_type_;
}
cl_uint global_mem_cacheline_size() const
{
if (!global_mem_cacheline_size_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, sizeof(cl_uint), static_cast<void *>(&global_mem_cacheline_size_), NULL);
VIENNACL_ERR_CHECK(err);
global_mem_cacheline_size_valid_ = true;
}
return global_mem_cacheline_size_;
}
cl_ulong global_mem_size() const
{
if (!global_mem_size_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(cl_ulong), static_cast<void *>(&global_mem_size_), NULL);
VIENNACL_ERR_CHECK(err);
global_mem_size_valid_ = true;
}
return global_mem_size_;
}
#ifdef CL_DEVICE_HALF_FP_CONFIG
cl_device_fp_config half_fp_config() const
{
if (!half_fp_config_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_HALF_FP_CONFIG, sizeof(cl_device_fp_config), static_cast<void *>(&half_fp_config_), NULL);
VIENNACL_ERR_CHECK(err);
half_fp_config_valid_ = true;
}
return half_fp_config_;
}
#endif
#ifdef CL_DEVICE_HOST_UNIFIED_MEMORY
cl_bool host_unified_memory() const
{
if (!host_unified_memory_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_HOST_UNIFIED_MEMORY, sizeof(cl_bool), static_cast<void *>(&host_unified_memory_), NULL);
VIENNACL_ERR_CHECK(err);
host_unified_memory_valid_ = true;
}
return host_unified_memory_;
}
#endif
cl_bool image_support() const
{
if (!image_support_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_IMAGE_SUPPORT, sizeof(cl_bool), static_cast<void *>(&image_support_), NULL);
VIENNACL_ERR_CHECK(err);
image_support_valid_ = true;
}
return image_support_;
}
size_t image2d_max_height() const
{
if (!image2d_max_height_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof(size_t), static_cast<void *>(&image2d_max_height_), NULL);
VIENNACL_ERR_CHECK(err);
image2d_max_height_valid_ = true;
}
return image2d_max_height_;
}
size_t image2d_max_width() const
{
if (!image2d_max_width_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof(size_t), static_cast<void *>(&image2d_max_width_), NULL);
VIENNACL_ERR_CHECK(err);
image2d_max_width_valid_ = true;
}
return image2d_max_width_;
}
size_t image3d_max_depth() const
{
if (!image3d_max_depth_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_IMAGE3D_MAX_DEPTH, sizeof(size_t), static_cast<void *>(&image3d_max_depth_), NULL);
VIENNACL_ERR_CHECK(err);
image3d_max_depth_valid_ = true;
}
return image3d_max_depth_;
}
size_t image3d_max_height() const
{
if (!image3d_max_height_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_IMAGE3D_MAX_HEIGHT, sizeof(size_t), static_cast<void *>(&image3d_max_height_), NULL);
VIENNACL_ERR_CHECK(err);
image3d_max_height_valid_ = true;
}
return image3d_max_height_;
}
size_t image3d_max_width() const
{
if (!image3d_max_width_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof(size_t), static_cast<void *>(&image3d_max_width_), NULL);
VIENNACL_ERR_CHECK(err);
image3d_max_width_valid_ = true;
}
return image3d_max_width_;
}
cl_ulong local_mem_size() const
{
if (!local_mem_size_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_LOCAL_MEM_SIZE, sizeof(cl_ulong), static_cast<void *>(&local_mem_size_), NULL);
VIENNACL_ERR_CHECK(err);
local_mem_size_valid_ = true;
}
return local_mem_size_;
}
cl_device_local_mem_type local_mem_type() const
{
if (!local_mem_type_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_LOCAL_MEM_TYPE, sizeof(cl_device_local_mem_type), static_cast<void *>(&local_mem_type_), NULL);
VIENNACL_ERR_CHECK(err);
local_mem_type_valid_ = true;
}
return local_mem_type_;
}
cl_uint max_clock_frequency() const
{
if (!max_clock_frequency_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MAX_CLOCK_FREQUENCY, sizeof(cl_uint), static_cast<void *>(&max_clock_frequency_), NULL);
VIENNACL_ERR_CHECK(err);
max_clock_frequency_valid_ = true;
}
return max_clock_frequency_;
}
cl_uint max_compute_units() const
{
if (!max_compute_units_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(cl_uint), static_cast<void *>(&max_compute_units_), NULL);
VIENNACL_ERR_CHECK(err);
max_compute_units_valid_ = true;
}
return max_compute_units_;
}
cl_uint max_constant_args() const
{
if (!max_constant_args_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MAX_CONSTANT_ARGS, sizeof(cl_uint), static_cast<void *>(&max_constant_args_), NULL);
VIENNACL_ERR_CHECK(err);
max_constant_args_valid_ = true;
}
return max_constant_args_;
}
cl_ulong max_constant_buffer_size() const
{
if (!max_constant_buffer_size_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, sizeof(cl_ulong), static_cast<void *>(&max_constant_buffer_size_), NULL);
VIENNACL_ERR_CHECK(err);
max_constant_buffer_size_valid_ = true;
}
return max_constant_buffer_size_;
}
cl_ulong max_mem_alloc_size() const
{
if (!max_mem_alloc_size_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof(cl_ulong), static_cast<void *>(&max_mem_alloc_size_), NULL);
VIENNACL_ERR_CHECK(err);
max_mem_alloc_size_valid_ = true;
}
return max_mem_alloc_size_;
}
size_t max_parameter_size() const
{
if (!max_parameter_size_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MAX_PARAMETER_SIZE, sizeof(size_t), static_cast<void *>(&max_parameter_size_), NULL);
VIENNACL_ERR_CHECK(err);
max_parameter_size_valid_ = true;
}
return max_parameter_size_;
}
cl_uint max_read_image_args() const
{
if (!max_read_image_args_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MAX_READ_IMAGE_ARGS, sizeof(cl_uint), static_cast<void *>(&max_read_image_args_), NULL);
VIENNACL_ERR_CHECK(err);
max_read_image_args_valid_ = true;
}
return max_read_image_args_;
}
cl_uint max_samplers() const
{
if (!max_samplers_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MAX_SAMPLERS, sizeof(cl_uint), static_cast<void *>(&max_samplers_), NULL);
VIENNACL_ERR_CHECK(err);
max_samplers_valid_ = true;
}
return max_samplers_;
}
size_t max_work_group_size() const
{
if (!max_work_group_size_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(size_t), static_cast<void *>(&max_work_group_size_), NULL);
VIENNACL_ERR_CHECK(err);
max_work_group_size_valid_ = true;
}
return max_work_group_size_;
}
cl_uint max_work_item_dimensions() const
{
if (!max_work_item_dimensions_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof(cl_uint), static_cast<void *>(&max_work_item_dimensions_), NULL);
VIENNACL_ERR_CHECK(err);
max_work_item_dimensions_valid_ = true;
}
return max_work_item_dimensions_;
}
std::vector<size_t> max_work_item_sizes() const
{
std::vector<size_t> result(max_work_item_dimensions());
assert(result.size() < 16 && bool("Supported work item dimensions exceed available capacity!"));
if (!max_work_item_sizes_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(size_t) * 16, static_cast<void *>(&max_work_item_sizes_), NULL);
VIENNACL_ERR_CHECK(err);
max_work_item_sizes_valid_ = true;
}
for (vcl_size_t i=0; i<result.size(); ++i)
result[i] = max_work_item_sizes_[i];
return result;
}
cl_uint max_write_image_args() const
{
if (!max_write_image_args_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, sizeof(cl_uint), static_cast<void *>(&max_write_image_args_), NULL);
VIENNACL_ERR_CHECK(err);
max_write_image_args_valid_ = true;
}
return max_write_image_args_;
}
cl_uint mem_base_addr_align() const
{
if (!mem_base_addr_align_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MEM_BASE_ADDR_ALIGN, sizeof(cl_uint), static_cast<void *>(&mem_base_addr_align_), NULL);
VIENNACL_ERR_CHECK(err);
mem_base_addr_align_valid_ = true;
}
return mem_base_addr_align_;
}
cl_uint min_data_type_align_size() const
{
if (!min_data_type_align_size_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, sizeof(cl_uint), static_cast<void *>(&min_data_type_align_size_), NULL);
VIENNACL_ERR_CHECK(err);
min_data_type_align_size_valid_ = true;
}
return min_data_type_align_size_;
}
std::string name() const
{
if (!name_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_NAME, sizeof(char) * 256, static_cast<void *>(name_), NULL);
VIENNACL_ERR_CHECK(err);
name_valid_ = true;
}
return name_;
}
device_architecture_family architecture_family() const
{
if ( !architecture_family_valid_)
{
architecture_family_ = get_architecture_family(vendor_id(), name());
architecture_family_valid_ = true;
}
return architecture_family_;
}
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR
cl_uint native_vector_width_char() const
{
if (!native_vector_width_char_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, sizeof(cl_uint), static_cast<void *>(&native_vector_width_char_), NULL);
VIENNACL_ERR_CHECK(err);
native_vector_width_char_valid_ = true;
}
return native_vector_width_char_;
}
#endif
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT
cl_uint native_vector_width_short() const
{
if (!native_vector_width_short_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, sizeof(cl_uint), static_cast<void *>(&native_vector_width_short_), NULL);
VIENNACL_ERR_CHECK(err);
native_vector_width_short_valid_ = true;
}
return native_vector_width_short_;
}
#endif
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
cl_uint native_vector_width_int() const
{
if (!native_vector_width_int_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, sizeof(cl_uint), static_cast<void *>(&native_vector_width_int_), NULL);
VIENNACL_ERR_CHECK(err);
native_vector_width_int_valid_ = true;
}
return native_vector_width_int_;
}
#endif
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
cl_uint native_vector_width_long() const
{
if (!native_vector_width_long_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, sizeof(cl_uint), static_cast<void *>(&native_vector_width_long_), NULL);
VIENNACL_ERR_CHECK(err);
native_vector_width_long_valid_ = true;
}
return native_vector_width_long_;
}
#endif
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT
cl_uint native_vector_width_float() const
{
if (!native_vector_width_float_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, sizeof(cl_uint), static_cast<void *>(&native_vector_width_float_), NULL);
VIENNACL_ERR_CHECK(err);
native_vector_width_float_valid_ = true;
}
return native_vector_width_float_;
}
#endif
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE
cl_uint native_vector_width_double() const
{
if (!native_vector_width_double_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, sizeof(cl_uint), static_cast<void *>(&native_vector_width_double_), NULL);
VIENNACL_ERR_CHECK(err);
native_vector_width_double_valid_ = true;
}
return native_vector_width_double_;
}
#endif
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF
cl_uint native_vector_width_half() const
{
if (!native_vector_width_half_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, sizeof(cl_uint), static_cast<void *>(&native_vector_width_half_), NULL);
VIENNACL_ERR_CHECK(err);
native_vector_width_half_valid_ = true;
}
return native_vector_width_half_;
}
#endif
#if CL_DEVICE_OPENCL_C_VERSION
std::string opencl_c_version() const
{
if (!opencl_c_version_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_OPENCL_C_VERSION, sizeof(char) * 128, static_cast<void *>(opencl_c_version_), NULL);
VIENNACL_ERR_CHECK(err);
opencl_c_version_valid_ = true;
}
return opencl_c_version_;
}
#endif
cl_platform_id platform() const
{
if (!platform_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_PLATFORM, sizeof(cl_platform_id), static_cast<void *>(&platform_), NULL);
VIENNACL_ERR_CHECK(err);
platform_valid_ = true;
}
return platform_;
}
cl_uint preferred_vector_width_char() const
{
if (!preferred_vector_width_char_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, sizeof(cl_uint), static_cast<void *>(&preferred_vector_width_char_), NULL);
VIENNACL_ERR_CHECK(err);
preferred_vector_width_char_valid_ = true;
}
return preferred_vector_width_char_;
}
cl_uint preferred_vector_width_short() const
{
if (!preferred_vector_width_short_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, sizeof(cl_uint), static_cast<void *>(&preferred_vector_width_short_), NULL);
VIENNACL_ERR_CHECK(err);
preferred_vector_width_short_valid_ = true;
}
return preferred_vector_width_short_;
}
cl_uint preferred_vector_width_int() const
{
if (!preferred_vector_width_int_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, sizeof(cl_uint), static_cast<void *>(&preferred_vector_width_int_), NULL);
VIENNACL_ERR_CHECK(err);
preferred_vector_width_int_valid_ = true;
}
return preferred_vector_width_int_;
}
cl_uint preferred_vector_width_long() const
{
if (!preferred_vector_width_long_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, sizeof(cl_uint), static_cast<void *>(&preferred_vector_width_long_), NULL);
VIENNACL_ERR_CHECK(err);
preferred_vector_width_long_valid_ = true;
}
return preferred_vector_width_long_;
}
cl_uint preferred_vector_width_float() const
{
if (!preferred_vector_width_float_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, sizeof(cl_uint), static_cast<void *>(&preferred_vector_width_float_), NULL);
VIENNACL_ERR_CHECK(err);
preferred_vector_width_float_valid_ = true;
}
return preferred_vector_width_float_;
}
cl_uint preferred_vector_width_double() const
{
if (!preferred_vector_width_double_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, sizeof(cl_uint), static_cast<void *>(&preferred_vector_width_double_), NULL);
VIENNACL_ERR_CHECK(err);
preferred_vector_width_double_valid_ = true;
}
return preferred_vector_width_double_;
}
#ifdef CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF
cl_uint preferred_vector_width_half() const
{
if (!preferred_vector_width_half_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, sizeof(cl_uint), static_cast<void *>(&preferred_vector_width_half_), NULL);
VIENNACL_ERR_CHECK(err);
preferred_vector_width_half_valid_ = true;
}
return preferred_vector_width_half_;
}
#endif
std::string profile() const
{
if (!profile_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_PROFILE, sizeof(char) * 32, static_cast<void *>(profile_), NULL);
VIENNACL_ERR_CHECK(err);
profile_valid_ = true;
}
return profile_;
}
size_t profiling_timer_resolution() const
{
if (!profiling_timer_resolution_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_PROFILING_TIMER_RESOLUTION, sizeof(size_t), static_cast<void *>(&profiling_timer_resolution_), NULL);
VIENNACL_ERR_CHECK(err);
profiling_timer_resolution_valid_ = true;
}
return profiling_timer_resolution_;
}
cl_command_queue_properties queue_properties() const
{
if (!queue_properties_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_QUEUE_PROPERTIES, sizeof(cl_command_queue_properties), static_cast<void *>(&queue_properties_), NULL);
VIENNACL_ERR_CHECK(err);
queue_properties_valid_ = true;
}
return queue_properties_;
}
cl_device_fp_config single_fp_config() const
{
if (!single_fp_config_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_SINGLE_FP_CONFIG, sizeof(cl_device_fp_config), static_cast<void *>(&single_fp_config_), NULL);
VIENNACL_ERR_CHECK(err);
single_fp_config_valid_ = true;
}
return single_fp_config_;
}
cl_device_type type() const
{
if (!type_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_TYPE, sizeof(cl_device_type), static_cast<void *>(&type_), NULL);
VIENNACL_ERR_CHECK(err);
type_valid_ = true;
}
return type_;
}
std::string vendor() const
{
if (!vendor_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_VENDOR, sizeof(char) * 256, static_cast<void *>(vendor_), NULL);
VIENNACL_ERR_CHECK(err);
vendor_valid_ = true;
}
return vendor_;
}
cl_uint vendor_id() const
{
if (!vendor_id_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_VENDOR_ID, sizeof(cl_uint), static_cast<void *>(&vendor_id_), NULL);
VIENNACL_ERR_CHECK(err);
vendor_id_valid_ = true;
}
return vendor_id_;
}
std::string version() const
{
if (!version_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DEVICE_VERSION, sizeof(char) * 256, static_cast<void *>(version_), NULL);
VIENNACL_ERR_CHECK(err);
version_valid_ = true;
}
return version_;
}
std::string driver_version() const
{
if (!driver_version_valid_)
{
cl_int err = clGetDeviceInfo(device_, CL_DRIVER_VERSION, sizeof(char) * 256, static_cast<void *>(driver_version_), NULL);
VIENNACL_ERR_CHECK(err);
driver_version_valid_ = true;
}
return driver_version_;
}
bool double_support() const
{
std::string ext = extensions();
if (ext.find("cl_khr_fp64") != std::string::npos || ext.find("cl_amd_fp64") != std::string::npos)
return true;
return false;
}
std::string double_support_extension() const
{
std::string ext = extensions();
if (ext.find("cl_amd_fp64") != std::string::npos) //AMD extension
return "cl_amd_fp64";
if (ext.find("cl_khr_fp64") != std::string::npos) //Khronos-certified standard extension for double precision
return "cl_khr_fp64";
return "";
}
cl_device_id id() const
{
assert(device_ != 0 && bool("Device ID invalid!"));
return device_;
}
std::string info(vcl_size_t indent = 0, char indent_char = ' ') const
{
std::string line_indent(indent, indent_char);
std::ostringstream oss;
oss << line_indent << "Name: " << name() << std::endl;
oss << line_indent << "Vendor: " << vendor() << std::endl;
oss << line_indent << "Type: " << device_type_to_string(type()) << std::endl;
oss << line_indent << "Available: " << available() << std::endl;
oss << line_indent << "Max Compute Units: " << max_compute_units() << std::endl;
oss << line_indent << "Max Work Group Size: " << max_work_group_size() << std::endl;
oss << line_indent << "Global Mem Size: " << global_mem_size() << std::endl;
oss << line_indent << "Local Mem Size: " << local_mem_size() << std::endl;
oss << line_indent << "Local Mem Type: " << local_mem_type() << std::endl;
#ifdef CL_DEVICE_HOST_UNIFIED_MEMORY
oss << line_indent << "Host Unified Memory: " << host_unified_memory() << std::endl;
#endif
return oss.str();
}
std::string full_info(vcl_size_t indent = 0, char indent_char = ' ') const
{
std::string line_indent(indent, indent_char);
std::ostringstream oss;
oss << line_indent << "Address Bits: " << address_bits() << std::endl;
oss << line_indent << "Available: " << available() << std::endl;
oss << line_indent << "Compiler Available: " << compiler_available() << std::endl;
#ifdef CL_DEVICE_DOUBLE_FP_CONFIG
oss << line_indent << "Double FP Config: " << fp_config_to_string(double_fp_config()) << std::endl;
#endif
oss << line_indent << "Endian Little: " << endian_little() << std::endl;
oss << line_indent << "Error Correction Support: " << error_correction_support() << std::endl;
oss << line_indent << "Execution Capabilities: " << exec_capabilities_to_string(execution_capabilities()) << std::endl;
oss << line_indent << "Extensions: " << extensions() << std::endl;
oss << line_indent << "Global Mem Cache Size: " << global_mem_cache_size() << " Bytes" << std::endl;
oss << line_indent << "Global Mem Cache Type: " << mem_cache_type_to_string(global_mem_cache_type()) << std::endl;
oss << line_indent << "Global Mem Cacheline Size: " << global_mem_cacheline_size() << " Bytes" << std::endl;
oss << line_indent << "Global Mem Size: " << global_mem_size() << " Bytes" << std::endl;
#ifdef CL_DEVICE_HALF_FP_CONFIG
oss << line_indent << "Half PF Config: " << fp_config_to_string(half_fp_config()) << std::endl;
#endif
#ifdef CL_DEVICE_HOST_UNIFIED_MEMORY
oss << line_indent << "Host Unified Memory: " << host_unified_memory() << std::endl;
#endif
oss << line_indent << "Image Support: " << image_support() << std::endl;
oss << line_indent << "Image2D Max Height: " << image2d_max_height() << std::endl;
oss << line_indent << "Image2D Max Width: " << image2d_max_width() << std::endl;
oss << line_indent << "Image3D Max Depth: " << image3d_max_depth() << std::endl;
oss << line_indent << "Image3D Max Height: " << image3d_max_height() << std::endl;
oss << line_indent << "Image3D Max Width: " << image3d_max_width() << std::endl;
oss << line_indent << "Local Mem Size: " << local_mem_size() << " Bytes" << std::endl;
oss << line_indent << "Local Mem Type: " << local_mem_type_to_string(local_mem_type()) << std::endl;
oss << line_indent << "Max Clock Frequency: " << max_clock_frequency() << " MHz" << std::endl;
oss << line_indent << "Max Compute Units: " << max_compute_units() << std::endl;
oss << line_indent << "Max Constant Args: " << max_constant_args() << std::endl;
oss << line_indent << "Max Constant Buffer Size: " << max_constant_buffer_size() << " Bytes" << std::endl;
oss << line_indent << "Max Mem Alloc Size: " << max_mem_alloc_size() << " Bytes" << std::endl;
oss << line_indent << "Max Parameter Size: " << max_parameter_size() << " Bytes" << std::endl;
oss << line_indent << "Max Read Image Args: " << max_read_image_args() << std::endl;
oss << line_indent << "Max Samplers: " << max_samplers() << std::endl;
oss << line_indent << "Max Work Group Size: " << max_work_group_size() << std::endl;
oss << line_indent << "Max Work Item Dimensions: " << max_work_item_dimensions() << std::endl;
oss << line_indent << "Max Work Item Sizes: " << convert_to_string(max_work_item_sizes()) << std::endl;
oss << line_indent << "Max Write Image Args: " << max_write_image_args() << std::endl;
oss << line_indent << "Mem Base Addr Align: " << mem_base_addr_align() << std::endl;
oss << line_indent << "Min Data Type Align Size: " << min_data_type_align_size() << " Bytes" << std::endl;
oss << line_indent << "Name: " << name() << std::endl;
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR
oss << line_indent << "Native Vector Width char: " << native_vector_width_char() << std::endl;
#endif
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT
oss << line_indent << "Native Vector Width short: " << native_vector_width_short() << std::endl;
#endif
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
oss << line_indent << "Native Vector Width int: " << native_vector_width_int() << std::endl;
#endif
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
oss << line_indent << "Native Vector Width long: " << native_vector_width_long() << std::endl;
#endif
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT
oss << line_indent << "Native Vector Width float: " << native_vector_width_float() << std::endl;
#endif
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE
oss << line_indent << "Native Vector Width double: " << native_vector_width_double() << std::endl;
#endif
#ifdef CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF
oss << line_indent << "Native Vector Width half: " << native_vector_width_half() << std::endl;
#endif
#ifdef CL_DEVICE_OPENCL_C_VERSION
oss << line_indent << "OpenCL C Version: " << opencl_c_version() << std::endl;
#endif
oss << line_indent << "Platform: " << platform() << std::endl;
oss << line_indent << "Preferred Vector Width char: " << preferred_vector_width_char() << std::endl;
oss << line_indent << "Preferred Vector Width short: " << preferred_vector_width_short() << std::endl;
oss << line_indent << "Preferred Vector Width int: " << preferred_vector_width_int() << std::endl;
oss << line_indent << "Preferred Vector Width long: " << preferred_vector_width_long() << std::endl;
oss << line_indent << "Preferred Vector Width float: " << preferred_vector_width_float() << std::endl;
oss << line_indent << "Preferred Vector Width double: " << preferred_vector_width_double() << std::endl;
#ifdef CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF
oss << line_indent << "Preferred Vector Width half: " << preferred_vector_width_half() << std::endl;
#endif
oss << line_indent << "Profile: " << profile() << std::endl;
oss << line_indent << "Profiling Timer Resolution: " << profiling_timer_resolution() << " ns" << std::endl;
oss << line_indent << "Queue Properties: " << queue_properties_to_string(queue_properties()) << std::endl;
oss << line_indent << "Single FP Config: " << fp_config_to_string(single_fp_config()) << std::endl;
oss << line_indent << "Type: " << device_type_to_string(type()) << std::endl;
oss << line_indent << "Vendor: " << vendor() << std::endl;
oss << line_indent << "Vendor ID: " << vendor_id() << std::endl;
oss << line_indent << "Version: " << version() << std::endl;
oss << line_indent << "Driver Version: " << driver_version() << std::endl;
return oss.str();
}
bool operator==(device const & other) const
{
return device_ == other.device_;
}
bool operator==(cl_device_id other) const
{
return device_ == other;
}
std::string fp_config_to_string(cl_device_fp_config conf) const
{
std::ostringstream oss;
if (conf & CL_FP_DENORM)
oss << "CL_FP_DENORM ";
if (conf & CL_FP_INF_NAN)
oss << "CL_FP_INF_NAN ";
if (conf & CL_FP_ROUND_TO_NEAREST)
oss << "CL_FP_ROUND_TO_NEAREST ";
if (conf & CL_FP_ROUND_TO_ZERO)
oss << "CL_FP_ROUND_TO_ZERO ";
if (conf & CL_FP_ROUND_TO_INF)
oss << "CL_FP_ROUND_TO_INF ";
if (conf & CL_FP_FMA)
oss << "CL_FP_FMA ";
#ifdef CL_FP_SOFT_FLOAT
if (conf & CL_FP_SOFT_FLOAT)
oss << "CL_FP_SOFT_FLOAT ";
#endif
return oss.str();
}
std::string exec_capabilities_to_string(cl_device_exec_capabilities cap) const
{
std::ostringstream oss;
if (cap & CL_EXEC_KERNEL)
oss << "CL_EXEC_KERNEL ";
if (cap & CL_EXEC_NATIVE_KERNEL)
oss << "CL_EXEC_NATIVE_KERNEL ";
return oss.str();
}
std::string mem_cache_type_to_string(cl_device_mem_cache_type cachetype) const
{
std::ostringstream oss;
if (cachetype == CL_NONE)
oss << "CL_NONE ";
else if (cachetype == CL_READ_ONLY_CACHE)
oss << "CL_READ_ONLY_CACHE ";
else if (cachetype == CL_READ_WRITE_CACHE)
oss << "CL_READ_WRITE_CACHE ";
return oss.str();
}
std::string local_mem_type_to_string(cl_device_local_mem_type loc_mem_type) const
{
std::ostringstream oss;
if (loc_mem_type & CL_LOCAL)
oss << "CL_LOCAL ";
if (loc_mem_type & CL_GLOBAL)
oss << "CL_GLOBAL ";
return oss.str();
}
std::string convert_to_string(std::vector<size_t> const & vec) const
{
std::ostringstream oss;
for (vcl_size_t i=0; i<vec.size(); ++i)
oss << vec[i] << " ";
return oss.str();
}
std::string queue_properties_to_string(cl_command_queue_properties queue_prop) const
{
std::ostringstream oss;
if (queue_prop & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)
oss << "CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE ";
if (queue_prop & CL_QUEUE_PROFILING_ENABLE)
oss << "CL_QUEUE_PROFILING_ENABLE ";
return oss.str();
}
std::string device_type_to_string(cl_device_type dev_type) const
{
std::ostringstream oss;
if (dev_type & CL_DEVICE_TYPE_GPU)
oss << "GPU ";
if (dev_type & CL_DEVICE_TYPE_CPU)
oss << "CPU ";
if (dev_type & CL_DEVICE_TYPE_ACCELERATOR)
oss << "Accelerator ";
if (dev_type & CL_DEVICE_TYPE_DEFAULT)
oss << "(default)";
return oss.str();
}
private:
void flush_cache()
{
address_bits_valid_ = false;
architecture_family_valid_ = false;
available_valid_ = false;
compiler_available_valid_ = false;
#ifdef CL_DEVICE_DOUBLE_FP_CONFIG
double_fp_config_valid_ = false;
#endif
endian_little_valid_ = false;
error_correction_support_valid_ = false;
execution_capabilities_valid_ = false;
extensions_valid_ = false;
global_mem_cache_size_valid_ = false;
global_mem_cache_type_valid_ = false;
global_mem_cacheline_size_valid_ = false;
global_mem_size_valid_ = false;
#ifdef CL_DEVICE_HALF_FP_CONFIG
half_fp_config_valid_ = false;
#endif
host_unified_memory_valid_ = false;
image_support_valid_ = false;
image2d_max_height_valid_ = false;
image2d_max_width_valid_ = false;
image3d_max_depth_valid_ = false;
image3d_max_height_valid_ = false;
image3d_max_width_valid_ = false;
local_mem_size_valid_ = false;
local_mem_type_valid_ = false;
max_clock_frequency_valid_ = false;
max_compute_units_valid_ = false;
max_constant_args_valid_ = false;
max_constant_buffer_size_valid_ = false;
max_mem_alloc_size_valid_ = false;
max_parameter_size_valid_ = false;
max_read_image_args_valid_ = false;
max_samplers_valid_ = false;
max_work_group_size_valid_ = false;
max_work_item_dimensions_valid_ = false;
max_work_item_sizes_valid_ = false;
max_write_image_args_valid_ = false;
mem_base_addr_align_valid_ = false;
min_data_type_align_size_valid_ = false;
name_valid_ = false;
native_vector_width_char_valid_ = false;
native_vector_width_short_valid_ = false;
native_vector_width_int_valid_ = false;
native_vector_width_long_valid_ = false;
native_vector_width_float_valid_ = false;
native_vector_width_double_valid_ = false;
native_vector_width_half_valid_ = false;
opencl_c_version_valid_ = false;
platform_valid_ = false;
preferred_vector_width_char_valid_ = false;
preferred_vector_width_short_valid_ = false;
preferred_vector_width_int_valid_ = false;
preferred_vector_width_long_valid_ = false;
preferred_vector_width_float_valid_ = false;
preferred_vector_width_double_valid_ = false;
preferred_vector_width_half_valid_ = false;
profile_valid_ = false;
profiling_timer_resolution_valid_ = false;
queue_properties_valid_ = false;
single_fp_config_valid_ = false;
type_valid_ = false;
vendor_valid_ = false;
vendor_id_valid_ = false;
version_valid_ = false;
driver_version_valid_ = false;
}
cl_device_id device_;
//
// Device information supported by OpenCL 1.0 to follow
// cf. http://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/clGetDeviceInfo.html
// Note that all members are declared 'mutable', as they represent a caching mechanism in order to circumvent repeated potentially expensive calls to the OpenCL SDK
//
mutable bool address_bits_valid_;
mutable cl_uint address_bits_;
mutable bool available_valid_;
mutable cl_bool available_;
mutable bool compiler_available_valid_;
mutable cl_bool compiler_available_;
#ifdef CL_DEVICE_DOUBLE_FP_CONFIG
mutable bool double_fp_config_valid_;
mutable cl_device_fp_config double_fp_config_;
#endif
mutable bool endian_little_valid_;
mutable cl_bool endian_little_;
mutable bool error_correction_support_valid_;
mutable cl_bool error_correction_support_;
mutable bool execution_capabilities_valid_;
mutable cl_device_exec_capabilities execution_capabilities_;
mutable bool extensions_valid_;
mutable char extensions_[2048]; // don't forget to adjust member function accordingly when changing array size
mutable bool global_mem_cache_size_valid_;
mutable cl_ulong global_mem_cache_size_;
mutable bool global_mem_cache_type_valid_;
mutable cl_device_mem_cache_type global_mem_cache_type_;
mutable bool global_mem_cacheline_size_valid_;
mutable cl_uint global_mem_cacheline_size_;
mutable bool global_mem_size_valid_;
mutable cl_ulong global_mem_size_;
#ifdef CL_DEVICE_HALF_FP_CONFIG
mutable bool half_fp_config_valid_;
mutable cl_device_fp_config half_fp_config_;
#endif
mutable bool host_unified_memory_valid_;
mutable cl_bool host_unified_memory_;
mutable bool image_support_valid_;
mutable cl_bool image_support_;
mutable bool image2d_max_height_valid_;
mutable size_t image2d_max_height_;
mutable bool image2d_max_width_valid_;
mutable size_t image2d_max_width_;
mutable bool image3d_max_depth_valid_;
mutable size_t image3d_max_depth_;
mutable bool image3d_max_height_valid_;
mutable size_t image3d_max_height_;
mutable bool image3d_max_width_valid_;
mutable size_t image3d_max_width_;
mutable bool local_mem_size_valid_;
mutable cl_ulong local_mem_size_;
mutable bool local_mem_type_valid_;
mutable cl_device_local_mem_type local_mem_type_;
mutable bool max_clock_frequency_valid_;
mutable cl_uint max_clock_frequency_;
mutable bool max_compute_units_valid_;
mutable cl_uint max_compute_units_;
mutable bool max_constant_args_valid_;
mutable cl_uint max_constant_args_;
mutable bool max_constant_buffer_size_valid_;
mutable cl_ulong max_constant_buffer_size_;
mutable bool max_mem_alloc_size_valid_;
mutable cl_ulong max_mem_alloc_size_;
mutable bool max_parameter_size_valid_;
mutable size_t max_parameter_size_;
mutable bool max_read_image_args_valid_;
mutable cl_uint max_read_image_args_;
mutable bool max_samplers_valid_;
mutable cl_uint max_samplers_;
mutable bool max_work_group_size_valid_;
mutable size_t max_work_group_size_;
mutable bool max_work_item_dimensions_valid_;
mutable cl_uint max_work_item_dimensions_;
mutable bool max_work_item_sizes_valid_;
mutable size_t max_work_item_sizes_[16]; //we do not support execution models with more than 16 dimensions. This should totally suffice in practice, though.
mutable bool max_write_image_args_valid_;
mutable cl_uint max_write_image_args_;
mutable bool mem_base_addr_align_valid_;
mutable cl_uint mem_base_addr_align_;
mutable bool min_data_type_align_size_valid_;
mutable cl_uint min_data_type_align_size_;
mutable bool name_valid_;
mutable char name_[256]; // don't forget to adjust member function accordingly when changing array size
mutable bool native_vector_width_char_valid_;
mutable cl_uint native_vector_width_char_;
mutable bool native_vector_width_short_valid_;
mutable cl_uint native_vector_width_short_;
mutable bool native_vector_width_int_valid_;
mutable cl_uint native_vector_width_int_;
mutable bool native_vector_width_long_valid_;
mutable cl_uint native_vector_width_long_;
mutable bool native_vector_width_float_valid_;
mutable cl_uint native_vector_width_float_;
mutable bool native_vector_width_double_valid_;
mutable cl_uint native_vector_width_double_;
mutable bool native_vector_width_half_valid_;
mutable cl_uint native_vector_width_half_;
mutable bool opencl_c_version_valid_;
mutable char opencl_c_version_[128]; // don't forget to adjust member function accordingly when changing array size
mutable bool platform_valid_;
mutable cl_platform_id platform_;
mutable bool preferred_vector_width_char_valid_;
mutable cl_uint preferred_vector_width_char_;
mutable bool preferred_vector_width_short_valid_;
mutable cl_uint preferred_vector_width_short_;
mutable bool preferred_vector_width_int_valid_;
mutable cl_uint preferred_vector_width_int_;
mutable bool preferred_vector_width_long_valid_;
mutable cl_uint preferred_vector_width_long_;
mutable bool preferred_vector_width_float_valid_;
mutable cl_uint preferred_vector_width_float_;
mutable bool preferred_vector_width_double_valid_;
mutable cl_uint preferred_vector_width_double_;
mutable bool preferred_vector_width_half_valid_;
mutable cl_uint preferred_vector_width_half_;
mutable bool profile_valid_;
mutable char profile_[32]; // don't forget to adjust member function accordingly when changing array size
mutable bool profiling_timer_resolution_valid_;
mutable size_t profiling_timer_resolution_;
mutable bool queue_properties_valid_;
mutable cl_command_queue_properties queue_properties_;
mutable bool single_fp_config_valid_;
mutable cl_device_fp_config single_fp_config_;
mutable bool type_valid_;
mutable cl_device_type type_;
mutable bool vendor_valid_;
mutable char vendor_[256]; // don't forget to adjust member function accordingly when changing array size
mutable bool vendor_id_valid_;
mutable cl_uint vendor_id_;
mutable bool version_valid_;
mutable char version_[256]; // don't forget to adjust member function accordingly when changing array size
mutable bool driver_version_valid_;
mutable char driver_version_[256]; // don't forget to adjust member function accordingly when changing array size
mutable bool architecture_family_valid_;
mutable device_architecture_family architecture_family_;
};
} //namespace ocl
} //namespace viennacl
#endif
viennacl::ocl::device::image3d_max_depth
size_t image3d_max_depth() const
Max depth of 3D image in pixels. The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE...
Definition: device.hpp:324
viennacl::ocl::device::id
cl_device_id id() const
Returns the OpenCL device id.
Definition: device.hpp:981
viennacl::ocl::device::min_data_type_align_size
cl_uint min_data_type_align_size() const
The smallest alignment in bytes which can be used for any data type.
Definition: device.hpp:554
viennacl::ocl::device::execution_capabilities
cl_device_exec_capabilities execution_capabilities() const
Describes the execution capabilities of the device.
Definition: device.hpp:167
viennacl::ocl::device::driver_version
std::string driver_version() const
Vendor name string.
Definition: device.hpp:941
viennacl::ocl::device::image_support
cl_bool image_support() const
Is CL_TRUE if the device and the host have a unified memory subsystem and is CL_FALSE otherwise...
Definition: device.hpp:288
viennacl::ocl::device::max_read_image_args
cl_uint max_read_image_args() const
Max number of simultaneous image objects that can be read by a kernel. The minimum value is 128 if CL...
Definition: device.hpp:459
viennacl::ocl::device::global_mem_cache_type
cl_device_mem_cache_type global_mem_cache_type() const
Type of global memory cache supported. Valid values are: CL_NONE, CL_READ_ONLY_CACHE, and CL_READ_WRITE_CACHE.
Definition: device.hpp:213
viennacl::ocl::device::preferred_vector_width_char
cl_uint preferred_vector_width_char() const
Preferred native vector width size for built-in scalar types that can be put into vectors...
Definition: device.hpp:726
viennacl::ocl::device::compiler_available
cl_bool compiler_available() const
Is CL_FALSE if the implementation does not have a compiler available to compile the program source...
Definition: device.hpp:99
viennacl::ocl::device::max_constant_buffer_size
cl_ulong max_constant_buffer_size() const
Max size in bytes of a constant buffer allocation. The minimum value is 64 KB.
Definition: device.hpp:420
viennacl::ocl::device::operator==
bool operator==(device const &other) const
Definition: device.hpp:1114
viennacl::ocl::device::max_write_image_args
cl_uint max_write_image_args() const
Max number of simultaneous image objects that can be written to by a kernel. The minimum value is 8 i...
Definition: device.hpp:530
viennacl::ocl::device::max_mem_alloc_size
cl_ulong max_mem_alloc_size() const
Max size of memory object allocation in bytes. The minimum value is max(1/4th of CL_DEVICE_GLOBAL_MEM...
Definition: device.hpp:432
viennacl::ocl::device::preferred_vector_width_int
cl_uint preferred_vector_width_int() const
Preferred native vector width size for built-in scalar types that can be put into vectors...
Definition: device.hpp:750
viennacl::ocl::device::preferred_vector_width_short
cl_uint preferred_vector_width_short() const
Preferred native vector width size for built-in scalar types that can be put into vectors...
Definition: device.hpp:738
viennacl::ocl::device
A class representing a compute device (e.g. a GPU)
Definition: device.hpp:49
viennacl::ocl::device::local_mem_size
cl_ulong local_mem_size() const
Size of local memory arena in bytes. The minimum value is 32 KB.
Definition: device.hpp:360
viennacl::ocl::device::queue_properties_to_string
std::string queue_properties_to_string(cl_command_queue_properties queue_prop) const
Definition: device.hpp:1192
viennacl::ocl::device::type
cl_device_type type() const
The OpenCL device type.
Definition: device.hpp:893
viennacl::ocl::device::operator==
bool operator==(cl_device_id other) const
Definition: device.hpp:1119
viennacl::ocl::device::vendor_id
cl_uint vendor_id() const
A unique device vendor identifier. An example of a unique device identifier could be the PCIe ID...
Definition: device.hpp:917
viennacl::ocl::device::preferred_vector_width_float
cl_uint preferred_vector_width_float() const
Preferred native vector width size for built-in scalar types that can be put into vectors...
Definition: device.hpp:774
viennacl::ocl::device::error_correction_support
cl_bool error_correction_support() const
Is CL_TRUE if the device implements error correction for all accesses to compute device memory (globa...
Definition: device.hpp:149
viennacl::ocl::device::info
std::string info(vcl_size_t indent=0, char indent_char= ' ') const
Returns an info string with a few properties of the device. Use full_info() to get all details...
Definition: device.hpp:995
VIENNACL_ERR_CHECK
#define VIENNACL_ERR_CHECK(err)
Definition: error.hpp:681
viennacl::ocl::device::image3d_max_width
size_t image3d_max_width() const
Max width of 3D image in pixels. The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE...
Definition: device.hpp:348
viennacl::ocl::device::fp_config_to_string
std::string fp_config_to_string(cl_device_fp_config conf) const
Helper function converting a floating point configuration to a string.
Definition: device.hpp:1125
viennacl::ocl::device::local_mem_type
cl_device_local_mem_type local_mem_type() const
Type of local memory supported. This can be set to CL_LOCAL implying dedicated local memory storage s...
Definition: device.hpp:372
viennacl::ocl::device::image2d_max_height
size_t image2d_max_height() const
Max height of 2D image in pixels. The minimum value is 8192 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE...
Definition: device.hpp:300
viennacl::ocl::device::image3d_max_height
size_t image3d_max_height() const
Max height of 3D image in pixels. The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE...
Definition: device.hpp:336
viennacl::ocl::device::platform
cl_platform_id platform() const
The platform associated with this device.
Definition: device.hpp:714
viennacl::ocl::device::device
device(cl_device_id dev)
Definition: device.hpp:54
handle.hpp
Implementation of a smart-pointer-like class for handling OpenCL handles.
viennacl::ocl::device::image2d_max_width
size_t image2d_max_width() const
Max width of 2D image in pixels. The minimum value is 8192 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE...
Definition: device.hpp:312
viennacl::ocl::device::global_mem_cacheline_size
cl_uint global_mem_cacheline_size() const
Size of global memory cache in bytes.
Definition: device.hpp:225
device_utils.hpp
Various utility implementations for dispatching with respect to the different devices available on th...
viennacl::ocl::device::global_mem_cache_size
cl_ulong global_mem_cache_size() const
Size of global memory cache in bytes.
Definition: device.hpp:201
viennacl::ocl::device::double_support
bool double_support() const
ViennaCL convenience function: Returns true if the device supports double precision.
Definition: device.hpp:956
viennacl::ocl::device::max_constant_args
cl_uint max_constant_args() const
Max number of arguments declared with the __constant qualifier in a kernel. The minimum value is 8...
Definition: device.hpp:408
viennacl::ocl::device::device
device(const device &other)
Definition: device.hpp:62
viennacl::ocl::device::single_fp_config
cl_device_fp_config single_fp_config() const
Describes single precision floating-point capability of the OpenCL device.
Definition: device.hpp:878
viennacl::vcl_size_t
std::size_t vcl_size_t
Definition: forwards.h:75
viennacl::ocl::get_architecture_family
device_architecture_family get_architecture_family(cl_uint vendor_id, std::string const &name)
Definition: device_utils.hpp:72
viennacl::ocl::device::mem_cache_type_to_string
std::string mem_cache_type_to_string(cl_device_mem_cache_type cachetype) const
Definition: device.hpp:1159
viennacl::ocl::device::name
std::string name() const
Device name string.
Definition: device.hpp:566
viennacl::ocl::device::architecture_family
device_architecture_family architecture_family() const
Device architecture family.
Definition: device.hpp:578
viennacl::ocl::device::global_mem_size
cl_ulong global_mem_size() const
Size of global memory in bytes.
Definition: device.hpp:237
viennacl::ocl::device::double_support_extension
std::string double_support_extension() const
ViennaCL convenience function: Returns the device extension which enables double precision (usually c...
Definition: device.hpp:967
error.hpp
Error handling for the OpenCL layer of ViennaCL.
viennacl::ocl::device::available
cl_bool available() const
Is CL_TRUE if the device is available and CL_FALSE if the device is not available.
Definition: device.hpp:87
viennacl::ocl::device::extensions
std::string extensions() const
Returns a space-separated list of extension names (the extension names themselves do not contain any ...
Definition: device.hpp:189
viennacl::ocl::device::version
std::string version() const
Vendor name string.
Definition: device.hpp:929
viennacl::ocl::device::max_work_item_dimensions
cl_uint max_work_item_dimensions() const
Maximum dimensions that specify the global and local work-item IDs used by the data parallel executio...
Definition: device.hpp:495
viennacl::ocl::device::exec_capabilities_to_string
std::string exec_capabilities_to_string(cl_device_exec_capabilities cap) const
Definition: device.hpp:1148
viennacl::ocl::device::preferred_vector_width_double
cl_uint preferred_vector_width_double() const
Preferred native vector width size for built-in scalar types that can be put into vectors...
Definition: device.hpp:789
viennacl::ocl::device::endian_little
cl_bool endian_little() const
Is CL_TRUE if the OpenCL device is a little endian device and CL_FALSE otherwise. ...
Definition: device.hpp:137
viennacl::ocl::device::address_bits
cl_uint address_bits() const
The default compute device address space size specified as an unsigned integer value in bits...
Definition: device.hpp:75
viennacl::ocl::device::vendor
std::string vendor() const
Vendor name string.
Definition: device.hpp:905
viennacl::ocl::device::max_clock_frequency
cl_uint max_clock_frequency() const
Maximum configured clock frequency of the device in MHz.
Definition: device.hpp:384
viennacl::ocl::device_architecture_family
device_architecture_family
Definition: device_utils.hpp:55
viennacl::ocl::device::device_type_to_string
std::string device_type_to_string(cl_device_type dev_type) const
Definition: device.hpp:1203
viennacl::ocl::device::profile
std::string profile() const
Preferred native vector width size for built-in scalar types that can be put into vectors...
Definition: device.hpp:823
viennacl::ocl::device::convert_to_string
std::string convert_to_string(std::vector< size_t > const &vec) const
Definition: device.hpp:1183
viennacl::ocl::device::local_mem_type_to_string
std::string local_mem_type_to_string(cl_device_local_mem_type loc_mem_type) const
Definition: device.hpp:1172
viennacl::ocl::device::max_samplers
cl_uint max_samplers() const
Max number of simultaneous image objects that can be read by a kernel. The minimum value is 128 if CL...
Definition: device.hpp:471
viennacl::ocl::device::max_compute_units
cl_uint max_compute_units() const
The number of parallel compute cores on the OpenCL device. The minimum value is 1.
Definition: device.hpp:396
viennacl::ocl::device::profiling_timer_resolution
size_t profiling_timer_resolution() const
Describes the resolution of device timer. This is measured in nanoseconds.
Definition: device.hpp:835
viennacl::ocl::device::max_work_group_size
size_t max_work_group_size() const
Maximum number of work-items in a work-group executing a kernel using the data parallel execution mod...
Definition: device.hpp:483
viennacl::ocl::device::full_info
std::string full_info(vcl_size_t indent=0, char indent_char= ' ') const
Returns an info string with all device properties defined in the OpenCL 1.1 standard, listed in alphabetical order. Use info() for a short overview.
Definition: device.hpp:1020
viennacl::ocl::device::device
device()
Definition: device.hpp:52
viennacl::ocl::device::mem_base_addr_align
cl_uint mem_base_addr_align() const
Describes the alignment in bits of the base address of any allocated memory object.
Definition: device.hpp:542
viennacl::ocl::device::max_parameter_size
size_t max_parameter_size() const
Max size in bytes of the arguments that can be passed to a kernel. The minimum value is 1024...
Definition: device.hpp:447
viennacl::ocl::device::preferred_vector_width_long
cl_uint preferred_vector_width_long() const
Preferred native vector width size for built-in scalar types that can be put into vectors...
Definition: device.hpp:762
viennacl::ocl::device::max_work_item_sizes
std::vector< size_t > max_work_item_sizes() const
Maximum number of work-items that can be specified in each dimension of the work-group.
Definition: device.hpp:510
viennacl::ocl::device::queue_properties
cl_command_queue_properties queue_properties() const
Describes the command-queue properties supported by the device.
Definition: device.hpp:854