C - Profiling

Post Reply
nonfcomm

C - Profiling

Post by nonfcomm »

What would be required for compiling neuron such that I could run a C-profiler on my simulations? Would it be sufficient to just tag the -pg option on the compile commands in the installation?

Thanks,
Daniel
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Hanze University of Applied Sciences
Contact:

Post by Raj »

I sorted these things out for windows, as neurons window version is running on top of cygwin which is linux emulator/ linux like environment you will probably find some good clues here:
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=184

Under cygwin the profiling software requires static linking, which requires you to include your own mod-files into the build. I don't know how this works out under under unix/linux.
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Hanze University of Applied Sciences
Contact:

Post by Raj »

Some bits and pieces of communication with Michael Hines from when I was setting up profiling under windows.
Hines wrote:I only have ever used profiling on a linux machine and the configure line i used was
cd profile
export NPROF=$PWD
export CFLAGS="-pg"
export CXXFLAGS="-pg"
export linux_nrnmech=no
$NRNS/configure --disable-shared --prefix=$NPROF --srcdir=$NRNS
make
make install

This suggests that the normal way I do dll's for mswin will not work and mod files cannot
be profiled without building a completely statically linked special. On linux I used
# cd to some model to test
$NPROF/i686/bin/nrnivmodl
i686/special batch_.hoc
gprof i686/special > temp
and it will be necessary to use nrnivmodl instead of mknrndll

So step one is to see if you can do profiling with a bare nrniv.exe. It will then be possible to
create a statically linked special.
ted
Site Admin
Posts: 5787
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

Good pointers, Raj.

I was discussing this will Bill Lytton, who said:

Code: Select all

I haven't used profiling though I do routinely use gdb without difficulty.  You
should be able to add the needed flags via environmental variables as listed in
'configure':

Some influential environment variables:
  CXX         C++ compiler command
  CXXFLAGS    C++ compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
              headers in a nonstandard directory <include dir>
  CC          C compiler command
  CFLAGS      C compiler flags
  CPP         C preprocessor
  CXXCPP      C++ preprocessor
  F77         Fortran 77 compiler command
  FFLAGS      Fortran 77 compiler flags
  MPICC       MPI C compiler command
  MPICXX      MPI C++ compiler command
ramnath.sagar
Posts: 1
Joined: Fri Apr 25, 2008 7:08 am

Post by ramnath.sagar »

Hello raj,
Thanks a lot for your suggenstion. I was able to configure the neuron compilation with the -pg and -g flag.
However, when ever i compile mod files using nrnivmodl and the run nrngui, and then give
gprof i686/special > output..
it says call "gprof: gmon.out file is missing call-graph data"
I understand the meaning of this error., but i dont understand, how its not generating the call graph. It works fine for flat profile( with -p ), but whenever i try options like -F, -f, or ones tat uses call graphs, it shows me this error..
hines
Site Admin
Posts: 1600
Joined: Wed May 18, 2005 3:32 pm

Post by hines »

Code: Select all

gprof i686/special > output.. 
special is just a shell script. Look into it to see the command actually being run
(nrniv)
Post Reply