|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
colt1954
Joined: 21 Dec 2010 Posts: 81
|
Posted: Sun Aug 02, 2020 10:04 am Post subject: How much Ram required |
|
|
Hi,
A simple question for the excellent people on this forum, how can you determine how much 'ram' is required on a PC to execute a given programme, i guess its to some extent based on array sizes etc...?? |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1885
|
Posted: Sun Aug 02, 2020 12:21 pm Post subject: |
|
|
These days, it is more common to use dynamically allocated arrays -- typically, arrays whose sizes are computed from earlier portions of input data. There is no simple, reliable way of keeping a tally of how much RAM is consumed; in fact, on Usenet comp.lang.fortran there was a very long thread on ideas related to this issue.
You can obtain the sizes of the "text" and "data" segments using Dumpbin or the Linux/Cygwin command size:
Code: | Q:\lang\mkl>size talmi.exe
text data bss dec hex filename
19138759 106096 0 19244855 125a737 talmi.exe |
You can open the Task Manager when the program is still running and look at the memory consumption. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Sun Aug 02, 2020 4:59 pm Post subject: |
|
|
I'd accept that it is more common to use dynamically allocated arrays today in new code, or even if you are messing around with (or 'updating') old code. Mecej4 can probably tell you what goes wrong halfway through that! I had my fingers burnt with allocatable arrays in 1973 (in Algol 60) when the program worked OK when tested, but not with realistic data sets. Once bitten, twice shy. It wasn't Fortran, but after that I always used extremely trimmed-down array sizes and didn't proliferate arrays.
The old Microsoft Fortran had a utility that extracted exactly the sort of information that you are looking for from an EXE file header, but presumably this information is stored somewhere even today, and could be extracted if you need to and can find someone with the skills to extract the data from your EXE
I don't reckon that the RAM consumption is ever much of a problem with an up to date PC, unless you want to manage huge datasets (like John Campbell). For example, everything I ever wrote works fine on a Windows XP laptop with 1Gb, or a Windows 10 32-bit tablet, also with 1 Gb.
I suggest looking in Task Manager at how much free RAM you have before you attempt a trial load of your program as well as when it is running - as Mecej4 suggests. I think that (unless you are like JC) you will be surprised at how little space it uses. Another trick is to work out the sizes of all your REAL*8 arrays. Only include INTEGER, REAL*4 or COMPLEX if you use a lot of them. Again, I guess the answer will be nowhere near your free capacity. The rest, including executable code is again a lot smaller than you think.
For example, take a 5000x5000 array with REAL*8. That's still only 200Mb - and how many of those do you have?
My guess is that it's a lot smaller than you think. My 16Gb machine runs with 12.2 Gb free, and a lot of the used space is taken up with disk cache and OS plus dribs and drabs that other software loads in advance.
And if it's too small, then buy some more RAM or even a new computer, which turns out much cheaper than struggling unless, of course, you count your time as effectively worthless. I could double the 16Gb in my PC for only £60 currently, and you don't buy much of my time for that! Incidentally, all the components in replacing the innards of an existing computer could cost between £150 - £300 because there's absolutely no point in having too many cores just to run FTN95 programs.
Eddie
Last edited by LitusSaxonicum on Mon Aug 10, 2020 3:14 pm; edited 1 time in total |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Mon Aug 03, 2020 2:04 pm Post subject: Re: How much Ram required |
|
|
colt1954 wrote: | Hi,
A simple question for the excellent people on this forum, how can you determine how much 'ram' is required on a PC to execute a given programme, i guess its to some extent based on array sizes etc...?? |
This is not a simple question, so not sure how detailed the answer required is, especially for 64-bit .exe.
You can use task manager to get an estimate of the memory in use at any time. This can vary depending on how much memory is initialised or referenced. This basically includes code, and initialised arrays.
With lots of subroutines and local arrays, how much of the stack in use can be estimated, but can be difficult to calculate.
ALLOCATE arrays are a special case, as they don't use physical memory until they are "used". Certainly, ALLOCATE arrays are not included in the physical memory allocated until they are both allocated and used.
Also physical memory pages are not allocated until each memory page is referenced, so large allocate arrays can become virtual arrays if used in that way. I have examples of a 16gb allocated array that only uses 1gb of physical memory, although this is a contrived case.
The best answer is to use Task Manager "Processes" tab (Win 7) and monitor the variation. |
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Thu Aug 06, 2020 1:37 pm Post subject: |
|
|
Or, you pays no money and you takes yer pick of the Alternatives to TaskManager _________________ ''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... " |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Mon Aug 10, 2020 3:04 pm Post subject: |
|
|
Just as a math question, Eddie, 5K by 50K of REAL*8 is 2 gigabytes. Did you mean 5K by 5K? |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Mon Aug 10, 2020 3:15 pm Post subject: |
|
|
Yes I did. I've corrected it now. Thanks.
Eddie |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|