Array too small?

Open Beginner friendly
#8 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
fortran
Domain
hpc

Research direction

Open mmf-mpdata-tracer/advect_scalar2D_pushncols_openacc.F90 at the referenced declaration and loop. Compare www's declared bounds with the i range used in the k == 1 branch, then inspect nearby indexing assumptions. Done means the array covers every accessed index without out-of-bounds behavior and the kernel's existing validation passes.

Written by the indexing model from the issue text.

Description

https://github.com/E3SM-Project/codesign-kernels/blob/e994a3b8de9793d1f2b170d5730e90645f63aa7d/mmf-mpdata-tracer/advect_scalar2D_pushncols_openacc.F90#L126

real(rp) :: www (nslices,-1:nxp2,1,nz) where nxp2 is nx + 2 while nxp3 is nx + 3.

if (k == 1) www(sl,i,j,nz) = 0. where do i=-1,nxp3.

IMO the www array is too small, it will fail randomly, likely it will not fail when compiled with gfortran, but this is only matter of luck, and well written programs should not rely on luck.

Dominant language
Fortran
Stars
4
Forks
3
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from E3SM-Project/codesign-kernels

All issues in E3SM-Project/codesign-kernels

Similar issues

More HPC issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.