HCC
HCC is a single-source, C/C++ compiler for heterogeneous computing. It's optimized with HSA (http://www.hsafoundation.com/).
Public Member Functions | Static Public Member Functions | Friends | List of all members
Concurrency::accelerator Class Reference

Represents a physical accelerated computing device. More...

#include <amp.h>

Collaboration diagram for Concurrency::accelerator:
Collaboration graph

Public Member Functions

 accelerator ()
 Constructs a new accelerator object that represents the default accelerator. More...
 
 accelerator (const std::wstring &path)
 Constructs a new accelerator object that represents the physical device named by the "path" argument. More...
 
 accelerator (const accelerator &other)
 Copy constructs an accelerator object. More...
 
acceleratoroperator= (const accelerator &other)
 Assigns an accelerator object to "this" accelerator object and returns a reference to "this" object. More...
 
accelerator_view get_default_view () const
 Returns the default accelerator_view associated with the accelerator. More...
 
accelerator_view create_view (queuing_mode qmode=queuing_mode_automatic)
 Creates and returns a new accelerator view on the accelerator with the supplied queuing mode. More...
 
bool operator== (const accelerator &other) const
 Compares "this" accelerator with the passed accelerator object to determine if they represent the same underlying device. More...
 
bool operator!= (const accelerator &other) const
 Compares "this" accelerator with the passed accelerator object to determine if they represent different devices. More...
 
bool set_default_cpu_access_type (access_type default_cpu_access_type)
 Sets the default_cpu_access_type for this accelerator. More...
 
std::wstring get_device_path () const
 Returns a system-wide unique device instance path that matches the "Device Instance Path" property for the device in Device Manager, or one of the predefined path constants cpu_accelerator.
 
std::wstring get_description () const
 Returns a short textual description of the accelerator device.
 
unsigned int get_version () const
 Returns a 32-bit unsigned integer representing the version number of this accelerator. More...
 
bool get_has_display () const
 This property indicates that the accelerator may be shared by (and thus have interference from) the operating system or other system software components for rendering purposes. More...
 
size_t get_dedicated_memory () const
 Returns the amount of dedicated memory (in KB) on an accelerator device. More...
 
bool get_supports_double_precision () const
 Returns a Boolean value indicating whether this accelerator supports double-precision (double) computations. More...
 
bool get_supports_limited_double_precision () const
 Returns a boolean value indicating whether the accelerator has limited double precision support (excludes double division, precise_math functions, int to double, double to int conversions) for a parallel_for_each kernel.
 
bool get_is_debug () const
 Returns a boolean value indicating whether the accelerator supports debugging.
 
bool get_is_emulated () const
 Returns a boolean value indicating whether the accelerator is emulated. More...
 
bool get_supports_cpu_shared_memory () const
 Returns a boolean value indicating whether the accelerator supports memory accessible both by the accelerator and the CPU.
 
access_type get_default_cpu_access_type () const
 Get the default cpu access_type for buffers created on this accelerator.
 

Static Public Member Functions

static std::vector< acceleratorget_all ()
 Returns a std::vector of accelerator objects (in no specific order) representing all accelerators that are available, including reference accelerators and WARP accelerators if available. More...
 
static bool set_default (const std::wstring &path)
 Sets the default accelerator to the device path identified by the "path" argument. More...
 
static accelerator_view get_auto_selection_view ()
 Returns an accelerator_view which when passed as the first argument to a parallel_for_each call causes the runtime to automatically select the target accelerator_view for executing the parallel_for_each kernel. More...
 

Static Public Attributes

static const wchar_t default_accelerator []
 These are static constant string literals that represent device paths for known accelerators, or in the case of "default_accelerator", direct the runtime to choose an accelerator automatically. More...
 
static const wchar_t cpu_accelerator []
 These are static constant string literals that represent device paths for known accelerators, or in the case of "default_accelerator", direct the runtime to choose an accelerator automatically. More...
 

Friends

class accelerator_view
 

Detailed Description

Represents a physical accelerated computing device.

An object of this type can be created by enumerating the available devices, or getting the default device.

Constructor & Destructor Documentation

Concurrency::accelerator::accelerator ( )
inline

Constructs a new accelerator object that represents the default accelerator.

This is equivalent to calling the constructor

The actual accelerator chosen as the default can be affected by calling accelerator::set_default().

Concurrency::accelerator::accelerator ( const std::wstring &  path)
inlineexplicit

Constructs a new accelerator object that represents the physical device named by the "path" argument.

If the path represents an unknown or unsupported device, an exception will be thrown.

The path can be one of the following:

  1. accelerator::default_accelerator (or L"default"), which represents the path of the fastest accelerator available, as chosen by the runtime.
  2. accelerator::cpu_accelerator (or L"cpu"), which represents the CPU. Note that parallel_for_each shall not be invoked over this accelerator.
  3. A valid device path that uniquely identifies a hardware accelerator available on the host system.
Parameters
[in]pathThe device path of this accelerator.
Concurrency::accelerator::accelerator ( const accelerator other)
inline

Copy constructs an accelerator object.

This function does a shallow copy with the newly created accelerator object pointing to the same underlying device as the passed accelerator parameter.

Parameters
[in]otherThe accelerator object to be copied.

Member Function Documentation

accelerator_view Concurrency::accelerator::create_view ( queuing_mode  qmode = queuing_mode_automatic)
inline

Creates and returns a new accelerator view on the accelerator with the supplied queuing mode.

Parameters
[in]qmodeThe queuing mode of the accelerator_view to be created. See "Queuing Mode". The default value would be queueing_mdoe_automatic if not specified.
static std::vector<accelerator> Concurrency::accelerator::get_all ( )
inlinestatic

