Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation Fault: 11 - simulation unable to initialize and run #3336

Open
EthanIrby8 opened this issue Feb 18, 2025 · 3 comments
Open

Segmentation Fault: 11 - simulation unable to initialize and run #3336

EthanIrby8 opened this issue Feb 18, 2025 · 3 comments
Labels

Comments

@EthanIrby8
Copy link

Context

I have a NEURON-based python program that uses various compiled .mod files to build a network.
The program is unable to run once it hits these code lines at the end of the program:
h.finitialize(-65)
h.continuerun(100)

At the first run of the program, the result of the execution is a segmentation fault error: Segmentation Fault: 11.
The second run of the program does not give a segmentation fault error and instead does not print anything and continues to run indefinitely until VSCode stops the program.

I have tried using the nrniv -debug command to check for any version incompatibilities or under-the-hood runtime errors. The command shows that the .mod files were compiled though an error with importing a method from multiprocessing appears.
I have attached the stacktrace below. Let me know if you would like to see the mod files or any additional code/information.

Image

NEURON setup

  • Version: NEURON==8.2.6
  • Installation method: pip
  • macOS
  • mod files compiled using the command: nrnivmodl
@EthanIrby8 EthanIrby8 added the bug label Feb 18, 2025
@nrnhines
Copy link
Member

As far as I know, -debug is not a valid argument to nrniv. It is being treated as a HOC file and hence can't open -debug.
I'm guessing that test_nigo_pathway.py contains python code that make use of multiprocessing support. If that is the case, it is probably best to launch python test_nigo_pathway.py as it seems more likely that python multiprocessing support will work.

@EthanIrby8
Copy link
Author

Thanks @nrnhines, I was able to re-compile the mod files with the nrnivmodl -coreneuron command and run the python script successfully. However, I now notice that I am unable to re-compile the mod files in a thread safe manner when adding POINTERs - see the error below:

Image

Here is an example of how I set a POINTER in a .mod file:

TITLE Modular Ligand Class Supporting External Input

NEURON {
    POINT_PROCESS GenericLigand
    RANGE C_init, decay_rate, external_input
    POINTER C, receptor_activation
    THREADSAFE
}

For instance, I would like to access C and receptor_activation in my python code using the h.setpointer() method.

@nrnhines
Copy link
Member

Please try again with THREADSAFE as the first statement in the NEURON block ( or at least prior to the POINTER declaration).
By the way, although you can use h.setpointer, you might prefer the, to my mind more clear,

GenericLigand_instance._ref_C = hoc_reference_to_some_hoc_variable

Also, you are certainly threadsafe in all cases where you are only using one thread. But for multiple threads, it is your responsibility that the mod file be in fact thread safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants