AllenInstitute / AllenInstitute/bmtk
Using bionet iclamp with MPI fails due to accessing cells not on rank
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 335
- Forks
- 102
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 6
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in bmtk/simulator/bionet/modules/iclamp.py at initialize(), then inspect bmtk/simulator/bionet/bionetwork.py and get_cell_gid(). Reproduce the failure with the multi-rank current-clamp setup and verify that initialization accesses only cells local to each rank without raising the reported KeyError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems, hpc
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100