GPUArray
GPUArray[array]
yields an array stored in memory accessible for GPU-accelerated computation.
Details
- GPUArray provides an efficient representation for storing and manipulating data accessible from a graphics processor unit (GPU).
- GPUArray is typically used to enhance speed of execution of functions by running computations on the GPU.
- GPUArray[array] creates an array in GPU memory or unified memory.
- The array can have the following forms:
-
{e1,…},{{e1,…},…},… full array of numeric elements NumericArray[…] numeric array of a specified type - Normal[GPUArray[array]] converts the GPUArray object to an ordinary list of values.
- Additional conversions include:
-
SparseArray[GPUArray[…]] sparse array with few nonzero elements NumericArray[GPUArray[…],type] numeric array of a specified type - Information for a GPUArray includes the following properties:
-
"ElementType" element native type "Dimensions" list of the dimensions - Functions such as LinearSolve, Plus and Part work on GPUArray by running the computation on the GPU.
- GPUArray is treated as a raw object by functions like AtomQ and for purposes of pattern matching.
Examples
open allclose allBasic Examples (1)
Scope (27)
Basic Uses (4)
Create a GPUArray object from a vector:
Use NumericArray to create a GPUArray object of a specified type:
Convert a GPUArray object to an ordinary list of values:
Convert to a NumericArray object:
Convert to a SparseArray:
Get information of a GPUArray object:
Arrays Operations (3)
Mathematical Operations (6)
Apply arithmetic operations on GPUArray objects:
Evaluate numerically trigonometric functions:
Compute transcendental functions:
Evaluate efficiently hyperbolic functions:
Evaluate numerically integer functions:
Fourier Analysis (2)
Statistics (3)
Linear Algebra (4)
Apply matrix operations on GPUArray objects:
Solve a matrix-vector equation:
Solve a matrix-vector least-squares problem:
Solve a matrix-matrix least-squares problem:
Compute the singular value decomposition of a complex-valued matrix:
Random Number Generation (2)
Properties & Relations (4)
Possible Issues (2)
GPUArray autoevaluates if no supported GPUs were detected:
Operations without GPU-accelerated support fall back to CPU implementations:
Text
Wolfram Research (2025), GPUArray, Wolfram Language function, https://reference.wolfram.com/language/ref/GPUArray.html.
CMS
Wolfram Language. 2025. "GPUArray." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/GPUArray.html.
APA
Wolfram Language. (2025). GPUArray. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GPUArray.html