id summary reporter owner description type status priority milestone component version severity resolution keywords cc 1266 AMM12, ifort and -O3 optimization issue jchanut nemo "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 " Defect closed low OCE v3.6 fixed