Skip to content

Commit

Permalink
Fix flake8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sergisiso committed Dec 13, 2024
1 parent 336e814 commit ee43ac9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
21 changes: 13 additions & 8 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 All @@ -55,26 +55,31 @@
"iom_nf90.f90",
"iom_def.f90",
"timing.f90", # Compiler error: Subscript, substring, or argument illegal
"lbcnfd.f90", # Illegal address during kernel execution - line 1012: lbc_nfd_dp
"lbcnfd.f90", # Illegal address during kernel execution
# - line 1012: lbc_nfd_dp
"lib_mpp.f90", # Compiler error: Illegal substring expression
"prtctl.f90", # Compiler error: Illegal substring expression
"sbcblk.f90", # Compiler error: Vector expression used where scalar
# expression required
]

OFFLOADING_ISSUES = [
"trcrad.f90", # Illegal address during kernel execution, unless the dimensions are small
"tranxt.f90", # String comparison not allowed inside omp teams (this worked fine with omp loop)
"trazdf.f90", # String comparison not allowed inside omp teams (this worked fine with omp loop)
"crsdom.f90", # String comparison not allowed inside omp teams (this worked fine with omp loop)
"zdftke.f90", # returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS): Illegal address during kernel execution
"dynzdf.f90", # returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS): Illegal address during kernel execution
"trcrad.f90", # Illegal address during kernel execution, unless the
# dimensions are small
"tranxt.f90", # String comparison not allowed inside omp teams
# (this worked fine with omp loop)
"trazdf.f90", # String comparison not allowed inside omp teams
"crsdom.f90", # String comparison not allowed inside omp teams
"zdftke.f90", # returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS):
# Illegal address during kernel execution
"dynzdf.f90", # returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS)
]

PRIVATISATION_ISSUES = [
"ldftra.f90", # Wrong runtime results
]


def trans(psyir):
''' Add OpenMP Target and Loop directives to all loops, including the
implicit ones, to parallelise the code and execute it in an acceleration
Expand Down
9 changes: 5 additions & 4 deletions examples/nemo/scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
'gamma_moist', 'gamma_moist_sclr', 'gamma_moist_vctr', 'get_unit',
'grt_cir_dis', 'grt_cir_dis_saa', 'icb_alloc', 'icb_utl_bilin',
'icb_utl_bilin_2d_h', 'icb_utl_bilin_3d_h', 'icb_utl_bilin_e',
'icb_utl_bilin_h', 'icb_utl_bilin_x',' icb_utl_count', 'icb_utl_heat',
'icb_utl_bilin_h', 'icb_utl_bilin_x', 'icb_utl_count', 'icb_utl_heat',
'icb_utl_mass', 'icb_utl_yearday', 'ice1D_alloc', 'ice_alloc',
'ice_dia_alloc', 'ice_dyn_rdgrft_alloc', 'ice_perm_eff',
'ice_thd_pnd_alloc', 'ice_update_alloc', 'ice_var_sshdyn', 'in_hdom',
Expand Down Expand Up @@ -227,9 +227,10 @@ def enhance_tree_information(schedule):
reference.symbol.name.startswith('glob_') or
reference.symbol.name.startswith('SIGN_') or
reference.symbol.name.startswith('netcdf_') or
(reference.symbol.name.startswith('nf90_') and not
reference.symbol.name in ['nf90_64bit_offset', 'nf90_short',
'nf90_clobber'])):
(reference.symbol.name.startswith('nf90_') and
reference.symbol.name not in ['nf90_64bit_offset',
'nf90_short',
'nf90_clobber'])):
if reference.symbol.is_import or reference.symbol.is_unresolved:
# The parser gets these wrong, they are Calls not ArrayRefs
if not isinstance(reference.symbol, RoutineSymbol):
Expand Down

0 comments on commit ee43ac9

Please sign in to comment.