Re: forall and do loop
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Thu, 26 Jul 2007 23:39:28 -0800
aeroguy wrote:
REAL :: DS(100),UTA(100),STA(100),ONE
ONE = 1.0000
! First case
DO I=1,NE
UTA(I)=DS(I)
STA(I)=ONE
END DO
! second case
FORALL(I=1:NE) UTA(I)=DS(I)
STA=ONE
In this two follwoing code which will be more efficient? Efficent in
execution time and in parallel processing?
It is really hard to say. As far as I know, FORALL was added to help
with some parallel processing problems, maybe especially on vector
machines, but I don't know of any examples where it is actually
much better than the DO case.
My personal feeling is that array operations (your STA=ONE)
are often faster for simple expressions and often slower for
more complex expressions, but that is likely also compiler dependent.
-- glen
.
- Follow-Ups:
- Re: forall and do loop
- From: aeroguy
- Re: forall and do loop
- References:
- forall and do loop
- From: aeroguy
- forall and do loop
- Prev by Date: Re: forall and do loop
- Next by Date: Re: simplest way to sort a bi-dimensional array? mat(a,b)...
- Previous by thread: Re: forall and do loop
- Next by thread: Re: forall and do loop
- Index(es):