Currently init_dict and comm_dict represent the communication between partitions. They are separated into two maps because they need different treatment (comm_dict will update mcol entries, init_dict will update init_idcs entries). However, when processing these two dictionaries (maps), the setup code is basically the same, so maybe they should be merged!
Both init_dict and comm_dict map (src, tgt) pairs to a set of (src_idx, tgt_idx) pairs. The src_idx is the mbuf index on the src partition (bufs[src].mbuf[src_idx] is the value transferred). The difference is in the tgt_idx:
For init_dict, tgt_idx is the init_idcs index of the tgt partition, where the source index needs to be updated. Currently it is bufs[tgt].mpi_bufs.init_idcs[tgt_idx].first (I think).
For comm_dict, tgt_idx is the mbuf index of the tgt partition, where the source index needs to be updated. Currently it is bufs[tgt].mcsr.mbuf[tgt_idx] (I think).
An alternative implementation would be to have a single dictionary/map which maps (src, tgt) pairs to a set of (src_idx, tgt_idx, type) tuples. This way, there would be a single processing function, which would share the "setup" code (which is the same now for the two processing functions), and then an if(type=...) could separate the two types.
Currently
init_dict
andcomm_dict
represent the communication between partitions. They are separated into two maps because they need different treatment (comm_dict
will updatemcol
entries,init_dict
will updateinit_idcs
entries). However, when processing these two dictionaries (maps), the setup code is basically the same, so maybe they should be merged!Both
init_dict
andcomm_dict
map(src, tgt)
pairs to a set of(src_idx, tgt_idx)
pairs. Thesrc_idx
is thembuf
index on thesrc
partition (bufs[src].mbuf[src_idx]
is the value transferred). The difference is in thetgt_idx
:init_dict
,tgt_idx
is theinit_idcs
index of thetgt
partition, where the source index needs to be updated. Currently it isbufs[tgt].mpi_bufs.init_idcs[tgt_idx].first
(I think).comm_dict
,tgt_idx
is thembuf
index of thetgt
partition, where the source index needs to be updated. Currently it isbufs[tgt].mcsr.mbuf[tgt_idx]
(I think).An alternative implementation would be to have a single dictionary/map which maps
(src, tgt)
pairs to a set of(src_idx, tgt_idx, type)
tuples. This way, there would be a single processing function, which would share the "setup" code (which is the same now for the two processing functions), and then anif(type=...)
could separate the two types.