For Programmers: Free Programming Magazines  


Home > Archive > Fortran > June 2005 > where vs. forall in f95









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author where vs. forall in f95
Ushnish Basu

2005-06-10, 4:00 am

Hi,

Suppose I have to do the following array operation:

d = b/a + c

under certain conditions on the elements, but for very large sized arrays. Is
it better to do it using 'where' or 'forall'?

In other words, I know that 'forall' can be parallelised, but can 'where' also
be parallelised?

Are there any other pros or cons to using either, when both can be used?

Thanks,

Ushnish

--
Ushnish Basu ubasu@ce.berkeley.edu
+1 510 644-1906 www.ce.berkeley.edu/~ubasu
robert.corbett@sun.com

2005-06-10, 4:00 am

Based on your description, WHERE would seem the
better choice. FORALL would be better if you were
doing something fancy with subscripts.

WHERE, FORALL, and carefully written DO loops are
all equally likely (or unlikely) to paralllelize using a
modern compiler. I know many compilers that scalarize
first, then parallelize.

Bob Corbett

glen herrmannsfeldt

2005-06-10, 4:00 pm

robert.corbett@sun.com wrote:

> Based on your description, WHERE would seem the
> better choice. FORALL would be better if you were
> doing something fancy with subscripts.


> WHERE, FORALL, and carefully written DO loops are
> all equally likely (or unlikely) to paralllelize using a
> modern compiler. I know many compilers that scalarize
> first, then parallelize.


I always thought FORALL was to help vector processors like
the CRAY-1 parallelize array operations. The CRAY-1 has
vector registers 64 elements (of 64 bit floating point) long.
(That is single precision for CRAY.)

It seems that now people are calling the Intel SSE vectorizing
when the registers are two elements long. Technically a
vector, but I don't believe Cray would have been convinced.

-- glen

Tim Prince

2005-06-10, 4:00 pm


"glen herrmannsfeldt" <gah@ugcs.caltech.edu> wrote in message
news:xN2dnV7z6pWLNzTfRVn-uA@comcast.com...
> robert.corbett@sun.com wrote:
>
>
>
> I always thought FORALL was to help vector processors like
> the CRAY-1 parallelize array operations. The CRAY-1 has
> vector registers 64 elements (of 64 bit floating point) long.
> (That is single precision for CRAY.)
>
> It seems that now people are calling the Intel SSE vectorizing
> when the registers are two elements long. Technically a
> vector, but I don't believe Cray would have been convinced.

It compiles like vector, with the effect of an 8 element vector register,
even though the physical registers are 2 or 4 elements. At least 3 other
compiler families do the same thing, and use similar terminology.


robert.corbett@sun.com

2005-06-11, 3:57 am

> I always thought FORALL was to help vector
> processors like the CRAY-1 parallelize array
> operations. The CRAY-1 has vector registers
> 64 elements (of 64 bit floating point) long.


Perhaps FORALL statements and constructs help
them parallelize, but they would not help them
vectorize. FORALLs let users do funny things with
subscripts, which does not help vectorization.

Bob Corbett

glen herrmannsfeldt

2005-06-11, 3:57 am

robert.corbett@sun.com wrote:
[color=darkred]
> Perhaps FORALL statements and constructs help
> them parallelize, but they would not help them
> vectorize. FORALLs let users do funny things with
> subscripts, which does not help vectorization.


FORALL does have some restrictions, though I agree they
are not the ones that I would put in for vectorizing.

-- glen

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com