---
# System prepended metadata

title: Finalize C++ backend integration
tags: [functional cycle 10]

---

# Finalize C++ backend integration

###### tags: `functional cycle 10`

Appetite: full cycle

Developer: Rico, (Peter, Enrique, Hannes)

## Goal

In the previous cycle, a first version with limitations was implemented. Current features include:
- generating bindings for the C++ stencils
- compiling C++ stencils and bindings
- loading compiled modules and running stencils directly from Python
- execution only for cartesian stencils at the moment
- only cartesian offsets supported at the moment

The goal of this project is to complete the backend integration by adding missing features and improving upon existing ones while strictly reducing technical debt:
- support stencils on unstructured domains
  - support for neighbour tables
- share GridTools library dependency across all C++ stencils
- use CMake and ninja from PyPI
- revise caching of compiled stencils at multiple levels
- parameterize remaining tests
  - maybe add option to disable C++ tests to make testing quicker
  - (optional) experiment with saving cmake config time by putting multiple fencils into one cmake project
- introduce second build system using cmake configure to create compile_commands.json once and then directly running that on every stencil (primarily for tests and interactive experimentation)


## Steps

- [X] ensure all test cases that don't use a missing feature actually pass and the other ones fail in the right place. Known failures include:
  - tuple-of-field (and tuple-of-tuple-of etc) arguments fail in the wrong place
  - quite a few tests fail because `numpy.void` type is not supported
  - passing domain as argument (as dict) doesn't work
  - `IndexField`s and `ConstantField`s are not accepted
  - sometimes test cases seem fail because the fencil has the same name as one from another test (and instead of recompiling the old one is used, even though they have different signatures)
- [ ] approach the originally intended architecture
    - [ ] make source module generators a type of fencil processor
    - [ ] cleanly separate the pipeline steps
- [ ] add an alternative build system step for faster tests (configure only once per test session)
- [ ] interface for neighbor tables
- [ ] get GridTool C++ and boost dependency (boost preprocessor) via pip
- [ ] pass tuple-of-field arguments to the C++ code
- [ ] allow direct calling of `deref`