Returns a std::vector of accelerator objects (in no specific order) representing all accelerators that are available, including reference accelerators and WARP accelerators if available.

Returns
A vector of accelerators.
static accelerator_view Concurrency::accelerator::get_auto_selection_view ( )
inlinestatic

Returns an accelerator_view which when passed as the first argument to a parallel_for_each call causes the runtime to automatically select the target accelerator_view for executing the parallel_for_each kernel.

In other words, a parallel_for_each invocation with the accelerator_view returned by get_auto_selection_view() is the same as a parallel_for_each invocation without an accelerator_view argument.

For all other purposes, the accelerator_view returned by get_auto_selection_view() behaves the same as the default accelerator_view of the default accelerator (aka accelerator().get_default_view() ).

Returns
An accelerator_view than can be used to indicate auto selection of the target for a parallel_for_each execution.
size_t Concurrency::accelerator::get_dedicated_memory ( ) const
inline

Returns the amount of dedicated memory (in KB) on an accelerator device.

There is no guarantee that this amount of memory is actually available to use.

accelerator_view Concurrency::accelerator::get_default_view ( ) const
inline

Returns the default accelerator_view associated with the accelerator.

The queuing_mode of the default accelerator_view is queuing_mode_automatic.

Returns
The default accelerator_view object associated with the accelerator.
bool Concurrency::accelerator::get_has_display ( ) const
inline

This property indicates that the accelerator may be shared by (and thus have interference from) the operating system or other system software components for rendering purposes.

A C++ AMP implementation may set this property to false should such interference not be applicable for a particular accelerator.

bool Concurrency::accelerator::get_is_emulated ( ) const
inline

Returns a boolean value indicating whether the accelerator is emulated.

This is true, for example, with the reference, WARP, and CPU accelerators.

bool Concurrency::accelerator::get_supports_double_precision ( ) const
inline

Returns a Boolean value indicating whether this accelerator supports double-precision (double) computations.

When this returns true, supports_limited_double_precision also returns true.

unsigned int Concurrency::accelerator::get_version ( ) const
inline

Returns a 32-bit unsigned integer representing the version number of this accelerator.

The format of the integer is major.minor, where the major version number is in the high-order 16 bits, and the minor version number is in the low-order bits.

bool Concurrency::accelerator::operator!= ( const accelerator other) const
inline

Compares "this" accelerator with the passed accelerator object to determine if they represent different devices.

Parameters
[in]otherThe accelerator object to be compared against.
Returns
A boolean value indicating whether the passed accelerator object is different from "this" accelerator.
accelerator& Concurrency::accelerator::operator= ( const accelerator other)
inline

Assigns an accelerator object to "this" accelerator object and returns a reference to "this" object.

This function does a shallow assignment with the newly created accelerator object pointing to the same underlying device as the passed accelerator parameter.

Parameters
otherThe accelerator object to be assigned from.
Returns
A reference to "this" accelerator object.
bool Concurrency::accelerator::operator== ( const accelerator other) const
inline

Compares "this" accelerator with the passed accelerator object to determine if they represent the same underlying device.

Parameters
[in]otherThe accelerator object to be compared against.
Returns
A boolean value indicating whether the passed accelerator object is same as "this" accelerator.
static bool Concurrency::accelerator::set_default ( const std::wstring &  path)
inlinestatic

Sets the default accelerator to the device path identified by the "path" argument.

See the constructor accelerator(const std::wstring& path) for a description of the allowable path strings.

This establishes a process-wide default accelerator and influences all subsequent operations that might use a default accelerator.

Parameters
[in]pathThe device path of the default accelerator.
Returns
A Boolean flag indicating whether the default was set. If the default has already been set for this process, this value will be false, and the function will have no effect.
bool Concurrency::accelerator::set_default_cpu_access_type ( access_type  default_cpu_access_type)
inline

Sets the default_cpu_access_type for this accelerator.

The default_cpu_access_type is used for arrays created on this accelerator or for implicit array_view memory allocations accessed on this this accelerator.

This method only succeeds if the default_cpu_access_type for the accelerator has not already been overriden 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 array_view memory allocation on this accelerator.

Parameters
[in]default_cpu_access_typeThe default cpu access_type to be used for array/array_view memory allocations on this accelerator.
Returns
A boolean value indicating if the default cpu access_type for the accelerator was successfully set.

Member Data Documentation

const wchar_t Concurrency::accelerator::cpu_accelerator[]
static

These are static constant string literals that represent device paths for known accelerators, or in the case of "default_accelerator", direct the runtime to choose an accelerator automatically.

default_accelerator: The string L"default" represents the default accelerator, which directs the runtime to choose the fastest accelerator available. The selection criteria are discussed in section 3.2.1 Default Accelerator.

cpu_accelerator: The string L"cpu" represents the host system. This accelerator is used to provide a location for system-allocated memory such as host arrays and staging arrays. It is not a valid target for accelerated computations.

const wchar_t Concurrency::accelerator::default_accelerator[]
static

These are static constant string literals that represent device paths for known accelerators, or in the case of "default_accelerator", direct the runtime to choose an accelerator automatically.

default_accelerator: The string L"default" represents the default accelerator, which directs the runtime to choose the fastest accelerator available. The selection criteria are discussed in section 3.2.1 Default Accelerator.

cpu_accelerator: The string L"cpu" represents the host system. This accelerator is used to provide a location for system-allocated memory such as host arrays and staging arrays. It is not a valid target for accelerated computations.


The documentation for this class was generated from the following file: