GPUArray
✖
GPUArray
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)Summary of the most common use cases
Create a GPUArray object from a vector:

https://wolfram.com/xid/0bh1s8b50ft0fi-l5j4o6


https://wolfram.com/xid/0bh1s8b50ft0fi-tvztwb

Converts to an ordinary list of values:

https://wolfram.com/xid/0bh1s8b50ft0fi-7namgu

Scope (27)Survey of the scope of standard use cases
Basic Uses (4)
Create a GPUArray object from a vector:

https://wolfram.com/xid/0bh1s8b50ft0fi-p750xp


https://wolfram.com/xid/0bh1s8b50ft0fi-gdslw7

Use NumericArray to create a GPUArray object of a specified type:

https://wolfram.com/xid/0bh1s8b50ft0fi-wwfq5o


https://wolfram.com/xid/0bh1s8b50ft0fi-2isqpt

Convert a GPUArray object to an ordinary list of values:

https://wolfram.com/xid/0bh1s8b50ft0fi-rl036m


https://wolfram.com/xid/0bh1s8b50ft0fi-bn80ro

Convert to a NumericArray object:

https://wolfram.com/xid/0bh1s8b50ft0fi-e5hv08

Convert to a SparseArray:

https://wolfram.com/xid/0bh1s8b50ft0fi-t17og5

Get information of a GPUArray object:

https://wolfram.com/xid/0bh1s8b50ft0fi-z89d97


https://wolfram.com/xid/0bh1s8b50ft0fi-026nzt


https://wolfram.com/xid/0bh1s8b50ft0fi-c9c8oy

Arrays Operations (3)
Test whether a GPUArray object is a vector:

https://wolfram.com/xid/0bh1s8b50ft0fi-6cl86j


https://wolfram.com/xid/0bh1s8b50ft0fi-b0p9yq


https://wolfram.com/xid/0bh1s8b50ft0fi-wcfeqj


https://wolfram.com/xid/0bh1s8b50ft0fi-9hk3pn

Extract parts of a GPUArray object:

https://wolfram.com/xid/0bh1s8b50ft0fi-o8tqxh


https://wolfram.com/xid/0bh1s8b50ft0fi-il6kqi


https://wolfram.com/xid/0bh1s8b50ft0fi-ejfu1x

Get properties of a GPUArray object:

https://wolfram.com/xid/0bh1s8b50ft0fi-5u7t61


https://wolfram.com/xid/0bh1s8b50ft0fi-o6e3ph


https://wolfram.com/xid/0bh1s8b50ft0fi-4mehnu


https://wolfram.com/xid/0bh1s8b50ft0fi-cdxj4e

Mathematical Operations (6)
Apply arithmetic operations on GPUArray objects:

https://wolfram.com/xid/0bh1s8b50ft0fi-k3e2w6

https://wolfram.com/xid/0bh1s8b50ft0fi-hxj29h


https://wolfram.com/xid/0bh1s8b50ft0fi-tb2mnt


https://wolfram.com/xid/0bh1s8b50ft0fi-n8d9cf

Evaluate numerically trigonometric functions:

https://wolfram.com/xid/0bh1s8b50ft0fi-57vl0j

https://wolfram.com/xid/0bh1s8b50ft0fi-mh4j3v


https://wolfram.com/xid/0bh1s8b50ft0fi-32e7fa


https://wolfram.com/xid/0bh1s8b50ft0fi-qtqlkt

Compute transcendental functions:

https://wolfram.com/xid/0bh1s8b50ft0fi-6uf2mt

https://wolfram.com/xid/0bh1s8b50ft0fi-z2ecn7


https://wolfram.com/xid/0bh1s8b50ft0fi-h577v2


https://wolfram.com/xid/0bh1s8b50ft0fi-gkhdti

Evaluate efficiently hyperbolic functions:

https://wolfram.com/xid/0bh1s8b50ft0fi-h7ifzq

https://wolfram.com/xid/0bh1s8b50ft0fi-tc6jpw


https://wolfram.com/xid/0bh1s8b50ft0fi-dftjmy


https://wolfram.com/xid/0bh1s8b50ft0fi-5hvsor

Evaluate numerically integer functions:

https://wolfram.com/xid/0bh1s8b50ft0fi-r1ws44

https://wolfram.com/xid/0bh1s8b50ft0fi-iby14n


https://wolfram.com/xid/0bh1s8b50ft0fi-u0q8jp


https://wolfram.com/xid/0bh1s8b50ft0fi-sqxofj

Compute absolute values and signs functions:

https://wolfram.com/xid/0bh1s8b50ft0fi-b4mc85

https://wolfram.com/xid/0bh1s8b50ft0fi-vs3jfb


https://wolfram.com/xid/0bh1s8b50ft0fi-4bkbw7


https://wolfram.com/xid/0bh1s8b50ft0fi-vi8z1j

Fourier Analysis (2)
Find a discrete Fourier transform:

https://wolfram.com/xid/0bh1s8b50ft0fi-y5k9fh


https://wolfram.com/xid/0bh1s8b50ft0fi-hgadzl

Inverse Fourier transform of a complex list:

https://wolfram.com/xid/0bh1s8b50ft0fi-uqjook


https://wolfram.com/xid/0bh1s8b50ft0fi-3ixiw

Statistics (3)
Evaluate statistics functions on a GPUArray object:

https://wolfram.com/xid/0bh1s8b50ft0fi-hneams

https://wolfram.com/xid/0bh1s8b50ft0fi-1kms00


