<< gpuFFT sciGPGPU gpuGetData >>

sciGPGPU >> sciGPGPU > gpuFree

gpuFree

Obsolete function, use Scilab function clear instead.

Free memory space allocated by a matrix in GPU memory.

Call sequence

clear gA

Parameters

gA

Pointer to a matrix

Description

clear gA

The user is responsible for memory management ; the purpose of gpuFree is to allow to free ressources when a matrix is not needed anymore in GPU memory.

The functions that consume GPU memory are gpuAlloc and gpuSetData.

Exemples

//--matrixAdd.cu--
extern "C"
__global__ void
matrixAdd( double* C, double* A, double* B, int M, int N)
{
int idx = blockIdx.x;
int idy = blockIdx.y;

int dx = blockDim.x;
int dy = blockDim.y;

int tx = threadIdx.x;
int ty = threadIdx.y;

int x=tx+dx*idx;
int y=ty+dy*idy;

if(x<M && y<N)
C[ x + y*M ]= A[ x + y*M ] + B[ x+ y*M ];
}

//--Scilab script--
A=ones(16,16);gA=gpuSetData(A)
B=2*ones(16,16);gB=gpuSetData(B)
C=0*ones(16,16);gC=gpuSetData(C)

bin=gpuBuild(gpuPATH+"/tests/unit_tests/"+"matrixAdd");
fonc=gpuLoadFunction(bin,"matrixAdd",16,16,1,1)
fonc(gC,gB,gA,int32(16),int32(16))
C=gpuGetData(gC);
clear gA;
clear gB;
clear gC;
gpuExit();

See Also


Report an issue
<< gpuFFT sciGPGPU gpuGetData >>