debugging/profiling NEURON execution

Anything that doesn't fit elsewhere.
Post Reply
JimH
Posts: 54
Joined: Tue Apr 10, 2007 3:36 pm
Location: Duke University

debugging/profiling NEURON execution

Post by JimH » Thu Aug 29, 2019 9:06 am

I'm interested in stepping through the execution of a NEURON program, line by line, to make sure that I fully understand how it's running. I'm assuming that would require compiling everything from source with debugging enabled.

Given the HOC interpreter, the dynamically loaded mechanisms, and my general inexperience debugging compiled programs, I'm not entirely sure where to start. Any guidance would be much appreciated.

ramcdougal
Posts: 162
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: debugging/profiling NEURON execution

Post by ramcdougal » Thu Aug 29, 2019 10:15 am

Are you trying to debug NEURON itself or a NEURON simulation?

For debugging NEURON simulations written in Python, you can use pdb as with any other Python code. A quick search will lead you to many pdb tutorials.

For debugging NEURON simulations written in HOC... there's no equivalent. Going forward, you could write your new code in Python and then at least that part of the code would be easily debuggable. :) Other than that, general advice for debugging without a debugger include: (1) print statements (with printed labels), (2) making sure you understand expected values/properties and using assert statements to guarantee you have it, (3) testing each function separately as well as together, and (4) ask a friend to look at your code.

Compiling NEURON with debugging enabled is only necessary if you wanted to debug NEURON itself, not a NEURON model. This is almost certainly not what you need to do to solve your problem.

ted
Site Admin
Posts: 5647
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: debugging/profiling NEURON execution

Post by ted » Thu Aug 29, 2019 11:33 am

NEURON's standard run system is discussed in some detail in chapter 7 of The NEURON Book. Chapter 8 addresses simulation initialization. If you don't have the book, see these preprints:
https://www.neuron.yale.edu/ftp/ted/book/chap7.pdf
and
https://www.neuron.yale.edu/ftp/ted/book/chap8.pdf

JimH
Posts: 54
Joined: Tue Apr 10, 2007 3:36 pm
Location: Duke University

Re: debugging/profiling NEURON execution

Post by JimH » Thu Sep 05, 2019 2:33 pm

The goal was to get a better understanding of how NEURON is running (so debugging NEURON itself), presumably by calling a NEURON simulation. The links Ted have provided are a start, although I was hoping to "see" that code in action. I was assuming this would mean compiling the source code with debugging enabled.

So for example, I'd like to have a breakpoint in fadvance() and step through line by line (in the C/C++? code) to see the integration occurring and how NEURON organizes calls to update channel dynamics, recording vectors, and the like.

Post Reply