Newsgroups: comp.parallel.mpi
From: eddemain@neumann.uwaterloo.ca (Erik Demaine)
Subject: Re: MPI pointer cacheing
Organization: University of Waterloo
Date: Fri, 27 Sep 1996 21:04:03 GMT
Message-ID: <DyEt6r.Bu4@undergrad.math.uwaterloo.ca>

James Cownie (jcownie@bbn.com) wrote:
: F90 pointers are much more complex objects,
: you normally need at least
: 	boolean flag    -- is this pointer allocated
: 	boolean flag2   -- is this pointer allocatable
: 	pointer to the data
: 	foreach dimension    \
: 	    base              \___ (*)
: 	    end               /
: 	    stride           /

(*) is only for arrays, obviously.  In fact, it is (often) stored at the
target, not with the pointer itself.

: The MPI cacheing function will only store the first integer from the pointer.
: Therefore the code will very likely crash (as you have observed !).

You should be able to remove the F90 pointer baggage for an *array* by using
a(1,1,...,1) and passing that to a function that expects things by-value.
For example:

        call mpi_... (..., address_of(a(1,1,...,1)))

with C code

        int address_of (int x)
        {
           return x;
        }

I think you can also do:

        integer function address_of (%val(x))
        integer :: x
        address_of = x
        end function address_of

in F90.  I don't think %val is standard, though.

Erik
-- 
Erik Demaine                 ()  e-mail: eddemain@neumann.uwaterloo.ca
Dept. of Computer Science    \/  URL: http://barrow.uwaterloo.ca/~eddemain/
University of Waterloo       /\  PGP key: finger me.  "Flying is the art of
Waterloo, ON Canada N2L 3G1  ()  falling and not hitting the ground" -Adams

