New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
#1266 (AMM12, ifort and -O3 optimization issue) – NEMO

Opened 10 years ago

Closed 10 years ago

#1266 closed Defect (fixed)

AMM12, ifort and -O3 optimization issue

Reported by: jchanut Owned by: nemo
Priority: low Milestone:
Component: OCE Version: v3.6
Severity: Keywords:
Cc:

Description

See also ticket #1254 ?

Confirmation/explanation from other people having experienced trouble with AMM12 and -O3 optimization levels with ifort would be greatly appreciated.

Looking carefully at what causes AMM12 to blow up when switching from -O2 to-O3 optimization level (ifort 12, 13 or 14), Mondher Chekki, found a weird behaviour in dynspg_ts module. The problem comes from the following loops:

      zu_frc(:,:) = 0._wp
      zv_frc(:,:) = 0._wp

      DO jk = 1, jpkm1
#if defined key_vectopt_loop
         DO jj = 1, 1         !Vector opt. => forced unrolling
            DO ji = 1, jpij
#else
         DO jj = 1, jpj
            DO ji = 1, jpi
#endif
               zu_frc(ji,jj) = zu_frc(ji,jj) + fse3u_n(ji,jj,jk) * ua(ji,jj,jk) * umask(ji,jj,jk)
               zv_frc(ji,jj) = zv_frc(ji,jj) + fse3v_n(ji,jj,jk) * va(ji,jj,jk) * vmask(ji,jj,jk)
            END DO
         END DO
      END DO

Writing this code block with 2d arrays (see below) solves the problem, in the sense that the model runs fine and produces identical results (as checked from the solver.stat file over a 2 days run) and whatever the optimization level is. It seems that the use of temporary pointers is the source of the problem, aggressive compiler optimization creating a kind of memory aliasing in that particular case.

Formulation that solves the pb:

      DO jk = 1, jpkm1
         zu_frc(:,:) = zu_frc(:,:) + fse3u_n(:,:,jk) * ua(:,:,jk) * umask(:,:,jk)
         zv_frc(:,:) = zv_frc(:,:) + fse3v_n(:,:,jk) * va(:,:,jk) * vmask(:,:,jk)
      END DO

Compiler options used:
-O3 -fp-model precise -traceback -r8 -convert big_endian -assume byterecl

Commit History (0)

(No commits)

Change History (1)

comment:1 Changed 10 years ago by jchanut

  • Resolution set to fixed
  • Status changed from new to closed

Changed in revision 4687

Note: See TracTickets for help on using tickets.