Newsgroups: comp.parallel.pvm
Path: ukc!uknet!gdt!mapdjb
From: mapdjb@midge.bath.ac.uk (D J Batey)
Subject: Re: Some questions
Message-ID: <Co5q08.J19@midge.bath.ac.uk>
Organization: School of Mathematical Sciences, University of Bath, UK
References: <2oe4qe$ls9@info2.rus.uni-stuttgart.de>
Date: Tue, 12 Apr 1994 17:31:20 GMT
Lines: 50

>      question:
>          is there a way to lay down where the pvmgs should run?

Pass. Where's Adam Beguelin when you need him?

>      question:
>                 what is the best way to send a logical variable in
>                 a fortran programme?

I'm guessing that by a logical variable, you mean a TRUE/FALSE? In
which case, if you *know* at the receiving end that the value sent is
supposed to represent a boolean, you can just send 1 for TRUE and 0
for FALSE (or two values of whatever smaller datatype you have lying
around) and vice versa when you read. EncodeLogical and DecodeLogical
are likely-sounding functions; the first takes a logical value and
returns an integer (or char, or whatever), the second takes an integer
and returns a logical value.

>      question:
>                 if the subroutine grad is replaced by a slave that
>                 does the job, is there a way for the master to send
>                 the name of the function that has to be called?

Sounds dangerously like you want a reflective Fortran system ;^) 

IF 
1) you can guarantee the same software running at each end of the
   communication, 
AND
2) you really do have functions as first-class objects, as your example 
   implies,
AND
3) there are a limited number of functions that you wish to call in this way,
THEN 

you can proceed as for the logical variables. Basically you just need
two extra functions:- EncodeFunction, which takes a function and
returns an integer (say), and DecodeFunction, which takes an integer
and returns a function. Just how you implement the conversions is down
to what you can do with Fortran these days (if.. then.. else, switch,
arrays of functions, whatever is easiest/possible).

Does this help?

-------------------------------------------------------------------------------
 Duncan Batey                                     Computing Group,
 djb@maths.bath.ac.uk                             School of Mathematics,
 Postgraduate Research Student                    University of Bath, England.
-------------------------------------------------------------------------------


