Computes the total pixel volume per process contained in a BinaryPartition. Args: partition: a BinaryPartition subtree to compute the associated volumes for chunk_volumes: associated grid volumes from a simulation, obtained by calling sim.structure.get_chunk_volumes()
(
partition: mp.BinaryPartition,
chunk_volumes: Tuple[mp.grid_volume],
chunk_owners: onp.ndarray,
)
| 206 | |
| 207 | |
| 208 | def get_total_volume_per_process( |
| 209 | partition: mp.BinaryPartition, |
| 210 | chunk_volumes: Tuple[mp.grid_volume], |
| 211 | chunk_owners: onp.ndarray, |
| 212 | ) -> Dict[int, float]: |
| 213 | """Computes the total pixel volume per process contained in a BinaryPartition. |
| 214 | |
| 215 | Args: |
| 216 | partition: a BinaryPartition subtree to compute the associated volumes for |
| 217 | chunk_volumes: associated grid volumes from a simulation, obtained by |
| 218 | calling sim.structure.get_chunk_volumes() |
| 219 | chunk_owners: list of processes associated with each grid volume, obtained |
| 220 | by calling sim.structure.get_chunk_owners() |
| 221 | |
| 222 | Returns: |
| 223 | A dictionary of the total pixel volume occupied by all chunks owned by each |
| 224 | process. |
| 225 | """ |
| 226 | volumes_per_process = {} |
| 227 | leaf_nodes_in_tree = enumerate_leaf_nodes(partition) |
| 228 | for leaf in leaf_nodes_in_tree: |
| 229 | total_volume = sum( |
| 230 | pixel_volume(chunk_volumes[i]) |
| 231 | for i, owner in enumerate(chunk_owners) |
| 232 | if owner == leaf.proc_id |
| 233 | ) |
| 234 | |
| 235 | volumes_per_process[leaf.proc_id] = total_volume |
| 236 | return volumes_per_process |
| 237 | |
| 238 | |
| 239 | def get_box_ranges( |
nothing calls this directly
no test coverage detected