vatai / mpk

Matrix powers kernel
1 stars 0 forks source link

[pdmpk] Unify `init_dict` and `comm_dict` #30

Closed vatai closed 4 years ago

vatai commented 4 years ago

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:

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.