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

Using bionet iclamp with MPI fails due to accessing cells not on rank #331

Open
tjbanks opened this issue Oct 4, 2023 · 0 comments
Open

Comments

@tjbanks
Copy link
Contributor

tjbanks commented Oct 4, 2023

When adding a current clamp to cells on multiple ranks an error occurs when the gid isn't local to that rank -

Traceback (most recent call last):
  File "generate_traces.py", line 17, in <module>
    generate_parametric_traces(config)
  File "/home/tbg28/git_stage/act/act/utils.py", line 238, in generate_parametric_traces
    sim.run()
  File "/home/tbg28/git_stage/bmtk/bmtk/simulator/bionet/biosimulator.py", line 262, in run
    mod.initialize(self)
  File "/home/tbg28/git_stage/bmtk/bmtk/simulator/bionet/modules/iclamp.py", line 136, in initialize
    cell = sim.net.get_cell_gid(gid)
  File "/home/tbg28/git_stage/bmtk/bmtk/simulator/bionet/bionetwork.py", line 124, in get_cell_gid
    return self._rank_node_gids[gid]
KeyError: 0

A solution that worked for me was to update iclamp.py

# line 130
def initialize(self, sim):
        # Get select node gids, but only for those nodes that are on the current rank (if running on multiple cores)
        select_gids = list(sim.net.get_node_set(self._node_set).gids())
+        local_gids = sim.net.get_local_cells()
+        gids_on_rank = list(set(select_gids) & set(local_gids))
-         gids_on_rank = list(set(select_gids) & set(select_gids))

Will put up a PR for consideration.

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

No branches or pull requests

1 participant