Skip to content
Rupert Ford edited this page Nov 9, 2023 · 13 revisions

Welcome to the PSyclone wiki

Useful links

LFRic tickets and code.

Information on any reported installation issues.

Guidelines for requesting and performing a code review are here, including details about the Interface Markup.

Guidelines for creating a new release are here.

Presentations and publications about PSyclone can be found here.

Current and near future work on LFRic can be found here.

Description

PSyclone is a code generation and optimisation environment for the GungHo PSy layer.

GungHo proposes to separate model code into 3 layers, the algorithm layer, the Psy layer and the kernel layer. This approach is called psykal (for PSY, Kernel, ALgorithm). The idea behind psykal is to separate science code, which should be invariant computational resources, from code optimisations, which are often machine specific. The hope is that this separation will lead to understandable and maintainable code whilst providing performance portability as code can be optimised for the required architecture(s).

The Algorithm layer implements a codes algorithm at a relatively high level in terms of logically global fields, control structures and calls to kernel routines.

The Kernel layer implements the underlying science. Kernel operate on a subset of a field, typically a column, or set of columns. The Kernel operates on raw (fortran) arrays; this is primarily for performance reasons.

The PSy layer sits in-between the Algorithm layer and the Kernel layer. Its functional responsibilities are to

  • map from the global view of the algorithm layer to the field-subset view of the kernel layer by iterating over the appropriate space (typically mesh cells in a finite element implementation).

  • map between the high level global field view of data at the algorithm layer and the low level local (fortran) array view of data at the kernel layer.

  • provide any additional required arguments to the Kernel layer, such as dofmaps and quadrature values.

  • add appropriate halo calls, reduction variables and global sums to ensure correct operation of the parallel code.

The PSy layer is also where any single node performance optimisations take place, such as OpenMP parallelisation for many-core architectures or OpenACC parallelisation GPUs. Please note that, the internode, distributed memory partitioning (typically MPI with domain decomposition) is taken care of separately.

PSyclone is a tool that generates PSy layer code. This is achieved by parsing the algorithm layer code to determine the order in which kernels are called and parsing metadata about the kernels themselves. In addition to generating correct PSy code, PSyclone offers a set of optimising transformations which can be used to optimise the performance of the PSy layer.