Skip to Main Content Skip to Search
Product Documentation

GPU Characteristics and Limitations

Data Types

Code in a function passed to arrayfun for execution on the GPU can use only these GPU native data types: single, double, int32, uint32, and logical.

The overloaded functions for GPUArrays support these types where appropriate. GPUArrays also support the storing of data types in addition to these. This allows a GPUArray to be used with kernels written for these alternative data types, such as int8, uint8, etc.

Complex Numbers

If the output of a function running on the GPU could potentially be complex, you must explicitly specify its input arguments as complex. This applies to gpuArray or to functions called in code run by arrayfun.

For example, if creating a GPUArray which might have negative elements, use G = gpuArray(complex(p)), then you can successfully execute sqrt(G).

Or, within a function passed to arrayfun, if x is a vector of real numbers, and some elements have negative values, sqrt(x) will generate an error; instead you should call sqrt(complex(x)).

The following table lists the functions that might return complex data, along with the input range over which the output remains real.

FunctionInput Range for Real Output
acos(x)abs(x) <= 1
acosh(x)x >= 1
acoth(x)x >= 1
acsc(x)x >= 1
asec(x)x >= 1
asech(x)0 <= x <= 1
asin(x)abs(x) <= 1
atanhabs(x) <= 1
log(x)x >= 0
log1p(x)x >= -1
log10(x)x >= 0
log2(x)x >= 0
power(x,y)x >= 0
reallog(x)x >= 0
realsqrt(x)x >= 0
sqrt(x)x >= 0

  


Free Parallel Computing Interactive Kit

See how to solve large problems with minimal effort and reduce simulation time.

Get free kit

Trials Available

Try the latest versions of parallel computing products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS