Breyta

Deila með


accelerator Class

An accelerator is a hardware capability that is optimized for data-parallel computing. An accelerator may be a device attached to a PCIe bus (such as a GPU), or it might be an extended instruction set on the main CPU.

Syntax

class accelerator;

Members

Public Constructors

Name Description
accelerator Constructor Initializes a new instance of the accelerator class.
~accelerator Destructor Destroys the accelerator object.

Public Methods

Name Description
create_view Creates and returns an accelerator_view object on this accelerator.
get_all Returns a vector of accelerator objects that represent all the available accelerators.
get_auto_selection_view Returns the auto-selection accelerator_view.
get_dedicated_memory Returns the dedicated memory for the accelerator, in kilobytes.
get_default_cpu_access_type Returns the default access_type for buffers created on this accelerator.
get_default_view Returns the default accelerator_view object that is associated with the accelerator.
get_description Returns a short description of the accelerator device.
get_device_path Returns the path of the device.
get_has_display Determines whether the accelerator is attached to a display.
get_is_debug Determines whether the accelerator has the DEBUG layer enabled for extensive error reporting.
get_is_emulated Determines whether the accelerator is emulated.
get_supports_cpu_shared_memory Determines whether the accelerator supports shared memory
get_supports_double_precision Determines whether the accelerator is attached to a display.
get_supports_limited_double_precision Determines whether the accelerator has limited support for double-precision math.
get_version Returns the version of the accelerator.
set_default Returns the path of the default accelerator.
set_default_cpu_access_type Sets the default CPU access_typefor arrays and implicit memory allocations made on this accelerator.

Public Operators

Name Description
operator!= Compares this accelerator object with another and returns false if they are the same; otherwise, returns true.
operator= Copies the contents of the specified accelerator object to this one.
operator== Compares this accelerator object with another and returns true if they are the same; otherwise, returns false.

Public Data Members

Name Description
cpu_accelerator Gets a string constant for the CPU accelerator.
dedicated_memory Gets the dedicated memory for the accelerator, in kilobytes.
default_accelerator Gets a string constant for the default accelerator.
default_cpu_access_type Gets or sets the default CPU access_typefor arrays and implicit memory allocations made on this accelerator.
default_view Gets the default accelerator_view object that is associated with the accelerator.
description Gets a short description of the accelerator device.
device_path Gets the path of the device.
direct3d_ref Gets a string constant for a Direct3D reference accelerator.
direct3d_warp Gets the string constant for an accelerator object that you can use for executing C++ AMP code on multi-core CPUs that use Streaming SIMD Extensions (SSE).
has_display Gets a Boolean value that indicates whether the accelerator is attached to a display.
is_debug Indicates whether the accelerator has the DEBUG layer enabled for extensive error reporting.
is_emulated Indicates whether the accelerator is emulated.
supports_cpu_shared_memory Indicates whether the accelerator supports shared memory.
supports_double_precision Indicates whether the accelerator supports double-precision math.
supports_limited_double_precision Indicates whether the accelerator has limited support for double-precision math.
version Gets the version of the accelerator.

Inheritance Hierarchy

accelerator

Remarks

An accelerator is a hardware capability that is optimized for data-parallel computing. An accelerator is often a discrete GPU, but it can also be a virtual host-side entity such as a DirectX REF device, a WARP (a CPU-side device that is accelerated by means of SSE instructions), or the CPU itself.

You can construct an accelerator object by enumerating the available devices, or by getting the default device, the reference device, or the WARP device.

Requirements

Header: amprt.h

Namespace: Concurrency

~accelerator

Destroys the accelerator object.

~accelerator();

Return Value

accelerator

Initializes a new instance of the accelerator class.

accelerator();

explicit accelerator(const std::wstring& _Device_path);

accelerator(const accelerator& _Other);

Parameters

_Device_path
The path of the physical device.

_Other
The accelerator to copy.

cpu_accelerator

Gets a string constant for the CPU accelerator.

static const wchar_t cpu_accelerator[];

create_view

Creates and returns an accelerator_view object on this accelerator, using the specified queuing mode. When the queuing mode is not specified, the new accelerator_view uses the queuing_mode::immediate queuing mode.

accelerator_view create_view(queuing_mode qmode = queuing_mode_automatic);

Parameters

qmode
The queuing mode.

Return Value

A new accelerator_view object on this accelerator, using the specified queuing mode.

dedicated_memory

Gets the dedicated memory for the accelerator, in kilobytes.

__declspec(property(get= get_dedicated_memory)) size_t dedicated_memory;

default_accelerator

Gets a string constant for the default accelerator.

static const wchar_t default_accelerator[];

default_cpu_access_type

The default cpu access_typefor arrays and implicit memory allocations made on this accelerator.

__declspec(property(get= get_default_cpu_access_type)) access_type default_cpu_access_type;

default_view

Gets the default accelerator view that is associated with the accelerator.

__declspec(property(get= get_default_view)) accelerator_view default_view;

description

Gets a short description of the accelerator device.

__declspec(property(get= get_description)) std::wstring description;

device_path

Gets the path of the accelerator. The path is unique on the system.

__declspec(property(get= get_device_path)) std::wstring device_path;

direct3d_ref

Gets a string constant for a Direct3D reference accelerator.

static const wchar_t direct3d_ref[];

direct3d_warp

Gets the string constant for an accelerator object that you can use for executing your C++ AMP code on multi-core CPUs using Streaming SIMD Extensions (SSE).

static const wchar_t direct3d_warp[];

get_all

Returns a vector of accelerator objects that represent all the available accelerators.

static inline std::vector<accelerator> get_all();

Return Value

The vector of available accelerators

get_auto_selection_view

