Community
cancel
Showing results for
Did you mean:
Beginner
208 Views

## reference has unaligned access

```The vectorization support outpt for the following loops:

DO K = 1, NZ
DO J = 1, NY
DO I = 1, NX

SLICE_BACK =  GRID(I-1,J-1,K-1) + GRID(I-1,J,K-1) + GRID(I-1,J+1,K-1) + &
GRID(I  ,J-1,K-1) + GRID(I  ,J,K-1) + GRID(I  ,J+1,K-1) + &
GRID(I+1,J-1,K-1) + GRID(I+1,J,K-1) + GRID(I+1,J+1,K-1)

SLICE_MINE =  GRID(I-1,J-1,K)   + GRID(I-1,J,K)   + GRID(I-1,J+1,K) + &
GRID(I  ,J-1,K)   + GRID(I  ,J,K)   + GRID(I  ,J+1,K) + &
GRID(I+1,J-1,K)   + GRID(I+1,J,K)   + GRID(I+1,J+1,K)

SLICE_FRONT = GRID(I-1,J-1,K+1) + GRID(I-1,J,K+1) + GRID(I-1,J+1,K+1) + &
GRID(I  ,J-1,K+1) + GRID(I  ,J,K+1) + GRID(I  ,J+1,K+1) + &
GRID(I+1,J-1,K+1) + GRID(I+1,J,K+1) + GRID(I+1,J+1,K+1)

WORK(I,J,K) = ( SLICE_BACK + SLICE_MINE + SLICE_FRONT ) / 27.0

END DO
END DO
END DO

DO K = 1, NZ
DO J = 1, NY
DO I = 1, NX
GRID(I,J,K) = WORK(I,J,K)
END DO
END DO
END DO
```

reports the following reference unaligned accesses.

```remark #15389: vectorization support: reference grid(i,j-1,k+1) has unaligned access
remark #15389: vectorization support: reference grid(i,j,k+1) has unaligned access
remark #15389: vectorization support: reference grid(i,j+1,k+1) has unaligned access
remark #15389: vectorization support: reference grid(i+1,j-1,k+1) has unaligned access
remark #15389: vectorization support: reference grid(i+1,j,k+1) has unaligned access
remark #15389: vectorization support: reference grid(i+1,j+1,k+1) has unaligned access

....```
```remark #15389: vectorization support: reference grid(i,j,k) has unaligned access
remark #15389: vectorization support: reference work_(i,j,k) has unaligned access   ```

I think I could understand the i+/i1, j+/-i and k+/-1 index access to grid, however, I can't understand why grid has unaligned access in grid(i,j,k) or work(i,j,k) even though grid has been declared aligned

```!DEC\$ ATTRIBUTES ALIGN: 32 :: GRID1,  GRID2,  GRID3,  GRID4,  GRID5,  GRID6,  GRID7,  GRID8,    & !
GRID9,  GRID10, GRID11, GRID12, GRID13, GRID14, GRID15, GRID16, GRID17, GRID18, GRID19,      & !
GRID20, GRID21, GRID22, GRID23, GRID24, GRID25, GRID26, GRID27, GRID28, GRID29, GRID30,      & !
GRID31, GRID32, GRID33, GRID34, GRID35, GRID36, GRID37, GRID38, GRID39, GRID40, WORK
```

1) Does it mean that GRID has not been aligned?

2) How can I make GRID and WORK access aligned so I can improve performance vectorization??