JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for COMP-FORTRAN-90 Archives


COMP-FORTRAN-90 Archives

COMP-FORTRAN-90 Archives


COMP-FORTRAN-90@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

COMP-FORTRAN-90 Home

COMP-FORTRAN-90 Home

COMP-FORTRAN-90  1997

COMP-FORTRAN-90 1997

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

F90 arrays, pointers, allocatables, BLAS and DO loops

From:

Swietanowski Artur <[log in to unmask]>

Reply-To:

Swietanowski Artur <[log in to unmask]>

Date:

Sun, 02 Nov 1997 20:07:50 +0100

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (79 lines)

Dear All,

This subject appears on the list with some regularity. I didn't 
include this posting in one of the more recent threads because ask 
a question here and I really would be happy to get some answers.

The subject in two sentences:
  What is the best way to write array operations in F90:
  - use intrinsic operators and precedures?
  - use BLAS, esp. compueter vendor optimized BLAS?
  - write good old DO loops?

  How does the answer to the above depend on the way the array was 
  created?

As I'm quite curious about this for some time, I wrote a short 
program which compares array operations with some BLAS level 1 
procedures. The operands are all the same size (~8 times larger 
than my cache) but created in different ways: static definition, 
allocatable and pointer.

I used Sun Performance Library BLAS and Sun f90 compiler with 
'-fast' optimization option.

These are the timing results (averaged over ~100 repetitions):

Operation|            BLAS          |            Array         |
         |  Static|   Alloc| Pointer|  Static|   Alloc| Pointer|
 COPY / =|  0.1286|  0.1335|  0.6910|  0.1280|  0.1331|  0.2851|
 Dot prod|  0.0861|  0.0943|  0.6516|  0.0952|  0.1000|  0.1054|
 AXPY/=*+|  0.1273|  0.1400|  0.6906|  0.1300|  0.1362|  0.3646|
 SCAL/=* |  0.0881|  0.0889|  0.3647|  0.0896|  0.0945|  0.0940|
 ASUM/.. |  0.1308|  0.1326|  0.4099|  0.3483|  0.3666|  0.3755|

The operations are BLAS procedures DCOPY, DDOT, etc. The array 
operations are simple array expresions doing exactly the same 
thing. If anyone's interested, I may post the program.

Judging by the stability of these results in the last repetitions, 
I'd say the table is accurate in all but the last digit. So BLAS 
DDOT *is* more efficient than intrinsic DOT_PRODUCT for static and 
allocatable arrays.

All arrays are contiguous. All are passed as a whole (no sections, 
esp. irregular). I see no reason for such a huge difference between 
allocatable arrays and pointers.

The most important (I think) observations to make are:
1) static arrays are better than allocatables which in turn 
   are better than pointers,
2) BLAS operations on pointers incur huge penalty in all cases,
3) array operations on pointers sometimes incur large penalty,
4) complex array operations (i.e., ones that cause creation of 
   a temporary) are more expensive than corresp. BLAS, if 
   the arguments are not pointers.

Could someone explain me why this table looks like this? Does it 
have to be so bad for BLAS/pointers?

My guess so far is the following:
- when pointer arguments are passed to BLAS routines (declared with 
  assumed size argments), they are copied on entry and exit.
- unnecessary creation of temporaries slows down calculation of some 
  array expressions.

And what about DO loops? I didn't experiment yet. Any advice?

Regards,
Artur Swietanowski
----------------------------------------------------------------------
Artur Swietanowski                mailto:[log in to unmask]
Institut fuer Statistik,  Operations Research und Computerverfahren,
Universitaet Wien,  Universitaetsstr. 5,  A-1010 Wien,  Austria
tel. +43 (1) 407 63 55 - 120      fax  +43 (1) 406 41 59
----------------------------------------------------------------------


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

December 2023
February 2023
November 2022
September 2022
February 2022
January 2022
June 2021
November 2020
September 2020
June 2020
May 2020
April 2020
December 2019
October 2019
September 2019
March 2019
February 2019
January 2019
November 2018
October 2018
September 2018
August 2018
July 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
December 2015
November 2015
October 2015
September 2015
August 2015
June 2015
April 2015
March 2015
January 2015
December 2014
November 2014
October 2014
August 2014
July 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
July 2013
June 2013
May 2013
April 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
August 2010
July 2010
June 2010
March 2010
February 2010
January 2010
December 2009
October 2009
August 2009
July 2009
June 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
January 2007
2006
2005
2004
2003
2002
2001
2000
1999
1998
1997


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager