Skip to content

Add Kokos implementation of SWM#29

Open
sjsprecious wants to merge 24 commits intomainfrom
js_kokkos
Open

Add Kokos implementation of SWM#29
sjsprecious wants to merge 24 commits intomainfrom
js_kokkos

Conversation

@sjsprecious
Copy link
Collaborator

This pull request introduces the multiple implementations of Kokkos based SWM (e.g., different policies, Kokkos+OpenACC).

All the CPU and GPU answers are verified against the C serial version.

It also includes some util python scripts for verification check and visualization.

@sjsprecious sjsprecious self-assigned this Dec 5, 2025
@sjsprecious sjsprecious added the enhancement New feature or request label Dec 5, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds multiple Kokkos-based implementations of the Shallow Water Model (SWM), including various execution policies (TeamPolicy, RangePolicy, MDRangePolicy) and a hybrid Kokkos+OpenACC+Fortran version. The implementations have been verified against the C serial version for both CPU and GPU execution. Supporting utilities for verification and performance visualization are also included.

Key Changes:

  • Implementation of four distinct Kokkos policy variations for performance comparison
  • Hybrid Kokkos+Fortran+OpenACC implementation demonstrating interoperability
  • Python utilities for result validation and performance plotting
  • CMake integration for building Kokkos implementations

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
swm_kokkos/various_policy_impls/shallow_teampolicy.cpp TeamPolicy-based SWM implementation with hierarchical parallelism
swm_kokkos/various_policy_impls/shallow_rangepolicy_flat.cpp RangePolicy implementation using flattened index calculations
swm_kokkos/various_policy_impls/shallow_rangepolicy.cpp RangePolicy implementation with inner serial loops
swm_kokkos/various_policy_impls/shallow_mdrangepolicy.cpp MDRangePolicy implementation for multi-dimensional parallelism
swm_kokkos/utils/plot.py Performance visualization script for comparing implementations
swm_kokkos/utils/data/O2/kokkos_teampolicy.csv Benchmark data for TeamPolicy implementation
swm_kokkos/utils/data/O2/kokkos_rangepolicy.csv Benchmark data for RangePolicy implementation
swm_kokkos/utils/data/O2/kokkos_mdrangepolicy.csv Benchmark data for MDRangePolicy implementation
swm_kokkos/utils/comparison_results.sh Shell script for automated result verification
swm_kokkos/utils/comparison_results.py Python script for numerical comparison of outputs
swm_kokkos/kokkos_fortran_openacc/shallow_mdrangepolicy.cpp C++ wrapper for Kokkos+Fortran+OpenACC hybrid implementation
swm_kokkos/kokkos_fortran_openacc/shallow_fortran_acc.F90 Fortran module with OpenACC directives for time loop
swm_kokkos/CMakeLists.txt Build configuration for Kokkos implementations
CMakeLists.txt Top-level CMake configuration with SWM_KOKKOS option

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +12 to +13
path1="/glade/derecho/scratch/sunjian/SWM_KOKKOS_CUDA_BUILD/swm_c/c/"
path2="/glade/derecho/scratch/sunjian/SWM_KOKKOS_CUDA_BUILD/swm_kokkos/kokkos_fortran_openacc/"
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded absolute paths reduce script portability. Consider using relative paths or environment variables to make the script usable across different systems and user configurations.

Suggested change
path1="/glade/derecho/scratch/sunjian/SWM_KOKKOS_CUDA_BUILD/swm_c/c/"
path2="/glade/derecho/scratch/sunjian/SWM_KOKKOS_CUDA_BUILD/swm_kokkos/kokkos_fortran_openacc/"
# Use environment variables SWM_C_PATH and SWM_KOKKOS_PATH if set, otherwise use current directory as default
path1="${SWM_C_PATH:-./swm_c/c/}"
path2="${SWM_KOKKOS_PATH:-./swm_kokkos/kokkos_fortran_openacc/}"

Copilot uses AI. Check for mistakes.
sjsprecious and others added 4 commits December 5, 2025 11:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants