[fortran PATCH] Implement a(:,:) = 0.0 using memset

Daniel Franke franke.daniel@gmail.com
Mon Dec 18 18:14:00 GMT 2006


On Monday 18 December 2006 18:54, roger@eyesopen.com wrote:
> Hi Tobi,
>
> > Does this work for strided arrays?  Say
> > program t
> >   real :: arr(4)
> >   call a(arr(1:4:2))
> >   print *, arr
> > contains
> > subroutine a(b)
> >    real :: b(:)
> >    b(:) = 0
> > end subroutine
> > end program
>
> It works in the sense that it knows to leave the assignment of "b(:)"
> alone and not use memset.  In theory, it should be possible to inspect
> the array descriptor at run-time and determine whether the array sections
> are sequential, but currently if the array reference requires an array
> descriptor, this optimization is skipped.  This may be too conservative
> for some common codes?  It'd be nice to have some statistics.


Roger,
a recent code piece of mine spent way to much time initializing
  LOGICAL :: array(n)   ! n "large"
  array(:) = .FALSE.

Is it possible to use memset for this also?

Regards
	Daniel



More information about the Fortran mailing list