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

NEURON: Pointer to src is not in the currently accessed section <Astrocyte.Astrocyte object at 0x14da04650b20>.soma #1523

Closed
ikitayama opened this issue Nov 5, 2021 · 16 comments
Labels
bug rxd reaction-diffusion

Comments

@ikitayama
Copy link

    for i in range(ncell3):
      seg = settings.pc.gid2cell(i + rings[0].gid3start)
      settings.pc.source_var(ca[cyt].nodes[100]._ref_concentration, i + 2000, sec=seg.soma)

Is this supposed to work?

@ikitayama ikitayama added the bug label Nov 5, 2021
@nrnhines
Copy link
Member

nrnhines commented Nov 5, 2021

I don't see anything wrong with the syntax. seg is a cell. @ramcdougal is the RxD concentration properly formed? I see the documentation https://nrn.readthedocs.io/en/latest/python/modelspec/programmatic/network/parcon.html#ParallelContext.source_var
needs updating since source_var is no longer restricted to voltage in CoreNEURON as of Jan 1,2021 and in NEURON, sinc 2016

@ramcdougal
Copy link
Member

So that's one way of specifying an rxd pointer, yes. I think the problem is that source_var's checking of sections doesn't know how to look up rxd things.

@ramcdougal ramcdougal added the rxd reaction-diffusion label Nov 9, 2021
@ikitayama
Copy link
Author

ikitayama commented Nov 9, 2021 via email

@nrnhines
Copy link
Member

For the short term I can start a branch that uses the old pointer if it can't figure it out during update. Of course that relies on the rxd pointer being stable. That should be ok if all your rxd setup is finished prior to your calls to pc.source_var. Let me know if that workaround would be helpful.

@ikitayama
Copy link
Author

ikitayama commented Nov 10, 2021 via email

@nrnhines
Copy link
Member

Does the error message you receive look like Pointer to src is not in the currently accessed section <name>

@nrnhines
Copy link
Member

Turned out the effort was more than I self-bargained for but I think the https://github.com/neuronsimulator/nrn/tree/rxd-sourcevar
will allow you to use an rxd variable reference as a source_var. This is likely to be the basis for a more complete implementation that is able to update these kinds of pointers. Please note the simple test in nrn/test/pynrn/test_partrans.py in the neighborhood of line 264 where I play a ramp into the hoc variable partrans_foo and that gets copied every time step to an
IClamp.amp. Also note in that file that I had to comment out 3 expect_error tests having to do with the normal requirement that a source variable be associated with a Section so that the pointers can be updated if necessary. I strongly recommend that you instrument some test code in your model that tests that after finitialize and after psolve that all source_var are equal to target_var. Or at least fill all the sources with values that identify them in some way (eg relate to the sid) and verify after an
finitialize or fadvance, that those values are present in the targets with the same sid.

@ikitayama
Copy link
Author

NEURON: Pointer to src is not in the currently accessed section <Astrocyte.Astrocyte object at 0x1459696a0d60>.soma
 near line 0
 ^
        ParallelContext[0].source_var(..., 2000)
Traceback (most recent call last):
  File "ringtest.py", line 234, in <module>
    settings.pc.source_var(ca[cyt].nodes[100]._ref_concentration, i + 2000, sec=seg.soma)
RuntimeError: hocobj_call error

Is the above expected error (I'm using @nrnhines 's dev branch)?

@ikitayama
Copy link
Author

Cc: @tatenokatsumi

@nrnhines
Copy link
Member

Are you sure you are using the branch. That error message was commented out and replaced by a Notice.

-       hoc_execerr_ext("Pointer to src is not in the currently accessed section %s", secname(sec)); return NULL; //avoid coverage false negative.
+//     hoc_execerr_ext("Pointer to src is not in the currently accessed section %s", secname(sec)); return NULL; //avoid coverage false negative.
+       Fprintf(stderr, "Notice: ssid=%ld assumes fixed pointer %p (present value %g)\n", (long)ssid, pv, *pv);
+       return NULL;

Feel free to comment out the notice if you see too many of them.

@ikitayama
Copy link
Author

Ah, you are right.

$ python ringtest.py
0.036
in define_biophycis
0.0800002s created rings
Notice: ssid=2000 assumes fixed pointer 0x2cae2d0 (present value 0.0001)
Traceback (most recent call last):
  File "ringtest.py", line 238, in <module>
    syn = target.synlist3[i]
IndexError: list index out of range

Is this the expected error?

@nrnhines
Copy link
Member

The Notice makes sense given this issue.. The IndexError is a python error that is likely a bug in your program.

@ikitayama
Copy link
Author

It seems now working. Thanks.

@ikitayama
Copy link
Author

@nrnhines is this merged upstream?

@ikitayama
Copy link
Author

I'd like to switch back to master if that's the case.

@nrnhines
Copy link
Member

@pramod @ramcdougal This was not made a pull request. For the short term I can (will) make this a pull request, mark it as "work in progress" and merge the master into the branch so it will be up to date. The assumption of rxd pointer stability is not something I'm sure is warranted. And I haven't discussed this in detail with Robert. At any rate, turning off the code that raises an error if a pointer can't be updated is too generic, even though it's ok for your rxd pointers under your usage circumstances.
I (and I hope Robert can participate in the design) have to come up with a way to check for rxd pointer validity/updating.

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

No branches or pull requests

3 participants