PyForTool
Python-fortran-tool
Loading...
Searching...
No Matches
Public Member Functions | List of all members
pyfortool.openacc.Openacc Class Reference
Inheritance diagram for pyfortool.openacc.Openacc:
Inheritance graph
[legend]

Public Member Functions

 removeACC (self)
 
 removebyPassDOCONCURRENT (self)
 
 craybyPassDOCONCURRENT (self)
 
 allocatetoHIP (self)
 
 addACCData (self)
 
 addACCRoutineSeq (self, stopScopes)
 

Detailed Description

OpenACC directives transformation methods.

Provides utilities for adding, removing, and transforming OpenACC
directives for GPU acceleration.

Definition at line 11 of file openacc.py.

Member Function Documentation

◆ addACCData()

pyfortool.openacc.Openacc.addACCData (   self)
Add !$acc data directives for GPU data transfer.

For each subroutine, inserts:
- !$acc data present (array1, array2, ...) after declarations
- !$acc end data at the end of the routine

Only affects INTENT arrays (IN, OUT, INOUT).

Examples
--------
>>> pft = PYFT('gpu_code.F90')
>>> pft.addACCData()

Definition at line 244 of file openacc.py.

Here is the call graph for this function:

◆ addACCRoutineSeq()

pyfortool.openacc.Openacc.addACCRoutineSeq (   self,
  stopScopes 
)
Add !$acc routine seq directive to subroutines.

Parameters
----------
stopScopes : list of str
    Scope paths where to stop adding directives.

Examples
--------
>>> pft = PYFT('gpu_code.F90')
>>> pft.addACCRoutineSeq(['module:MOD/sub:SUB'])
# Adds !$acc routine (SUB) seq to SUB subroutine

Definition at line 301 of file openacc.py.

Here is the call graph for this function:

◆ allocatetoHIP()

pyfortool.openacc.Openacc.allocatetoHIP (   self)
Convert ALLOCATE/DEALLOCATE to HIP versions for AMD GPUs.

Transforms memory allocation calls for variables that are:
- Sent to GPU via !$acc enter data copyin
- Created on GPU via !$acc enter data create

Required for AMD MI250X GPU managed memory usage (e.g., Adastra cluster).

Examples
--------
>>> pft = PYFT('gpu_code.F90')
>>> pft.allocatetoHIP()
# ALLOCATE(X) becomes CALL MNH_HIPALLOCATE(X)

Definition at line 148 of file openacc.py.

Here is the call graph for this function:

◆ craybyPassDOCONCURRENT()

pyfortool.openacc.Openacc.craybyPassDOCONCURRENT (   self)
Handle CRAY compiler vectorization issues with GPU directives.

On compute kernels with !$acc loop independent collapse(X) directives:
- If BR_ functions are used: removes !$acc loop collapse and uses DO CONCURRENT
- If !$mnh_undef(OPENACC) is present: removes !$acc loop collapse
- If !$mnh_undef(LOOP) is present: converts nested loops to DO CONCURRENT

Notes
-----
Works around CRAY compiler vectorization bugs with BR_ (bit-reproducibility)
functions and OpenACC directives.

Definition at line 53 of file openacc.py.

Here is the call graph for this function:

◆ removeACC()

pyfortool.openacc.Openacc.removeACC (   self)
Remove all OpenACC directives.

Examples
--------
>>> pft = PYFT('gpu_code.F90')
>>> pft.removeACC()

Definition at line 20 of file openacc.py.

Here is the call graph for this function:

◆ removebyPassDOCONCURRENT()

pyfortool.openacc.Openacc.removebyPassDOCONCURRENT (   self)
Remove MNH OpenACC bypass macros for non-Cray compilers.

Removes the following directives:
- !$mnh_undef(LOOP)
- !$mnh_undef(OPENACC)
- !$mnh_define(LOOP)
- !$mnh_define(OPENACC)

Definition at line 33 of file openacc.py.

Here is the call graph for this function:

The documentation for this class was generated from the following file: