Fortran contiguous variables

Fortran 2018 contiguous arrays are discussed in pp.139-145 of “Modern Fortran Explained: Incorporating Fortran 2018”. In general, operating on contiguous arrays is faster than non-contiguous arrays.

Contiguous variables happen by default, so unless using pointers or array striding, the variable is likely to be contiguous for simple Fortran code. Check contiguous status of a variable with is_contiguous intrinsic function.

A non-contiguous array actual argument into a contiguous subroutine dummy argument is made contiguous by copy-in, copy-out. This copy-in copy-out as needed is part of the Fortran 2008 and Fortran 2018 standard. GCC ≥ 9, Intel oneAPI, IBM Open XL Fortran, etc. work to Fortran 2008+ standard for contiguous dummy argument copy-in, copy-out for non-contiguous actual argument.

References: Fortran 2008 Contiguity