exasim-project / OBR

A runner for OpenFOAM benchmarks
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Add templated generator blocks #190

Closed greole closed 8 months ago

greole commented 8 months ago

This PR adds generator expressions to generate value lists. An example of such could be this:

  schema: "decompose/{method}_{partition}_N{nodes}_n{numberOfSubdomains}"
  common:
      method: simple
  generator:
      key: nodes
      values: [1, 2, 4, 6, 8, 10]
      template:
          # GPU decompositions
        - numberOfSubdomains: ${{ 1 * nodes * ${{env.NGPUS}} }}
          partition: GPU
        - numberOfSubdomains: ${{ 2 * nodes * ${{env.NGPUS}} }}
          partition: GPU
          # CPU decomposition
        - numberOfSubdomains: ${{ 1 * nodes * ${{env.NCPUS}} }}
          partition: CPU

Here, the value of nodes in the template section gets replaced by the entries of values. In order to achieve this, the evaluation of the generator expression ${{ }} has been moved from the parse_yaml step to the create_tree phase.