[Rd] Profiling function that contains both C++ and Fortran Code
karch at mpib-berlin.mpg.de
Wed Sep 9 15:46:42 CEST 2015
I am trying to profile a function of OpenMx
(http://openmx.psyc.virginia.edu) for CPU time. My operating system is
OS X 10.10. OpenMx contains C++ and Fortran code. I have read the
section regarding profiling compiled code in the manual
This section and this post (http://blog.fellstat.com/?p=337) lead me to
try Instruments. Here is what I did:
-Chose the Time Profiler Template
-Started my script using RStudio
The output of instruments looks like this:
http://i.stack.imgur.com/aKIQm.jpg. The command line tool "sample"
returns the same output
The problem is that it looks like "omxunsafedgemm_", the functions that
consumes the vast majority of the time, would be called directly from
the Main Thread. However, this is a low level Fortran function. It is
always called by a C++ function called "omxDGEMM". In this example
"omxDGEMM" is first called by "omxCallRamExpection" (so almost at the
bottom of the call tree). The total time of "omxDGEMM" is 0. Thus, the
profiling information is currently useless.
In the original version of the package "omxDGEMM" is defined as inline.
I changed this in the hope that it would resolve the issue. This was not
the case. "omxunsafedgemm" is called by "omxDGEMM" like that
&(nrow), &(ncol), &(nmid),
&alpha, a->data, &(a->leading),
Any ideas how to obtain a sensible profiler output?
More information about the R-devel