How to use a par statement across multiple tiles

  • version

    1.1.1

  • scope

    Example.

    This code is provided as example code for a user to base their code on.

  • description

    How to use a par statement across multiple tiles

  • boards

    Unless otherwise specified, this example runs on the SliceKIT Core Board, but can easily be run on any XMOS device by using a different XN file.

The par construct takes a set of statements (usually function calls) and runs them in parallel. By default each task runs on a separate logical core.

The on construct allows you to place tasks on different tiles. For example:

par {
  on tile[0]: task1(5);
  on tile[1]: task2();
}

You can only do this from the main function and must include the platform.h header file.