Skip to content

Commit

Permalink
Attempt to fix issues with the integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sergisiso committed Feb 4, 2025
1 parent e47227a commit 0ae7738
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/nemo_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ jobs:
. .runner_venv/bin/activate
export PSYCLONE_NEMO_DIR=${GITHUB_WORKSPACE}/examples/nemo/scripts
export NEMO_DIR=${HOME}/NEMO
export NEMOV4=1 # Enables specific NEMOV4 exclusions in the PSyclone transformation script
cd $PSYCLONE_NEMO_DIR
module load nvidia-hpcsdk/${NVFORTRAN_VERSION}
module load hdf5/${HDF5_VERSION} netcdf_c/${NETCDF_C_VERSION} netcdf_fortran/${NETCDF_FORTRAN_VERSION}
Expand Down Expand Up @@ -198,6 +199,7 @@ jobs:
module load oneapi/${ONEAPI_VERSION}
module load hdf5/${HDF5_VERSION} netcdf_c/${NETCDF_C_VERSION} netcdf_fortran/${NETCDF_FORTRAN_VERSION}
module load perl/${PERL_VERSION}
export NEMOV4=1 # Enables specific NEMOV4 exclusions in the PSyclone transformation script
export PSYCLONE_NEMO_DIR=${GITHUB_WORKSPACE}/examples/nemo/scripts
export NEMO_DIR=${HOME}/NEMOGCM_V40
export COMPILER_ARCH=linux_intel
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/nemo_v5_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ jobs:
# Clean up and compile
./makenemo -r BENCH -m linux_spack -n ${TEST_DIR} clean -y
export NEMOV5=1 # Enables specific NEMOV5 optimisations in the PSyclone transformation script
./makenemo -r BENCH -m linux_spack -n ${TEST_DIR} -p ${PSYCLONE_NEMO_DIR}/omp_cpu_trans.py \
add_key "key_nosignedzero" -j 4 -v 1
Expand Down
6 changes: 3 additions & 3 deletions examples/nemo/scripts/omp_cpu_trans.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
RESOLVE_IMPORTS = NEMO_MODULES_TO_IMPORT

# A environment variable can inform if this is targeting NEMOv5, in which case
# array privatisation is enabled.
NEMOV5 = os.environ.get('NEMOV5', False)
# array privatisation is disabled.
NEMOV4 = os.environ.get('NEMOV4', False)

# List of all files that psyclone will skip processing
FILES_TO_SKIP = PASSTHROUGH_ISSUES
Expand Down Expand Up @@ -98,5 +98,5 @@ def trans(psyir):
region_directive_trans=omp_parallel_trans,
loop_directive_trans=omp_loop_trans,
collapse=False,
privatise_arrays=NEMOV5 and psyir.name != "ldftra.f90",
privatise_arrays=not NEMOV4,
)
25 changes: 23 additions & 2 deletions examples/nemo/scripts/omp_gpu_trans.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
''' PSyclone transformation script showing the introduction of OpenMP for GPU
directives into Nemo code. '''

# import os
import os
from utils import (
insert_explicit_loop_parallelism, normalise_loops, add_profiling,
enhance_tree_information, PASSTHROUGH_ISSUES, PARALLELISATION_ISSUES,
Expand Down Expand Up @@ -97,6 +97,23 @@
"ldftra.f90", # Wrong runtime results
]

# A environment variable can inform if this is targeting NEMOv4, in which case
# array privatisation is disabled and some more files excluded
NEMOV4 = os.environ.get('NEMOV4', False)

NEMOV4_EXCLUSIONS = [
"domvvl.f90",
"domzgr.f90",
"dtatsd.f90",
"dynnxt.f90",
"sbcisf.f90",
"sshwzv.f90",
"step.f90",
"zdfmxl.f90",
"traadv_fct.f90",
"traadv.f90",
]


def trans(psyir):
''' Add OpenMP Target and Loop directives to all loops, including the
Expand All @@ -123,6 +140,9 @@ def trans(psyir):
if psyir.name in SKIP_FOR_PERFORMANCE:
return

if NEMOV4 and psyir.name in NEMOV4_EXCLUSIONS:
return

# ICE routines do not perform well on GPU, so we skip them
if psyir.name.startswith("ice"):
return
Expand Down Expand Up @@ -209,5 +229,6 @@ def trans(psyir):
insert_explicit_loop_parallelism(
subroutine,
loop_directive_trans=omp_cpu_loop_trans,
privatise_arrays=(psyir.name not in PRIVATISATION_ISSUES)
privatise_arrays=(not NEMOV4 and
psyir.name not in PRIVATISATION_ISSUES)
)

0 comments on commit 0ae7738

Please sign in to comment.