fortran - allocatable function parameters and automatic vectorization -


can sb. explain difference between passing pointer , allocatable subroutine parameters in fortran? not understand why following function not vectorize in gfortran 7.2:

subroutine test0(fsm, im) implicit none real, dimension(:), pointer :: fsm integer, intent(in) :: im integer  = 1,im    fsm(i) = fsm(i)*2 end end subroutine test0 

while vectorize (just in c) if use allocatable attribute dummy fsm argument. compile using following command line

gfortran -mavx -o3 -ftree-vectorize -c loops.f90 -fopt-info-vec-note 

when using pointer gfortran reports higher vectorization cost. there important difference in how arguments passed (e.g., indirection, pointer pointer vs. passing value), or gfortran problem?

a compiler may able better optimize when object contiguous. vectorization here may, example, limited case object known contiguous @ compilation.

an array allocated allocate statement contiguous. dummy argument pointer array need not contiguous. here seems difference observed.

however, array pointer may given contiguous attribute. such array contiguous. restriction on pointer may pointer associated contiguous target.

similar experience may had assumed-shape arrays. explicit shape arrays contiguous.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -