Perform the sum between two matrix.
dResult = gpuAdd(A,B)
Can be :
Pointer on the matrix stored in device memory (GPU).
Pointer on the matrix stored in host memory (CPU).
Can be :
Pointer on the matrix stored in device memory (GPU).
Pointer on the matrix stored in host memory (CPU).
dResult is the result of computation stored in device memory (GPU).
gpuAdd
perform an addition between two matrix or between a scalar and a matrix.
The result is on the device memory, use the gpuGetData function to get the result in host memory.
This function use cuBLAS to perform operations.
A = rand(200,300) + %i * rand(200,300); B = rand(200,300) + %i * rand(200,300); dB = gpuSetData(B); dA = gpuSetData(A); d1 = gpuAdd(A,B); d2 = gpuAdd(d1,dB); d3 = gpuAdd(d2,dA); result = gpuGetData(d3); norm(result - (A+B+B+A)) dA = gpuFree(dA); dB = gpuFree(dB); d1 = gpuFree(d1); d2 = gpuFree(d2); d3 = gpuFree(d3); | ![]() | ![]() |