<< gpgpu_getToolboxPath sciGPGPU gpuAlloc >>

sciGPGPU >> sciGPGPU > gpuAdd

gpuAdd

Perform the sum between two matrix.

Call sequence

dResult = gpuAdd(A,B)

Parameters

A

Can be :

Pointer on the matrix stored in device memory (GPU).

Pointer on the matrix stored in host memory (CPU).

B

Can be :

Pointer on the matrix stored in device memory (GPU).

Pointer on the matrix stored in host memory (CPU).

dResult

dResult is the result of computation stored in device memory (GPU).

Description

dResult = gpuAdd(A,B)

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.

Exemples

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);

See Also

<< gpgpu_getToolboxPath sciGPGPU gpuAlloc >>