hallo guys
I wonder why this code producing
out of memory error
while i’m just simply looping the standard JCudaDriverSample
does the “cuMemFree” function is not working ?
btw, here’s the JCudaDriverSample that I modified to run 30 times loop :
public static void main(String args[]) throws IOException
{ JCudaDriverSample ds = new JCudaDriverSample();
for (int n=0; n<30; n++) {
System.out.println("running number : "+n);
ds.runJCudaDriverSample();
}
}
public void runJCudaDriverSample() throws IOException
{
// Enable exceptions and omit all subsequent error checks
JCudaDriver.setExceptionsEnabled(true);
double start = System.currentTimeMillis();
// Create the PTX file by calling the NVCC
String ptxFileName = preparePtxFile("JCudaSampleKernel.cu");
// Initialize the driver and create a context for the first device.
cuInit(0);
CUcontext pctx = new CUcontext();
CUdevice dev = new CUdevice();
cuDeviceGet(dev, 0);
System.out.println("time taken 1: "+ (System.currentTimeMillis() - start) / 1000);
cuCtxCreate(pctx, 0, dev);
........................
........................
for(int i = 0; i < numThreads; i++)
{
cuMemFree(hostDevicePointers**);
}
cuMemFree(deviceInput);
cuMemFree(deviceOutput);
}