@@ -16,7 +16,7 @@ Written primarily for Fortran/Fypp; the OpenACC and style sections matter only w
1616 - Most sources are `.fpp`; CMake transpiles them to `.f90`.
1717- **Fypp macros** live in `src/<subprogram>/include/` you should scan these first.
1818 `<subprogram>` ∈ {`simulation`,`common`,`pre_process`,`post_process`}.
19- - Only `simulation` (+ its `common` calls) is GPU-accelerated via **OpenACC**.
19+ - Only `simulation` (+ its `common` calls) is GPU-accelerated via **OpenACC** or **OpenMP** .
2020- Assume free-form Fortran 2008+, `implicit none`, explicit `intent`, and modern
2121 intrinsics.
2222- Prefer `module … contains … subroutine foo()`; avoid `COMMON` blocks and
@@ -56,27 +56,29 @@ Written primarily for Fortran/Fypp; the OpenACC and style sections matter only w
5656* Every variable: `intent(in|out|inout)` + appropriate `dimension` / `allocatable`
5757 / `pointer`.
5858* Use `s_mpi_abort(<msg>)` for errors, not `stop`.
59- * Mark OpenACC -callable helpers that are called from OpenACC parallel loops immediately after declaration:
59+ * Mark GPU -callable helpers that are called from GPU parallel loops immediately after declaration:
6060 ```fortran
6161 subroutine s_flux_update(...)
62- !$acc routine seq
62+ $:GPU_ROUTINE(function_name='s_flux_update', parallelism='[ seq]')
6363 ...
6464 end subroutine
6565 ```
6666
6767---
6868
69- # 3 OpenACC Programming Guidelines (for kernels)
69+ # 3 FYPP Macros for GPU acceleration Pogramming Guidelines (for kernels)
70+
71+ Do not directly use OpenACC or OpenMP directives directly. Instead, use the FYPP macros contained in src/common/include/parallel_macros.fpp
7072
7173Wrap tight loops with
7274
7375```fortran
74- !$acc parallel loop gang vector default(present) reduction( ...)
76+ $:GPU_PARALLEL_FOR(private='[...]', copy='[ ...]' )
7577```
76- * Add `collapse(n) ` to merge nested loops when safe.
77- * Declare loop-local variables with `private( ...) `.
78+ * Add `collapse=n ` to merge nested loops when safe.
79+ * Declare loop-local variables with `private='[ ...]' `.
7880* Allocate large arrays with `managed` or move them into a persistent
79- `!$acc enter data ` region at start-up.
81+ `$:GPU_ENTER_DATA(...) ` region at start-up.
8082* **Do not** place `stop` / `error stop` inside device code.
8183* Must compile with Cray `ftn` and NVIDIA `nvfortran` for GPU offloading; also build CPU-only with
8284 GNU `gfortran` and Intel `ifx`/`ifort`.
0 commit comments