Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Comsol reports high virtual memory usage even when RAM is available

Please login with a confirmed email address before reporting spam

Dear All:

I have plenty of RAM on this machine (16GB) and I am running 64-bit Linux. Oddly, however, Comsol is indicating that it is using almost three times virtual memory as physical memory (screenshot attached). Shouldn't Comsol be using RAM first, rather than so much of virtual memory/swapping?

Could anyone explain to me what might be going on here? I am wondering if there isn't a way to force Comsol to use more of the RAM instead of virtual memory and hopefully get some speedup.

Thanks much,
Pranay


8 Replies Last Post Dec 31, 2014, 8:59 p.m. EST

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 7, 2010, 10:19 a.m. EDT
Same situation as you.
I noticed the same things but then I checked the swap use [ top in terminal or some "activity monitor" utility] and noticed COMSOL VM was NOT included in my swap memory that remained empty { I have a lot of Ram too. rarely need to use my swap files.]
Not sure what the Virtual memory means in COMSOL tough.
Same situation as you. I noticed the same things but then I checked the swap use [ top in terminal or some "activity monitor" utility] and noticed COMSOL VM was NOT included in my swap memory that remained empty { I have a lot of Ram too. rarely need to use my swap files.] Not sure what the Virtual memory means in COMSOL tough.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 8, 2010, 4:46 a.m. EDT

I notice the following in top:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
26546 pranay 15 0 3120m 1.1g 53m R 50.8 4.6 19:05.53 comsollauncher

There seems to be a VIRT in there. Although vmstat 5 consistently reports swpd=si=so=0 during the computation:

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 0 14718308 66640 7246784 0 0 0 3 1 0 1 2 97 0 0
4 1 0 14716584 66640 7246796 0 0 0 8 1023 5626 15 1 85 0 0

I also found that cat /proc/pid/status reports the value indicated in Comsol's Virtual Memory pretty accurately in the field VmSize, which seems to be the total virtual memory allocated to the process (comsollauncher). Also: the VmPeak value was about the same value as VmSize, so from that it seems Comsol might actually be using that amount of virtual mem.

- Pranay
I notice the following in top: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 26546 pranay 15 0 3120m 1.1g 53m R 50.8 4.6 19:05.53 comsollauncher There seems to be a VIRT in there. Although vmstat 5 consistently reports swpd=si=so=0 during the computation: procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 0 14718308 66640 7246784 0 0 0 3 1 0 1 2 97 0 0 4 1 0 14716584 66640 7246796 0 0 0 8 1023 5626 15 1 85 0 0 I also found that cat /proc/pid/status reports the value indicated in Comsol's Virtual Memory pretty accurately in the field VmSize, which seems to be the total virtual memory allocated to the process (comsollauncher). Also: the VmPeak value was about the same value as VmSize, so from that it seems Comsol might actually be using that amount of virtual mem. - Pranay

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 8, 2010, 11:01 a.m. EDT
Hey I am not a system guru but I think you are looking at the wrong place.

Just look the line above the process list.. [ I copy one output from my workstation below]
As you see the swap file is not used even if comsol says it use almost 5 gig of VM at the time I ran top. I was running a comsol calculation

I will trust the OS in that case. I am not a sofware expert and cannot really explain what these 5G of VM advertised by COMSOL are but it is a fact that they are not registered with the system. [ not even with the ram as my exemple below shows]
at least in my case....

it could be in the cached VM tough ... but this is beyond my expertise to figurethat out.

at least in my case....
JF



Mem: 12389368k total, 4420064k used, 7969304k free, 356872k buffers
Swap: 32767996k total, 0k used, 32767996k free, 2728580k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
4182 JFL 20 0 4994m 570m 44m S 226.1 4.7 3:41.44 comsollauncher
Hey I am not a system guru but I think you are looking at the wrong place. Just look the line above the process list.. [ I copy one output from my workstation below] As you see the swap file is not used even if comsol says it use almost 5 gig of VM at the time I ran top. I was running a comsol calculation I will trust the OS in that case. I am not a sofware expert and cannot really explain what these 5G of VM advertised by COMSOL are but it is a fact that they are not registered with the system. [ not even with the ram as my exemple below shows] at least in my case.... it could be in the cached VM tough ... but this is beyond my expertise to figurethat out. at least in my case.... JF Mem: 12389368k total, 4420064k used, 7969304k free, 356872k buffers Swap: 32767996k total, 0k used, 32767996k free, 2728580k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4182 JFL 20 0 4994m 570m 44m S 226.1 4.7 3:41.44 comsollauncher

Jim Freels mechanical side of nuclear engineering, multiphysics analysis, COMSOL specialist

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 9, 2010, 9:17 p.m. EDT
This is a flat-out guess on my part, because you have not stated much about your problem, solver, etc. But from your screenshot, it appears you are running a transient with lots of time steps. Could it be that the saved data at each time step is going to virtual memory instead of real memory since your do not need the saved data to obtain the solution at the next time step. Also, what is your actual swap memory used during the solution (use top in Linux to get at this). You may not actually be swapping at all and the virtual memory you are seeing is within COMSOL and not being slowed down during the solution.
This is a flat-out guess on my part, because you have not stated much about your problem, solver, etc. But from your screenshot, it appears you are running a transient with lots of time steps. Could it be that the saved data at each time step is going to virtual memory instead of real memory since your do not need the saved data to obtain the solution at the next time step. Also, what is your actual swap memory used during the solution (use top in Linux to get at this). You may not actually be swapping at all and the virtual memory you are seeing is within COMSOL and not being slowed down during the solution.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 10, 2010, 8:14 a.m. EDT

