Re: MODULEand USE versus Argument Passing
- From: Herman D. Knoble <SkipKnobleLESS@xxxxxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 12:03:38 -0400
Thanks.
Adding aa call to an External (versus contained) subprogram, S3,
to your code, and making the Integer a,b,c ... be REAL*8,
and using Intel ifort 8.1 with no optimization (on an Athalon),
I got the following timings
Module 0.22
Containg Subprogram Arguments 0.22
External Subprogram Arguments 0.22999999999999993
Skip
On 29 Jun 2005 07:36:52 -0700, "Joost" <jv244@xxxxxxxxx> wrote:
-|I don't think you can see this independent of the architecture, the
-|compilers, the kind of arguments and so on and so forth. Just a simple
-|benchmark shows that in that specific case, passing 10 arguments is
-|actually faster (ia32, ifort):
-|
-|output:
-| Module 0.285956000000000
-| Arguments 0.250962000000000
-|
-|code:
-|MODULE M1
-| INTEGER :: a,b,c,d,e,f,g,h,i,j
-|CONTAINS
-| SUBROUTINE S1()
-| a=a*b*c*d*e*f*g*h*i*j
-| END SUBROUTINE S1
-| SUBROUTINE S2(a,b,c,d,e,f,g,h,i,j)
-| INTEGER :: a,b,c,d,e,f,g,h,i,j
-| a=a*b*c*d*e*f*g*h*i*j
-| END SUBROUTINE S2
-|END MODULE M1
-|
-|USE M1
-|INTEGER :: k
-|REAL*8 :: t1,t2,t3,t4
-|a=0 ; b=0 ; c=0 ; d=0 ; e=0 ; f=0;
-|g=0 ; h=0 ; i=0 ; j=0
-|CALL CPU_TIME(T1)
-|DO k=1,10000000
-| CALL S1()
-|ENDDO
-|CALL CPU_TIME(T2)
-|write(6,*) "Module ",T2-T1
-|CALL CPU_TIME(T1)
-|DO k=1,10000000
-| CALL S2(a,b,c,d,e,f,g,h,i,j)
-|ENDDO
-|CALL CPU_TIME(T2)
-|write(6,*) "Arguments ",T2-T1
-|END
-|
-|Cheers,
-|
-|Joost
.
- References:
- MODULEand USE versus Argument Passing
- From: Herman D . Knoble
- Re: MODULEand USE versus Argument Passing
- From: Joost
- MODULEand USE versus Argument Passing
- Prev by Date: Re: Argument of subroutine is an array of unfixed length.
- Next by Date: I have no ideas what can it be!
- Previous by thread: Re: MODULEand USE versus Argument Passing
- Next by thread: Re: MODULEand USE versus Argument Passing
- Index(es):
Relevant Pages
|
|