home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / fortran / 5226 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.2 KB  |  39 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!ukma!cs.widener.edu!eff!news.oc.com!convex!joelw
  3. From: joelw@convex.com (Joel Williamson)
  4. Subject: Re: loop reduction problem on Silicon Graphics
  5. Sender: usenet@news.eng.convex.com (news access account)
  6. Message-ID: <1993Jan28.174523.27370@news.eng.convex.com>
  7. Date: Thu, 28 Jan 1993 17:45:23 GMT
  8. References: <1993Jan28.112542@ltssun8.epfl.ch>
  9. Nntp-Posting-Host: mozart.convex.com
  10. Organization: Engineering, CONVEX Computer Corp., Richardson, Tx., USA
  11. X-Disclaimer: This message was written by a user at CONVEX Computer
  12.               Corp. The opinions expressed are those of the user and
  13.               not necessarily those of CONVEX.
  14. Lines: 23
  15.  
  16. In article <1993Jan28.112542@ltssun8.epfl.ch> dubuf@ltssun7.epfl.ch (Hans du Buf) writes:
  17. >
  18. >I want to apply the same procedure in getting e.g. the maximum value in an array:
  19. >
  20. >       rmax=-1.0                                     !assume a(i) >= 0
  21. >C$DOACROSS SHARE(a),LOCAL(i),REDUCTION(rmax)
  22. >       do 10 i=1,1000
  23. >       if (a(i).gt.rmax) rmax=a(i)
  24. >10   continue
  25. >
  26.  
  27. Regardless of whether it parallelizes, you'll get better performance
  28. with
  29.  
  30.        do 10 i=1,1000
  31.          rmax = max (a(i), rmax)
  32. 10   continue
  33.  
  34. and it just might parallelize as well.
  35.  
  36. Joel Williamson
  37. -- 
  38.  
  39.