It's true that I do have to run a transient problem with a lot of time steps. But the issue of large Virtual Memory seems to be independent of the problem I need to solve: even if I simply start up Comsol - no model, no solver, nothing at all - the Physical memory reported is 288 MB and the VM reported is 2783MB. 10 times as much! (On my Windows laptop, which has a total of 4GB, both values are lower, just over half a GB in fact.) The command I'm using here is just:

[pranay@pgoel glnxa64]$ ./comsol -64 &

In fact, top seems to report a large swap space usage at startup as well:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP COMMAND
11785 pranay 15 0 2746m 283m 28m S 1.7 1.2 0:14.23 2.4g comsollauncher

And I'm pretty sure that this VM is actually being _used_: it isn't just "reserved" but not utilized. For one, /proc shows this in VmPeak even without a model loaded. Further, when I do load my model in and try to run it, it throws a Java heap error unless I increase the heap with -Xmx -Xms:

./comsol -64 -np 2 -mpmode turnaround -Xmx8192m -Xms8192m &

(The -np 2 is gratuitous; I don't think two processors are being used, but these difficulties are independent of that anyway.)


I do eventually need to run a transient with a lot of steps, which of course is expect to take long. Now, I can't do much with the processor speed as I'm close to 3 GHz anyway, but I was hoping that I could thrown in a lot of RAM and hammer it out with a Direct solver. I didn't think the VM would trip me anyway. Hence the need to sort this business out.

Thanks for all your help,
Pranay
It's true that I do have to run a transient problem with a lot of time steps. But the issue of large Virtual Memory seems to be independent of the problem I need to solve: even if I simply start up Comsol - no model, no solver, nothing at all - the Physical memory reported is 288 MB and the VM reported is 2783MB. 10 times as much! (On my Windows laptop, which has a total of 4GB, both values are lower, just over half a GB in fact.) The command I'm using here is just: [pranay@pgoel glnxa64]$ ./comsol -64 & In fact, top seems to report a large swap space usage at startup as well: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP COMMAND 11785 pranay 15 0 2746m 283m 28m S 1.7 1.2 0:14.23 2.4g comsollauncher And I'm pretty sure that this VM is actually being _used_: it isn't just "reserved" but not utilized. For one, /proc shows this in VmPeak even without a model loaded. Further, when I do load my model in and try to run it, it throws a Java heap error unless I increase the heap with -Xmx -Xms: ./comsol -64 -np 2 -mpmode turnaround -Xmx8192m -Xms8192m & (The -np 2 is gratuitous; I don't think two processors are being used, but these difficulties are independent of that anyway.) I do eventually need to run a transient with a lot of steps, which of course is expect to take long. Now, I can't do much with the processor speed as I'm close to 3 GHz anyway, but I was hoping that I could thrown in a lot of RAM and hammer it out with a Direct solver. I didn't think the VM would trip me anyway. Hence the need to sort this business out. Thanks for all your help, Pranay

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 10, 2012, 5:33 p.m. EST
Pranay,

Did you ever find out why COMSOL is using more virtual memory than physical?

Sirisha
Pranay, Did you ever find out why COMSOL is using more virtual memory than physical? Sirisha

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Dec 28, 2014, 11:02 a.m. EST
Dear Pranay

Are you using SATA II Hard Disk?

As per my knowledge, Virtual memory is the highest transfer rate from the hard disk. SATA II hard disks have 3 GBps.

I may me wrong also. But I am using a SATA III Hard disk in my workstation and the Virtual memory is 6 GB most of the times (6 - 6.2 GB).

Please correct me if I am wrong.

Thanks.
Dear Pranay Are you using SATA II Hard Disk? As per my knowledge, Virtual memory is the highest transfer rate from the hard disk. SATA II hard disks have 3 GBps. I may me wrong also. But I am using a SATA III Hard disk in my workstation and the Virtual memory is 6 GB most of the times (6 - 6.2 GB). Please correct me if I am wrong. Thanks.

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Dec 31, 2014, 8:59 p.m. EST
Here's my wild guess.

*nix style OS's have something called mmap() where files can be opened as if they are memory. If you open a file like this, it instantly becomes part of the "swap" with everything in it swapped to disk. This takes essentially zero resources till you start actually writing something to this file. From the get-go the program can access the file as if it's already in memory and the VM system swaps it in to physical RAM only as needed. This can be a very efficient way to do certain kinds of things and has little downside. I mean, alternatively you could open a file with read(), read it ALL into memory, and then let the VM system gradually swap it out to swap space as required. But that's a waste since you have essentially two copies of the file on disk.

So my guess is that COMSOL opens a bunch of files on the disk using the javaized equivalent of mmap() or something similar and actually only uses a small part of these files. It doesn't "cost" anything, but it does inflate the Virtual Memory number.

But again, this is just a guess.
Here's my wild guess. *nix style OS's have something called mmap() where files can be opened as if they are memory. If you open a file like this, it instantly becomes part of the "swap" with everything in it swapped to disk. This takes essentially zero resources till you start actually writing something to this file. From the get-go the program can access the file as if it's already in memory and the VM system swaps it in to physical RAM only as needed. This can be a very efficient way to do certain kinds of things and has little downside. I mean, alternatively you could open a file with read(), read it ALL into memory, and then let the VM system gradually swap it out to swap space as required. But that's a waste since you have essentially two copies of the file on disk. So my guess is that COMSOL opens a bunch of files on the disk using the javaized equivalent of mmap() or something similar and actually only uses a small part of these files. It doesn't "cost" anything, but it does inflate the Virtual Memory number. But again, this is just a guess.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.