🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.fortran
Article #4533

Re: loop reduction problem on Silicon Graphics

#4533
From: Joel Williamson
Date: Thu, 28 Jan 1993 17:45
22 lines
1309 bytes
In article <1993Jan28.112542@ltssun8.epfl.ch> dubuf@ltssun7.epfl.ch (Hans du Buf) writes:
>
>I want to apply the same procedure in getting e.g. the maximum value in an array:
>
>       rmax=-1.0                                     !assume a(i) >= 0
>C$DOACROSS SHARE(a),LOCAL(i),REDUCTION(rmax)
>       do 10 i=1,1000
>       if (a(i).gt.rmax) rmax=a(i)
>10   continue
>

Regardless of whether it parallelizes, you'll get better performance
with

       do 10 i=1,1000
         rmax = max (a(i), rmax)
10   continue

and it just might parallelize as well.

Joel Williamson
-- 
Technical Details
Message-ID: <1993Jan28.174523.27370@news.eng.convex.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!ukma!cs.widener.edu!eff!news.oc.com!convex!joelw
References: <1993Jan28.112542@ltssun8.epfl.ch>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.fortran
Path: arc1-ca.pugleaf.net!sparky!uunet!ukma!cs.widener.edu!eff!news.oc.com!convex!joelw
From: joelw@convex.com (Joel Williamson)
Subject: Re: loop reduction problem on Silicon Graphics
Sender: usenet@news.eng.convex.com (news access account)
Message-ID: <1993Jan28.174523.27370@news.eng.convex.com>
Date: Thu, 28 Jan 1993 17:45:23 GMT
References: <1993Jan28.112542@ltssun8.epfl.ch>
Nntp-Posting-Host: mozart.convex.com
Organization: Engineering, CONVEX Computer Corp., Richardson, Tx., USA
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.
Lines: 23