Get CPU usage stats for ADL programs

Issues related to runtime execution of algorithms in ADL
Post Reply
sudipta
Posts: 8
Joined: Wed Jan 08, 2014 10:37 am

Get CPU usage stats for ADL programs

Post by sudipta »

Folks
Is there any way I can profile any ADL executable using Gprof or something similar. I want to basically get idea about the running time and the CPU usage stats for any ADL algorithm executable.
Please let me know how one can do that in ADL.
Thanks
kbisanz
Posts: 280
Joined: Wed Jan 05, 2011 7:02 pm
Location: Omaha NE

Re: Get CPU usage stats for ADL programs

Post by kbisanz »

You should be able to profile an ADL algorithm just like any other C++ application.

You will need to add an extra compiler flag. It appears to be -pg for the GCC compiler. You can edit the compiler flags by modifying
$ADL_HOME/imakeconf/PRO_Config. That file has a lot of #ifdefs in it. You want the section around lines 409-416:

Code: Select all

#ifdef __GNUC__
#define CCompile_Optn -m64 -fPIC -Wall -Wno-unknown-pragmas
#define FCompile_Optn -m64 -fPIC -Wall -ffree-form -fimplicit-none -fno-underscoring
#define F77Compile_Optn -m64 -fPIC -Wall -ffixed-form -fimplicit-none -fno-underscoring -x f77
#define Link_Optn -m64 -Xlinker -zmuldefs
#define Static_Link_Optn -ru
#define Shared_Link_Optn -mfull-toc -m64 -Xlinker -zmuldefs -lc -shared
#endif
Try adding -pg to all those lines except for Static_Link_Optn. Then you'll need to rebuild ADL so that you make use of the new flag. When you run the ADL algorithm, you should have a gmon.out file that can be used with gprof.

It has been a long time since I've done this, so I am going from memory.

One thing to note is that by default ADL is compiled for debugging which turns off compiler options. If you do not compile in debug mode, your program will be compiled optimized and may run faster. In some algorithms, compiler optimizations make a lot of difference. You can turn off the debug compile (and turn on optimizations) by not providing "-debug" to build_adl.pl. If you use buildAdl.csh or buildAdl.ksh then you can edit the file and remove "-DDebug". In all cases, you will want to rebuild all of ADL for greatest effect. After your updates and rebuild, make sure that each Makefile has -pg in it.
Kevin Bisanz
Raytheon Company
sudipta
Posts: 8
Joined: Wed Jan 08, 2014 10:37 am

Re: Get CPU usage stats for ADL programs

Post by sudipta »

Thanks that is helpful
kbisanz
Posts: 280
Joined: Wed Jan 05, 2011 7:02 pm
Location: Omaha NE

Re: Get CPU usage stats for ADL programs

Post by kbisanz »

If forgot to mention, for very basic stats, you can just use "/usr/bin/time -v". That would not require any sort of recompilation.
Kevin Bisanz
Raytheon Company
Post Reply