<< gpgpu_getToolboxPath sciGPGPU gpuAlloc >>

sciGPGPU >> sciGPGPU > gpuAdd

gpuAdd

Perform the sum between two matrix.

Call sequence

[CPU GPU dA dB]=gpuAdd(A,B,[option1 option2])

Parameters

A

Can be :

Pointer on the matrix stored in GPU memory.

Pointer on the matrix stored in CPU memory.

B

Can be :

Pointer on the matrix stored in GPU memory.

Pointer on the matrix stored in CPU memory.

[option1 option2]

option1 :

0 : the computation result is store in CPU memory.

1 : the computation result is store in GPU memory.

2 : the computation result is store in GPU and GPU memory.

option2 :

0 : If input data are stored in CPU memory, the data load in GPU memory will be erased.

1 : Only the first argument will be preserved.

2 : Only the second argument will be preserved.

12 : Both will be preserved.

[CPU GPU dA dB]

CPU is the result of computation in CPU memory.

GPU is the result of computation in GPU memory.

dA is data of A locate in GPU memory.

dB is data of B locate in GPU memory.

Description

[CPU GPU dA dB]=gpuAdd(A,B,[option1 option2])

gpuAdd perform an addition between two matrix or between a number and a matrix. Call this function with option [0 0] is equal to call it without option. The number of output parameters depends of options. This function use cuBLAS to perform operations.

Exemples

A=rand(200,300)+%i*rand(200,300);
B=rand(200,300)+%i*rand(200,300);

[GPU dA dB]=gpuAdd(A,B,[1 12]);

GPU1=gpuAdd(GPU,dB,[1 0]);
GPU=gpuFree(GPU);
GPU2=gpuAdd(GPU1,dA,[1 0]);

CPU=gpuAdd(GPU2,GPU1);

GPU1=gpuFree(GPU1);
GPU2=gpuFree(GPU2);

clear GPU1;
clear GPU2;
clear CPU;
clear dA;
clear dB;
clear A;
clear B;

See Also

<< gpgpu_getToolboxPath sciGPGPU gpuAlloc >>