https://wolfram.com/xid/0bh1s8b50ft0fi-wxs7n9


https://wolfram.com/xid/0bh1s8b50ft0fi-fx5ceu


https://wolfram.com/xid/0bh1s8b50ft0fi-7y0uch


https://wolfram.com/xid/0bh1s8b50ft0fi-dm1qv6

Minimum of a GPUArray object:

https://wolfram.com/xid/0bh1s8b50ft0fi-koitlu

https://wolfram.com/xid/0bh1s8b50ft0fi-s7tw94


https://wolfram.com/xid/0bh1s8b50ft0fi-i2eai


https://wolfram.com/xid/0bh1s8b50ft0fi-b4bo1o

Sort a GPUArray object:

https://wolfram.com/xid/0bh1s8b50ft0fi-r824ij

https://wolfram.com/xid/0bh1s8b50ft0fi-82d68y

Linear Algebra (4)
Apply matrix operations on GPUArray objects:

https://wolfram.com/xid/0bh1s8b50ft0fi-c9db14

https://wolfram.com/xid/0bh1s8b50ft0fi-xp4i1j


https://wolfram.com/xid/0bh1s8b50ft0fi-wso8f


https://wolfram.com/xid/0bh1s8b50ft0fi-nocedq

Solve a matrix-vector equation:

https://wolfram.com/xid/0bh1s8b50ft0fi-34r86w

https://wolfram.com/xid/0bh1s8b50ft0fi-6d9hq7

https://wolfram.com/xid/0bh1s8b50ft0fi-o45667


https://wolfram.com/xid/0bh1s8b50ft0fi-e1lfch

https://wolfram.com/xid/0bh1s8b50ft0fi-6p4cba

https://wolfram.com/xid/0bh1s8b50ft0fi-s9d5id

Solve a matrix-vector least-squares problem:

https://wolfram.com/xid/0bh1s8b50ft0fi-pokusj

Solve a matrix-matrix least-squares problem:

https://wolfram.com/xid/0bh1s8b50ft0fi-w94h00

Compute the singular value decomposition of a complex-valued matrix:

https://wolfram.com/xid/0bh1s8b50ft0fi-147kew

https://wolfram.com/xid/0bh1s8b50ft0fi-o2cjs9

Up to expected precision loss, :

https://wolfram.com/xid/0bh1s8b50ft0fi-jaucil

Random Number Generation (2)
Switch to the GPU random number generator:

https://wolfram.com/xid/0bh1s8b50ft0fi-1q7ttr

Random numbers are now generated using it:

https://wolfram.com/xid/0bh1s8b50ft0fi-15arzs


https://wolfram.com/xid/0bh1s8b50ft0fi-hze96w


https://wolfram.com/xid/0bh1s8b50ft0fi-nt3ciz

A specific seed will affect the current GPU random number generator:

https://wolfram.com/xid/0bh1s8b50ft0fi-oc6p1d

Visualization (3)
Plot a list of values from a continuous probability distribution:

https://wolfram.com/xid/0bh1s8b50ft0fi-dm2lt0


https://wolfram.com/xid/0bh1s8b50ft0fi-golww6


https://wolfram.com/xid/0bh1s8b50ft0fi-ti6xga

Plot a matrix as an array of colors:

https://wolfram.com/xid/0bh1s8b50ft0fi-mdrf6

Properties & Relations (4)Properties of the function, and connections to other functions
Use GPUArrayQ to test whether an object is a valid GPUArray object:

https://wolfram.com/xid/0bh1s8b50ft0fi-e8l2yi


https://wolfram.com/xid/0bh1s8b50ft0fi-jv8l6b

Find the number of bytes used to store a GPUArray object:

https://wolfram.com/xid/0bh1s8b50ft0fi-db690e


https://wolfram.com/xid/0bh1s8b50ft0fi-bazdgh

Use Normal to retrieve data from GPU:

https://wolfram.com/xid/0bh1s8b50ft0fi-dgmwn


https://wolfram.com/xid/0bh1s8b50ft0fi-wvl9rh

GPUArray preserves representation types of elements in NumericArray objects:

https://wolfram.com/xid/0bh1s8b50ft0fi-g3r1on


https://wolfram.com/xid/0bh1s8b50ft0fi-09ktkx


https://wolfram.com/xid/0bh1s8b50ft0fi-mp7xlc

Possible Issues (2)Common pitfalls and unexpected behavior
GPUArray autoevaluates if no supported GPUs were detected:

https://wolfram.com/xid/0bh1s8b50ft0fi-5hmljm


Operations without GPU-accelerated support fall back to CPU implementations:

https://wolfram.com/xid/0bh1s8b50ft0fi-4qdni4

https://wolfram.com/xid/0bh1s8b50ft0fi-q2717w

Wolfram Research (2025), GPUArray, Wolfram Language function, https://reference.wolfram.com/language/ref/GPUArray.html.
Text
Wolfram Research (2025), GPUArray, Wolfram Language function, https://reference.wolfram.com/language/ref/GPUArray.html.
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.
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
Wolfram Language. (2025). GPUArray. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GPUArray.html
BibTeX
@misc{reference.wolfram_2025_gpuarray, author="Wolfram Research", title="{GPUArray}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/GPUArray.html}", note=[Accessed: 07-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_gpuarray, organization={Wolfram Research}, title={GPUArray}, year={2025}, url={https://reference.wolfram.com/language/ref/GPUArray.html}, note=[Accessed: 07-May-2025
]}