CUDAMatrix[data]
yields a matrix of data which resides on a CUDA enabled GPU.
CUDAMatrix[data,type]
yields a matrix of the specified type.
CUDAMatrix
CUDAMatrix[data]
yields a matrix of data which resides on a CUDA enabled GPU.
CUDAMatrix[data,type]
yields a matrix of the specified type.
Details and Options
- The CUDALink application must be loaded using Needs["CUDALink`"].
- The resources used by a CUDAMatrix are automatically reclaimed from the GPU when they are no longer used.
- The data in a CUDAMatrix can be retrieved by Normal.
- A number of functions accept and return CUDAMatrix objects allowing operations to work with data that stays on the GPU.
- Possible types for CUDAVector are:
-
"Integer32" "Real32" "ComplexReal32" "Integer64" "Real64" "ComplexReal64"
Examples
open all close allBasic Examples (1)
First, load the CUDALink application:
Needs["CUDALink`"]Create a matrix of data that lives on the GPU:
mat = CUDAMatrix[ {{1., 2., 3.}, {4., 5., 6.}, {7., 8., 9.}}]Compute a dot product on the GPU (the result also resides on the GPU):
CUDADot[mat, mat]Retrieve the data from a CUDAMatrix:
Normal[mat]Scope (1)
Possible Issues (1)
Normal of a CUDAMatrix is a NumericArray:
cumat = CUDAMatrix[{{1., 2., 3.}}];
Normal[cumat]To get the underlying data, Normal is applied twice:
Normal[Normal[cumat]]Tech Notes
Related Guides
-
▪
- CUDALink
Text
Wolfram Research (2022), CUDAMatrix, Wolfram Language function, https://reference.wolfram.com/language/CUDALink/ref/CUDAMatrix.html.
CMS
Wolfram Language. 2022. "CUDAMatrix." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/CUDALink/ref/CUDAMatrix.html.
APA
Wolfram Language. (2022). CUDAMatrix. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/CUDALink/ref/CUDAMatrix.html
BibTeX
@misc{reference.wolfram_2026_cudamatrix, author="Wolfram Research", title="{CUDAMatrix}", year="2022", howpublished="\url{https://reference.wolfram.com/language/CUDALink/ref/CUDAMatrix.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_cudamatrix, organization={Wolfram Research}, title={CUDAMatrix}, year={2022}, url={https://reference.wolfram.com/language/CUDALink/ref/CUDAMatrix.html}, note=[Accessed: 13-June-2026]}