PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Performance of assumed shape arrays in Fortran

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Performance and Benchmarking
View previous topic :: View next topic  
Author Message
gabo



Joined: 28 Jul 2006
Posts: 2

PostPosted: Thu Jul 08, 2010 2:12 pm    Post subject: Performance of assumed shape arrays in Fortran Reply with quote

Hi:

I'am coding a series of performance critical routines in Fortran 90
(pgf90 and mpif90), which were previously coded in Fortran 77. Basically
it is mostly loop and artimetic stuff with arrays.

In the original Fortran 77 we used only explicit shape, one dimensional
arrays like X(1:n).

In the new version we would like to use two-dimensional arrays of
basically two 'types' : Y(1:3,1:n) and Z(1:1,1:n).

( That is because we want Y(1,j) Y(2,j) and Y(3,j) to be
contiguous in memory instead of having three separate
arrays Y1(1:n), Y2(1:n), Y3(1:n) )

The routines we are dealing with, would need to be called with either
Y or Z arrays as actual arguments, so we were planing to use assumed shape
dummy arguments like W(:,:).

Alternatively, we can code two different sets of routines, one set for
Y arrays (which have first dimension of size 3) and another set of
routines for Z arrays (which have first dimension of size 1). As stated
above performance is critical in these routines.

A few questions about expected performance:

1) In the best case scenario, would the performance using
assumed shape dummy argument arrays, match the performance
of using two sets of routines with explicit shape dummy arguments ?

2) Will PGI shape propagation feature work OK for
a routine which is called with two different
shapes of the actual argument ( for example
a million times with shape (1:3,1:n) and another
two million times with shape (1:1,1:n) )

3) Any sugestions .... ?

Thanks, Gabriel
Back to top
View user's profile
gabo



Joined: 28 Jul 2006
Posts: 2

PostPosted: Thu Jul 08, 2010 2:23 pm    Post subject: One more question related to the previous post Reply with quote

....Hi, one more question considering that we are also
planing to use MPI within these routines:

4) Is there a compiler switch to prevent the pgf90 compiler from
making copies of arguments (specially assumed-shape arrays),
in either the calling or called procedure ? (i.e. to force it to
pass the argument by reference ?)

Thanks again, G.
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5952
Location: The Portland Group Inc.

PostPosted: Mon Jul 12, 2010 5:37 pm    Post subject: Reply with quote

Hi G.

Quote:
1) In the best case scenario, would the performance using
assumed shape dummy argument arrays, match the performance
of using two sets of routines with explicit shape dummy arguments ?
In the best case, yes (almost). The only extra overhead would be passing in an extra argument for the array descriptor. Note that the "best case" is when you pass in the full array "call foo(a)".

Quote:
2) Will PGI shape propagation feature work OK for
a routine which is called with two different
shapes of the actual argument ( for example
a million times with shape (1:3,1:n) and another
two million times with shape (1:1,1:n) )
Sure.

Quote:
4) Is there a compiler switch to prevent the pgf90 compiler from
making copies of arguments (specially assumed-shape arrays),
in either the calling or called procedure ? (i.e. to force it to
pass the argument by reference ?)
No but a copy is only made if the array section you're passing is non-contiguous..

Quote:
3) Any sugestions .... ?

Avoid passing in non-contiguous array sections and you should be fine.

Hope this helps,
Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Performance and Benchmarking All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group