GPU Memory going down

Hi,
I have a Mac Book Pro with NVIDIA GeForce GT 750M 2048 MB installed.
I noticed that when I am trying to assign a variable using GPUARRAY, I go out of GPU memory when I shouldn't.
So, check the online docs and I was instructed to reset the device. I did but no luck. However, I got something even more confusing. It seems that by reseting my GPU device actually the memory goes down instead of going up. Here it is:
>> format longg
>> d=gpuDevice;d.AvailableMemory/1024/1024
ans =
807.6171875
>> reset(d); d.AvailableMemory/1024/1024
ans =
659.1171875
>> reset(d); d.AvailableMemory/1024/1024
ans =
555.4921875
>> reset(d); d.AvailableMemory/1024/1024
ans =
633.1171875
>> reset(d); d.AvailableMemory/1024/1024
ans =
615.1171875
>> reset(d); d.AvailableMemory/1024/1024
ans =
633.1171875
>> reset(d); d.AvailableMemory/1024/1024
ans =
581.1171875
By the way, note that for the first line after "format longg", I just restarted my entire system, and just launched the MATLAB and then issue that commands. So nothing else was even running on my system. Yet only about 800MB of the total 2000MB gpumemory was available within MATLAB.
Any Idea what is going on?

10 个评论

Any one willing to answer this?
Matt J
Matt J 2014-10-16
编辑:Matt J 2014-10-16
You have only the one graphics card installed? It is being used for both display and GPGPU? If so, anything displayed on the desktop (sidebars, gadgets, etc...) that could be drawing on the resources of the card?
I have two graphic cards actually.
One is the Intel Iris Pro and the other is the NVIDIA.
But that aside as I said, I was not running anything on the machine. and If I just type that over and over this happens.
On the same machine, if I use CUDA I would be able to assign much larger variable onto the memory. But using MATLAB it appears that most of the memory is not accessible.
Sometime ago, I also tried the same thing on a linux Ubuntu machine, which had multiple GPUs. Same thing happens. at the same time I used nvidia utilities to check how much load is on the card and how much of the memory is free I end up having different numbers.
I tried a few times in Matlab R2014b (though without the format longg first) and only the first reset caused a slight drop in available memory, after that it was constant:
>> d=gpuDevice; d.AvailableMemory / 1024 / 1024
ans =
3607.890625
>> reset(d); d.AvailableMemory / 1024 / 1024
ans =
3607.76171875
>> reset(d); d.AvailableMemory / 1024 / 1024
ans =
3607.76171875
>> reset(d); d.AvailableMemory / 1024 / 1024
ans =
3607.76171875
>> reset(d); d.AvailableMemory / 1024 / 1024
ans =
3607.76171875
>> reset(d); d.AvailableMemory / 1024 / 1024
ans =
3607.76171875
format longg only applied to the current session so if you restarted after executing that I assume that is irrelevant to the GPU behaviour.
So, what could be causing it on my system? Driver? and how big is your GPU memory, 4GB?
Can confirm. Available memory doesn't change in my two gpu's.
Adam, could you please run reset(d); d.AvailableMemory / 1024 / 1024 at least 20 times to see if the free memory still stays the same.
Here is what happened. I force the system to go to use the integrated card, then MATLAB was not recognizing the GPU at all.
After switching the NVIDIA card back on, MATLAB was recognizing and it was reporting more memory. The first 5 6 issue of reset command didn't reduced the memory, but after that it started to gradually go down. That's why I am saying could you issue that command for like 20 times see what happens?
If you can do it this way, issue 5 6 time the command, then wait for couple of seconds, and then issue another 5 6 times.
Sorry, I was full on busy at work on Friday.
I just ran the command 20 times in a row now and again totally constant after the first very small drop.
Do you have a single graphics card, or multiple?
Just one so that could certainly be a factor I guess. Though it does also mean that card is absolutely used for everything else the system may be doing related to graphics.

请先登录,再进行评论。

回答(1 个)

Matt J
Matt J 2014-10-17

0 个投票

But that aside as I said, I was not running anything on the machine. and If I just type that over and over this happens.
The display functions of your monitor are always running, though, and at least one of your graphics cards is always servicing that. In Windows, there are settings to designate one card as the display handler. Presumably, there is a way to do likewise on a Mac. If you can verify that the card you are using for GPGPU is not tied to the display, it would be informative.

3 个评论

Matt J, even if the NVIDIA card is used for display, when there is no change in system status, other than issuing "reset(gnuDevice)" it does not make sense that the available memory goes down, instead of going up. If you check it goes down from 800MB down to 580MB. that's about 200MB reduction in memory after multiple time reseting the device, without putting any new request to the device.
Matt J
Matt J 2014-10-17
编辑:Matt J 2014-10-17
Why not? "Available Memory" surely refers to the memory on the card that the display is not using, and surely only that memory is controlled by reset(). Further, the mere act of typing "reset(d)" causes the display to change its status. I would also point out that your memory numbers aren't going down all the time. They seem to fluctuate up and down randomly.
Yes, it's still a theory, but it's worth eliminating as a consideration, if nothing else.
Matt J
Matt J 2014-10-17
编辑:Matt J 2014-10-17
that's about 200MB reduction in memory after multiple time reseting the device, without putting any new request to the device.
I don't say it makes sense that the memory fluctuations are that large, or that it's a mark of good software engineering. I'm just saying that when you lose memory, it must go somewhere, and maybe the display is taking it. It's as good an initial suspect as any if it's the only other known thing using the card.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Get Started with GPU Coder 的更多信息

产品

标签

评论:

2014-10-20

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by