Subject: hpff-interpret: INDEPENDENT DO w/ PURE EXTR

From: Vince Schuster <[email-masked]>
Date: Wed, 20 Sep 1995 21:28:45 -0400

---------------------------------------------------------------------------
[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.
---------------------------------------------------------------------------

HPFers,

This may be a naive question, but I raised a question at PGI
concerning the ability to handle calls to PURE EXTRINSIC
(e.g. f77_local) routines inside of INDEPENDENT DO loops.

One non-pgi hpf guru indicates that all EXTRINSICS will have side
effects, so the notion of PURE EXTRINSIC is nonsense.

- Does anyone think this makes sense or is valuable?
  If not, i apologize for taking your time & please skip next
  two questions.  :-)

- How would you expect this to be treated?  Call the EXTRINSIC in
  the same manner as if EXTRINSIC were not in INDEP DO?

- It would appear to be problematic to always determine if communications
  were needed inside the EXTRINSIC; hence, would the additional
  constraint that the EXTRINSIC require no comms be OK?

Answers would be needed rather quickly if it is to make it into
our new pghpf release.

thanks for your wisdom,

Vince

+================================+================================+
| Vince Schuster - president     | [email-masked]              |
| The Portland Group, Inc  (PGI) | http://www.pgroup.com          |
| 9150 SW Pioneer Ct.  Ste H     | 01 (503) 682-2806 <ph>         |
| Wilsonville OR, 97070, USA     | 01 (503) 682-2637 <fax>        |
+================================+================================+

---------------------------------------------------------------------------
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>
---------------------------------------------------------------------------

---

From: Rob Schreiber <[email-masked]>
Date: Mon, 25 Sep 1995 09:59:13 -0700

Vince Schuster writes:

Vince,

We're already debating this question, as I BEAT YOU TO IT, and sent
in a CCI recently, asking whether

a.  an extrinsic(foo_local) routine could be pure (for foo = HPF, F77, C, etc.)
b.  if so, would we allow them in foralls?
c.  whether pure or not, are they allowed in independent loops.

We discussed this at some length at the meeting, in subgroup C, and concluded
nothing.

We made these observations:

1.  If an extrinsic routine is of HPF type (HPF< HPF_SERIAL, or HPF_LOCAL)
then the same syntactic rules that constrain PURE functions could be enforced
by the HPF compiler.

2.  Pure routines can call only pure routines, and no message passing library
that we know of has been "certified" as pure, so there is not
much one could do in a pure local extrinsic.   HPF_SERIAL, however, maybe
fine.

3.  We didnt see any semantic reason for disallowing extrinsic local
routines in an independent loop; recall that they need not be PURE.
Here is an example of why you might want to do it:

           real x(100, nprocs)
           !hpf$ distribute x(*, block)

           !hpf$ independent
           do row = 1, 100
              x(row, :) = extrinsic_local_fn(x(row,:))
           enddo

The implementation we have in mind is that 100 threads are started on each processor.

For HPF_LOCAL, the documentation says that there is a barrier before and after each
call.   If so, the load balancing possibilities of the example above are lost.
So, we have in mind the following possible improved implementation.  In such a loop,
there is a barrier before the first and after the last call, but not before/after the
intervening ones.

Now there are lots of interesting questions about thread-safety, i.e.,
how do I keep messages due to the ith call from interfering with those generated
by the other 99 calls, which might be running concurrently on other processors.

Rob