Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28597 Discussions

Pc slower after heavy memory usage/automatic use of scratch files

madsplinter
Beginner
519 Views

Hi there

I'm writing a code that does some heavy structural computations; usually ituses a double precision complexarraymade of 2048x512x25 elements. The array is declared allocatable, the program allocate it justbefore using it, and deallocate it before exiting.

1) If I try to allocate a larger array, say 2048x1024x25, I get an out of memory error. Is there a way to make Fortran working with larger arrays automatically using hard disk free space as a temporary memory? Or I have to rewrite the codeand manually include some instructions for writingscratch files?

2) I've noticed that after the program successfully exit my pc becamesextremely slow, and I've to reboot to make it run again at normal speed. Is it because the program doesn't free all the occupied memory at exit? Or what else? Is there a way to avoid to reboot every time? Notice that this happens not only on my pc, I get same behaviour on other 2 machines.

thank you in advance for the suggestion

0 Kudos
4 Replies
grg99
Beginner
519 Views
How much actual RAM do you have on this computer?

Your array is about 400+ Megabytes in size. If you don't have that much free RAM, the OS is going to automatically use virtual memory, which is a tantalising mix of very fast RAM and very slow disk. While RAM speeds have gone up to the nanosecond speed range, disks are still limited to like 20 milliseconds worst case. That's a difference of like a million or more, so yes, things can get ridiculously slow when virtual memory kicks in..

The OS frees all your program memory when the program exits, unless you've done some very advanced API calls to allocate global shareable memory, which you probablya re not.

The reason the OS seems so slow is your 400MB array pushed out a lot of system code and cached disk blocks. When I do this my computer also slows to a crawl, and it makes many minutes for the RAM to get refilled by stuff I really need, like the desktop, explorer, browser, and all open files. You shouldnt need to reboot.

I'd go out and buy a couple 1GB memory sticks, about $89 each. Like they say about cubic inches in car engines, there's no substitute for actual RAM.




0 Kudos
madsplinter
Beginner
519 Views

Thank you for the answer... and for the quickness!!!

Then I'm going to boost up the displacement of my car, ehm, the RAM of my pc... smiley [:-)]

Just one more question:

If the OS automatically puts on disk everything exceeding the free RAM space, why I get an out of memory error if I make the arrays too large?Shouldn't it works in thesame way if Iallocate a 2 Gb array or more?

0 Kudos
TimP
Honored Contributor III
519 Views
On a 32-bit OS, you will run out of allocatable virtual address space somewhere around 2GB, so you must expect an "out of memory" indication.
0 Kudos
Steven_L_Intel1
Employee
518 Views
If your pagefile is small, you'll run out of virtual memory quicker. On 32-bit Windows, the practical limit is around 1.75GB.
0 Kudos
Reply