Returns the auto selection accelerator_view, which when specified as the parallel_for_each target results in the target accelerator_view for executing the parallel_for_each kernel to be automatically selected by the runtime. For all other purposes, the accelerator_view returned by this method is the same as the default accelerator_view of the default accelerator

static accelerator_view __cdecl get_auto_selection_view();

Return Value

The auto selection accelerator_view.

get_dedicated_memory

Returns the dedicated memory for the accelerator, in kilobytes.

size_t get_dedicated_memory() const;

Return Value

The dedicated memory for the accelerator, in kilobytes.

get_default_cpu_access_type

Gets the default cpu access_type for buffers created on this accelerator

access_type get_default_cpu_access_type() const;

Return Value

The default cpu access_type for buffers created on this accelerator.

get_default_view

Returns the default accelerator_view object that is associated with the accelerator.

accelerator_view get_default_view() const;

Return Value

The default accelerator_view object that is associated with the accelerator.

get_description

Returns a short description of the accelerator device.

std::wstring get_description() const;

Return Value

A short description of the accelerator device.

get_device_path

Returns the path of the accelerator. The path is unique on the system.

std::wstring get_device_path() const;

Return Value

The system-wide unique device instance path.

get_has_display

Returns a Boolean value that indicates whether the accelerator can output to a display.

bool get_has_display() const;

Return Value

true if the accelerator can output to a display; otherwise, false.

get_is_debug

Determines whether the accelerator has the DEBUG layer enabled for extensive error reporting.

bool get_is_debug() const;

Return Value

true if the accelerator has the DEBUG layer enabled for extensive error reporting. Otherwise, false.

get_is_emulated

Determines whether the accelerator is emulated.

bool get_is_emulated() const;

Return Value

true if the accelerator is emulated. Otherwise, false.

get_supports_cpu_shared_memory

Returns a boolean value indicating whether the accelerator supports memory accessible both by the accelerator and the CPU.

bool get_supports_cpu_shared_memory() const;

Return Value

true if the accelerator supports CPU shared memory; otherwise, false.

get_supports_double_precision

Returns a Boolean value that indicates whether the accelerator supports double precision math, including fused multiply add (FMA), division, reciprocal, and casting between int and double

bool get_supports_double_precision() const;

Return Value

true if the accelerator supports double precision math; otherwise, false.

get_supports_limited_double_precision

Returns a Boolean value that indicates whether the accelerator has limited support for double precision math. If the accelerator has only limited support, then fused multiply add (FMA), division, reciprocal, and casting between int and double are not supported.

bool get_supports_limited_double_precision() const;

Return Value

true if the accelerator has limited support for double precision math; otherwise, false.

get_version

Returns the version of the accelerator.

unsigned int get_version() const;

Return Value

The version of the accelerator.

has_display

Gets a Boolean value that indicates whether the accelerator can output to a display.

__declspec(property(get= get_has_display)) bool has_display;

is_debug

Gets a Boolean value that indicates whether the accelerator has the DEBUG layer enabled for extensive error reporting.

__declspec(property(get= get_is_debug)) bool is_debug;

is_emulated

Gets a Boolean value that indicates whether the accelerator is emulated.

__declspec(property(get= get_is_emulated)) bool is_emulated;

operator!=

Compares this accelerator object with another and returns false if they are the same; otherwise, returns true.

bool operator!= (const accelerator& _Other) const;

Parameters

_Other
The accelerator object to compare with this one.

Return Value

false if the two accelerator objects are the same; otherwise, true.

operator=

Copies the contents of the specified accelerator object to this one.

accelerator& operator= (const accelerator& _Other);

Parameters

_Other
The accelerator object to copy from.

Return Value

A reference to this accelerator object.

operator==

Compares this accelerator object with another and returns true if they are the same; otherwise, returns false.

bool operator== (const accelerator& _Other) const;

Parameters

_Other
The accelerator object to compare with this one.

Return Value

true if the other accelerator object is same as this accelerator object; otherwise, false.

set_default

Sets the default accelerator to be used for any operation that implicitly uses the default accelerator. This method only succeeds if the runtime selected default accelerator has not already been used in an operation that implicitly uses the default accelerator

static inline bool set_default(std::wstring _Path);

Parameters

_Path
The path to the accelerator.

Return Value

true if the call succeeds at setting the default accelerator. Otherwise, false.

set_default_cpu_access_type

Set the default cpu access_type for arrays created on this accelerator or for implicit memory allocations as part of array_views accessed on this accelerator. This method only succeeds if the default_cpu_access_type for the accelerator has not already been overridden by a previous call to this method and the runtime selected default_cpu_access_type for this accelerator has not yet been used for allocating an array or for an implicit memory allocation backing an array_view accessed on this accelerator.

bool set_default_cpu_access_type(access_type _Default_cpu_access_type);

Parameters

_Default_cpu_access_type
The default cpu access_type to be used for array/array_view memory allocations on this accelerator.

Return Value

A boolean value indicating if the default cpu access_type for the accelerator was successfully set.

supports_cpu_shared_memory

Gets a Boolean value indicating whether the accelerator supports shared memory.

__declspec(property(get= get_supports_cpu_shared_memory)) bool supports_cpu_shared_memory;

supports_double_precision

Gets a Boolean value that indicates whether the accelerator supports double precision math.

__declspec(property(get= get_supports_double_precision)) bool supports_double_precision;

supports_limited_double_precision

Gets a Boolean value that indicates whether the accelerator has limited support for double precision math. If the accelerator has only limited support, then fused multiply add (FMA), division, reciprocal, and casting between int and double are not supported.

__declspec(property(get= get_supports_limited_double_precision)) bool supports_limited_double_precision;

version

Gets the version of the accelerator.

__declspec(property(get= get_version)) unsigned int version;

See also

Concurrency Namespace (C++ AMP)