Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Global array operations: a performance hit?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dennis Wassel  
View profile  
 More options Jun 19 2008, 4:16 am
Newsgroups: comp.lang.fortran
From: Dennis Wassel <dennis.was...@googlemail.com>
Date: Thu, 19 Jun 2008 01:16:34 -0700 (PDT)
Local: Thurs, Jun 19 2008 4:16 am
Subject: Re: Global array operations: a performance hit?
On 19 Jun., 00:00, glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote:

> Dennis Wassel wrote:

> (snip)

> > Is (compiler) optimisation of array operations that much of a
> > nontrivial task or just something that nobody has come around to
> > doing, yet? Judging from their mailing list, gfortran seems to have
> > many construction sites and a number of them apparently with higher
> > priorities.

> If you do exactly the same thing in both cases, the compiler
> should do pretty well, except in cases that modify the source array.
> There are cases where you know that no array elements are used
> after they are modified (using DO loops), but the compiler doesn't
> (using array expressions).

> Using vector subscripts as an example, say you have arrays X and Y,
> both dimensioned N, where X has a permutation of the numbers from
> 1 to N.

>        DO I=1,N
>           Y(I)=Y(X(I))
>        ENDDO

*Errrrrm*
Am I getting something wrong? This won't work, consider for instance X
= (2 1).
Except for the special case X(I) >= I \forall I, this will produce
garbage (and for permutations, that special case is only satisfied by
the identity).
Point is, I'm fairly sure you need temporaries here as well.
> reorders Y based on the permutation, where you know that
> the values in X are unique.

>        Y=Y(X)
> does it using vector subscripts, but the compiler does not
> know that the values are unique, so a temporary array is
> needed.  If you read in X from a file, there is no way
> that the compiler could possibly know the values are unique.
> If you generated X directly, it is unlikely that even the
> best optimizer would figure it out.

> -- glen


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.