E3SM-Project / E3SM-Project/scream

Differentiate local vs global layout in the field metadata

Open
#2,795 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue infrastructure
Dominant language
No language data
Stars
79
Forks
54
PR merge metrics
No merged PRs in 30d

Description

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 calling `fid.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
```cpp
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`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.