---
# System prepended metadata

title: '[Greenline] Halo exchanges for factories'
tags: [cycle 32 10/25]

---

# [Greenline] Halo exchanges for factories

<!-- Add the tag for the current cycle number in the top bar -->

- Shaped by: Magdalena
- Appetite (FTEs, weeks): 1 Person / 2 weeks
- Developers: Nikki <!-- Filled in at the betting table unless someone is specifically required here -->

## Problem
<!-- The raw idea, a use case, or something we’ve seen that motivates us to work on this -->
Some static fields computed in the factories need to be exchanged for multinode model runs. This is the case if they are later on used in computations that access halos.
The factories do not yet do that.



## Appetite
<!-- Explain how much time we want to spend and how that constrains the solution -->

## Solution
<!-- The core elements we came up with, presented in a form that’s easy for people to immediately understand -->

- A`decomposition.ExchangeRuntime` needs to be passed to the factories.
- call `exchange` where needed.
    - check the ICON source codes which fields need to exchanged. It should be ok to do a blocking exchange at first, such that when the `FieldSource.get` returns the halo exchanges are completed.
- possibly not only "final results" (i.e. fields that are retrieved and used in the model need exchanges) but also intermediate fields. For field computation done with numpy this should be straight forward, if the computation is `gt4py.FieldOperator` it would have to be split, or rewritten in numpy.


### testing
Add factory tests for the fields using halo exchanges in `mpi_tests` using the serialized data for 2 or 4 nodes.



## Rabbit holes
<!-- Details about the solution worth calling out to avoid problems -->
- **Testing**: 
    - ~~`mpi_tests` still do not run on CI. there is an old draft [PR-692](https://github.com/C2SM/icon4py/pull/692)~~
    
## No-gos
<!-- Anything specifically excluded from the concept: functionality or use cases we intentionally aren’t covering to fit the ## appetite or make the problem tractable -->

## Progress
<!-- Don't fill during shaping. This area is for collecting TODOs during building. As first task during building add a preliminary list of coarse-grained tasks for the project and refine them with finer-grained items when it makes sense as you work on them. -->

- [x] Task 1 ([PR#xxxx](https://github.com/GridTools/gt4py/pulls))
    - [x] Subtask A
    - [x] Subtask X
- [ ] Task 2
    - [x] Subtask H
    - [ ] Subtask J
- [ ] Discovered Task 3
    - [ ] Subtask L
    - [ ] Subtask S
- [ ] Task 4

