# loki.transformations.data_offload.offload

Classes

`DataOffloadTransformation`(**kwargs) | Utility transformation to insert data offload regions for GPU devices based on marked `!$loki data` regions.

class DataOffloadTransformation(**kwargs)

  Bases: `Transformation`

  Utility transformation to insert data offload regions for GPU devices based on marked `!$loki data` regions. In the first instance this will insert OpenACC data offload regions, but can be extended to other offload region semantics (eg. OpenMP-5) in the future.

  Parameters:

    - remove_openmp (bool) – Remove any existing OpenMP pragmas inside the marked region.

    - present_on_device (bool) – Assume arrays are already offloaded and present on device”

    - assume_deviceptr (bool) – Mark all offloaded arrays as true device-pointers if data offload is being managed outside of structured OpenACC data regions.

  transform_subroutine(routine, **kwargs)

    Apply the transformation to a Subroutine object.

    Parameters:

      - routine (Subroutine) – Subroutine to apply this transformation to.

      - role (string) – Role of the routine in the scheduler call tree. This transformation will only apply at the `'driver'` level.

      - targets (list or string) – List of subroutines that are to be considered as part of the transformation call tree.

  insert_data_offload_pragmas(routine, targets)

    Find `!$loki data` pragma regions and create according `!$acc udpdate` regions.

    Parameters:

      - routine (Subroutine) – Subroutine to apply this transformation to.

      - targets (list or string) – List of subroutines that are to be considered as part of the transformation call tree.

  remove_openmp_pragmas(routine, targets)

    Remove any existing OpenMP pragmas in the offload regions that will have been intended for OpenMP threading rather than offload.

    Parameters:

      - routine (Subroutine) – Subroutine to apply this transformation to.

      - targets (list or string) – List of subroutines that are to be considered as part of the transformation call tree.