Google Groups Home
Help | Sign in
module or interface
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Klemens  
View profile
 More options May 5, 2:48 am
Newsgroups: comp.lang.fortran
From: Klemens <jokulhl...@web.de>
Date: Sun, 4 May 2008 23:48:57 -0700 (PDT)
Local: Mon, May 5 2008 2:48 am
Subject: module or interface
Hi all,

trying to speed up a  f90 program I was thinking about the difference
if I put my subroutines in a module or if I define an interface. Will
there be any differences in speed for these two approaches ?

Thanks for your help in advance !

Klemens


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Maine  
View profile
 More options May 5, 3:00 am
Newsgroups: comp.lang.fortran
From: nos...@see.signature (Richard Maine)
Date: Mon, 5 May 2008 00:00:46 -0700
Local: Mon, May 5 2008 3:00 am
Subject: Re: module or interface

Klemens <jokulhl...@web.de> wrote:
> trying to speed up a  f90 program I was thinking about the difference
> if I put my subroutines in a module or if I define an interface. Will
> there be any differences in speed for these two approaches ?

No.

Except for the speed of development. Writing interface bodies is
error-prone and thus likely to slow down code development.

Well, ok, that is certainly an overgeneralization, as some are likely to
point out. But I felt I should say more than the one-word answer "no". I
can't really think of any useful elaboration on that other than that it
isn't likely to be a constructive avenue to pursue.

About the closest thing I can think of is the issue of copy-in/copy-out
for array arguments. That doesn't have anything directly to do with
using modules versus interface bodies. But it is at least vaguely
related to the subject of explicit interfaces.

--
Richard Maine                    | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle           |  -- Mark Twain


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Klemens  
View profile
 More options May 5, 3:09 am
Newsgroups: comp.lang.fortran
From: Klemens <jokulhl...@web.de>
Date: Mon, 5 May 2008 00:09:38 -0700 (PDT)
Local: Mon, May 5 2008 3:09 am
Subject: Re: module or interface
Hi Richard,

thanks for your quick response !
So I will not waste any time for changing from interfaces to a module.

Cheers,

Klemens


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Arjen Markus  
View profile
 More options May 5, 3:21 am
Newsgroups: comp.lang.fortran
From: Arjen Markus <arjen.mar...@wldelft.nl>
Date: Mon, 5 May 2008 00:21:53 -0700 (PDT)
Local: Mon, May 5 2008 3:21 am
Subject: Re: module or interface
On 5 mei, 09:09, Klemens <jokulhl...@web.de> wrote:

> Hi Richard,

> thanks for your quick response !
> So I will not waste any time for changing from interfaces to a module.

> Cheers,

> Klemens

Maintaining routines in a module means that the interface
is maintained in a single place only!

The advantage is that changes to the interface of these
routines are automatically known to the compiler.

If you have interface blocks in the calling routines, there
will still be a possibility for mismatches.

Consider:

subroutine suba( x )
    real :: x
    ...
end subroutine

and:

program test_suba
    interface
        subroutine suba( x, y )
            real :: x, y
        end subroutine
    end interface

    call suba( x, y )
end program

There is no "intrinsic" relationship between the
implementation of the routine and the interface block.

If however:

module moda
contains
subroutine suba( x )
    real :: x
    ...
end subroutine
end module

and:

program test_suba
    use moda

    call suba( x, y )
end program

the compiler can "see" the mismatch.

It is up to you, but I think modules are preferrable.

Regards,

Arjen


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Klemens  
View profile
 More options May 5, 3:48 am
Newsgroups: comp.lang.fortran
From: Klemens <jokulhl...@web.de>
Date: Mon, 5 May 2008 00:48:31 -0700 (PDT)
Local: Mon, May 5 2008 3:48 am
Subject: Re: module or interface
Hi Arjen,

thanks for your explanations ! They help to improve my knowledge of
Fortran.

Regards,

Klemens


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rudra  
View profile
 More options May 5, 1:26 pm
Newsgroups: comp.lang.fortran
From: rudra <bnrj.ru...@gmail.com>
Date: Mon, 5 May 2008 10:26:44 -0700 (PDT)
Local: Mon, May 5 2008 1:26 pm
Subject: Re: module or interface
Certainly this explanation is very helpful
thnx

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google