scream
scream copied to clipboard
Differentiate local vs global layout in the field metadata
I'm running into a few scenarios where we would need global layout information rather than rank-local layout information (e.g., when printing the DAG, we prob don't care about the layout on rank-0). Here, with global I mean "the layout that the field would have without MPI".
Possible strategies (both bwd compatible):
- store two layouts in
FieldIdentifier, and allow callingfid.get_global_layout()to get global layout information. - use grid and layout to get the global one (so that we don't store it, and only retrieve it upon request). E.g., something like
grid->get_global_layout(my_local_layout);. Internally, the grid will do something like
FieldLayout AbstractGrid::get_global_layout(const FieldLayout& lcl) {
FieldLayout glb (lcl);
// Last arg=false, since if tag not found, it's fine (lcl == glb);
return glb.reset_dim(get_partitioned_dim_tag(),get_partitioned_dim_global_size(),false);
}
I think I like option 2 better. The places where we need global layouts are very few, and we don't want to have to know both local/global layouts every time we create a FieldIdentifier.