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

memory usage - print it out

diedro
Beginner
927 Views

Dear all,

I find very useful to print out the CPU time in a Fortran program.

I would like to know if is possible to print out also the RAM or memory usage.

Thanks a lot

0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
927 Views

I believe IVF uses the C Runtime library heap manager, this can be verified with VTune on Release build with loop performing very large number of allocate/deallocate. Or stepping into an allocate in Debug build from the disassembly window (this may take quite a few steps but eventually you will get there). If you can confirm the C runtime library heap manager is used, then you can call the C heap manager function (e.g. heapwalk) to identify the in-use nodes. There are things that will complicate this process. At least this should get you going.

Another option you could do, if you are adventuresome, is to look at how a C/C++ program overloads new/delete and malloc/free TBB does this. This technique could potentially be implemented in your Fortran program. Essentially this is a filter that you insert between the Fortran code that calls malloc/free and the CRTL malloc/free. In there you can keep tally of the total allocations/deallocations in addition to other statistics.

Jim Dempsey

0 Kudos
Steven_L_Intel1
Employee
927 Views

Note that what Jim describes is usage of the C heap, which is not RAM and not all of the virtual memory a program uses. Intel Inspector XE has a memory growth analysis feature that can track virtual memory usage over time.

0 Kudos
Reply