Memory leak in CUDALink
- To: mathgroup at smc.vnet.net
- Subject: [mg115616] Memory leak in CUDALink
- From: Emil Hedevang <emilhedevang at gmail.com>
- Date: Sun, 16 Jan 2011 05:54:56 -0500 (EST)
- Reply-to: comp.soft-sys.math.mathematica at googlegroups.com
Hello,
I am playing around with CUDALink on my MacBook Pro and my Mac Pro. I am experiencing memory leaks in many of the built-in functions like CUDAFourier and CUDADot, see the code below.
First some information on the computer and the GPU.
$Version
Needs["CUDALink`"]
CUDAQ[]
CUDAInformation[1, "Name"]
$CUDADevice = 1;
Out[1]= "8.0 for Mac OS X x86 (64-bit) (November 13, 2010)"
Out[3]= True
Out[4]= "GeForce 9600M GT"
Then we make a large matrix, approximately 32MB in memory footprint.
n = 11;
a = RandomReal[{0, 1}, {2^n, 2^n}];
ByteCount[a]
Out[8]= 33554600
Finally we alternate between querying how large a percentage of the computer's memory the MathKernel is using and calculating the product of the matrix with itself. As you can see, the percentage increases steadily and if I continue in that fashion the computer will eventually begin to swap and become really slow.
RunThrough["ps -p " <> ToString[$ProcessID] <> " -o pmem", ""]
c = CUDADot[a, a];
RunThrough["ps -p " <> ToString[$ProcessID] <> " -o pmem", ""]
c = CUDADot[a, a];
RunThrough["ps -p " <> ToString[$ProcessID] <> " -o pmem", ""]
c = CUDADot[a, a];
RunThrough["ps -p " <> ToString[$ProcessID] <> " -o pmem", ""]
Out[9]= 1.7
Out[11]= 5.9
Out[13]= 8.8
Out[15]= 11.4
I should add that the same problem occurs on my Mac Pro with an Nvidia GTX 285 as GPU.
Do any of you expecient similar problems?
Best regards,
Emil Hedevang