Subject: hpff-interpret: Re: hpff: TEMPLATE scoping

From: <[email-masked]> (Henry Zongaro)
Date: Mon, 30 Sep 1996 17:43:54 -0400 (EDT)

---------------------------------------------------------------------------
[email-masked] is a mailing list for corrections,
clarifications, and interpretations related to High Performance Fortran.
Instructions for adding or deleting yourself from this list appear at the
bottom of this message.
---------------------------------------------------------------------------

Hi Dave,

     I've copied the hpff-interpret mailing list on this, because I thought
that was the more appropriate place.

> I have been experimenting with TEMPLATEs a bit lately and have found
> that when used in MODULEs, I would like to be able to limit their
> scoping to just the module.  Has there been any discussion of
> templates having the ability to use PRIVATE or PUBLIC in the future?

     The private attribute does apply to templates (and processors
arrangements, for that matter), but can't be applied directly to an individual
template.  To make a template in a module private, you have to do something
like this:

      module mod
        private
!hpf$   template t(100)
!hpf$   distribute t(block)
        integer, public :: a(100)
!hpf$   align a(i) with t(i)
      end module mod

This means you have to explicitly specify the public attribute for all
entities that you want to be public in the module.

>
> Also -
> Array alignment in subroutines seems to be pretty well addressed for
> the codes that I am working on.  Dummy arrays I declare with:
>
> !HPF$ DISTRIBUTE *(aaaaaaaaaaaa) :: yyy
> !HPF$ DISTRIBUTE *(bbbbbbbbbbbb) :: zzz
>
> and locals I can declare with:
>
> !HPF$ ALIGN WITH yyy ::
> !HPF$ ALIGN WITH zzz ::
>
> and presumably somewhere higher up in the call tree the relationship
> between different distributions is described so as to maximize
> alignment of arrays.
>
> MODULEs seem to introduce an interesting situation.  Currently, I am
> using them only to replace COMMON blocks.  It seems that there is not
> a way to explicitly tell the compiler about the alignment relationship
> between arrays in the module and arrays in the routines that USE the
> module.  Even TEMPLATEs, if you could limit their scoping via PRIVATE,
> would only implicitly address this.  Have I missed something?  Is
> there any preferred method for addressing alignment of arrays in COMMON
> block type MODULEs with arrays in subroutines?

     This is an interesting problem.  If I understand correctly, you are doing
things like this:

      subroutine sub(arg)
        common /com/ carr
        integer :: arg(:), carr(100)
!hpf$   distribute arg(block)
!hpf$   align carr(i) with arg(2*i+1)
      end subroutine sub

and you are finding that you can't do this:

      module mod
        integer :: carr(100)
      end module mod

      subroutine sub(arg)
        use mod
        integer :: arg(:)
!hpf$   distribute arg(block)
!hpf$   align carr(i) with arg(2*i+1)
      end subroutine sub

     Since the mapping of data in common and modules is basically fixed
throughout the execution of the program, couldn't you turn the alignments
around in most situations so that the array in the module is distributed, and
the argument to the subroutine is aligned with the array from the module,
rather than the other way around?

     My apologies if I've misunderstood what you are trying to do.

Thanks,

Henry
---------------------------------------------------------------------------
To (un)subscribe to this list, send mail to
[email-masked].
Leave the subject line blank, and in the body put the line
(un)subscribe <email-address>
---------------------------------------------------------------------------