Skip to content

Add OpenACC routine seq directives for GPU support#223

Open
krystophny wants to merge 2 commits intomainfrom
openacc-gpu-support
Open

Add OpenACC routine seq directives for GPU support#223
krystophny wants to merge 2 commits intomainfrom
openacc-gpu-support

Conversation

@krystophny
Copy link
Copy Markdown
Member

Summary

Add !$acc routine seq directives to batch spline evaluation functions to enable GPU execution via OpenACC.

Changes

  • batch_interpolate_1d.f90: Added !$acc routine seq to evaluate_batch_splines_1d_der2, evaluate_batch_splines_1d_der3, and their _many variants
  • batch_interpolate_3d.f90: Added !$acc routine seq to evaluate_batch_splines_3d_der, evaluate_batch_splines_3d_der2, and their _many/_core variants
  • canonical_coordinates_mod.f90: Added !$acc declare for module variables (nper, torflux, icounter, rnegflag)

Purpose

These changes allow SIMPLE particle tracing to run on GPU via OpenACC with GCC 16 + nvptx offload. The !$acc routine seq directive marks routines for sequential execution within GPU kernels, while !$acc declare makes module variables available on device.

Notes

  • The directives are comments when OpenACC is disabled, so no impact on non-OpenACC builds
  • Companion SIMPLE PR required: itpplasma/SIMPLE#xxx

Add !$acc routine seq to batch spline evaluation functions so they can
be called from within GPU kernels:

- batch_interpolate_1d.f90: evaluate_batch_splines_1d_der2/der3 and _many variants
- batch_interpolate_3d.f90: evaluate_batch_splines_3d_der/der2 and _many/_core variants
- canonical_coordinates_mod.f90: !$acc declare for nper, torflux, icounter, rnegflag

These changes enable SIMPLE particle tracing to run on GPU via OpenACC.
The combination of !$omp threadprivate and !$acc declare on the same
variable triggers an internal compiler error in GCC 16. Additionally,
OpenMP threadprivate and OpenACC device memory are fundamentally
incompatible - threadprivate gives each thread its own copy, while
OpenACC puts data in shared device memory.

The module variables (rnegflag, icounter, nper, torflux) are now
handled via explicit data management in SIMPLE's initialization
routines instead of module-level declarations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant