Arrays are dimensioned as array(npts,nz) which means that the npts dimension varies fastest. So it is more efficient to access elements 1 level at a time, eg:
do k = 1, nz
do n = 1, npts
array(n,k)
end do
end do
However in KPP, we actually access data the other way around, as the physics code operates on one grid point at a time. So it would be much more efficient if the levels were contiguous in memory, and the arrays dimensioned as array(nz,npts).
This would also make the MPI parallelisation easier, as we would be parallelising over the outer dimension.
For 3d arrays the position of the extra dimension depends on the access patterns - so I need to check this.
Arrays are dimensioned as
array(npts,nz)
which means that thenpts
dimension varies fastest. So it is more efficient to access elements 1 level at a time, eg:However in KPP, we actually access data the other way around, as the physics code operates on one grid point at a time. So it would be much more efficient if the levels were contiguous in memory, and the arrays dimensioned as
array(nz,npts)
.This would also make the MPI parallelisation easier, as we would be parallelising over the outer dimension.
For 3d arrays the position of the extra dimension depends on the access patterns - so I need to check this.