Project

General

Profile

Support #929

Using gProf

Added by Dobbs, Adam over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Build System
Target version:
Start date:
07 March 2012
Due date:
% Done:

100%

Estimated time:
Workflow:
New Issue

Description

I am trying to profile the tracker software with gProf (not a tool I have used before). I change the flag maus_gprof in env.sh (attached) to equal 1 and do a scons; scons -c . The compile takes longer, as expected. I then run the tracker reconstruction over the real cosmic data (using the attached script). The gProf website indicates this should then produce a file called gmon.out which I can use with gProf. I do a find of the current directory (the MAUS root directory) and all its subdirectories, but the file does not seem to be there.

Any thoughts?


Files

env.sh (3.71 KB) env.sh Dobbs, Adam, 07 March 2012 12:11
tracker_cosmic.py (1.52 KB) tracker_cosmic.py Dobbs, Adam, 07 March 2012 12:11
#1

Updated by Rogers, Chris over 10 years ago

  • Target version set to Future MAUS release

Did you mean scons -c; scons? (Need to clean first, right)

Can you try

echo maus_gprof

and check the env variable is set?

#2

Updated by Dobbs, Adam over 10 years ago

Hi Chris,

Yes, apologies, I meant scons -c; scons . Just did the echo and maus_gprof is coming back as 1, as expected. I'll trying running one of the other python scripts too...

#3

Updated by Rogers, Chris over 10 years ago

Ah, I can't check because I'm rebuilding GEANT4 for some reason. But have a look for -pg flag in the gcc command that scons makes. That's the profile flag...

#4

Updated by Dobbs, Adam over 10 years ago

Good thought... but just looked and the -pg flag is in the gcc command...

#5

Updated by Rogers, Chris over 10 years ago

Okay, wait for geant4 to build and I will have a look. gmon.out should be in the current working directory I think (i.e. where you called python blah.py from).

#6

Updated by Rogers, Chris over 10 years ago

Ah, I think it only works with directly called C++ code, not through python. Probably have to rebuild python with -pg flag for that. Sorry about that. If you wanted to dig, I saw this thread and it looked interesting.

#7

Updated by Rogers, Chris over 10 years ago

Or just profile through unit tests (I think that's what I had in mind when I made the flag). I'll update the comment...

#8

Updated by Dobbs, Adam over 10 years ago

I've had a play, python can be compiled to work with gprof by setting environment variable CC=gcc -pg and LDFLAGS=-pg then running the usual maus python bash install script. It does not however seem to want to then run gprof over the gmon.out file created by running one of our high level .py scripts. Think I shall wave a white flag here and resort to profiling with unit tests...

#9

Updated by Rogers, Chris over 10 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Okay, I updated the comment... that will have to do...

Also available in: Atom PDF