Docsity

PVM Programming Interface: Fortran Code Snippet - Prof. Timothy Rolfe, Study notes of Computer Science

Toggle sidebar
bg1
Fortran Interface
include 'fpvm3.h'
Process Control
call pvmfmytid( tid )
call pvmfexit( info )
call pvmfkill( tid, info )
call pvmfaddhost( host, info )
call pvmfdelhost( host, info )
call pvmfnotify(about, msgtag, ntask, tids, info)
call pvmfspawn( task, flag, where,
ntask, tids, numt )
Information
call pvmfparent( tid )
call pvmfperror( msg, info )
call pvmftidtohost( tid, dtid )
call pvmfconfig( nhost, narch, dtid, host,
arch, speed, info)
call pvmftasks( which, ntask, tid, ptid, dtid,
flag, task, info)
call pvmfgetopt( what, val )
call pvmfsetopt( what, val, oldval )
Group Operations
call pvmfjoingroup( group, inum )
call pvmflvgroup( group, info )
call pvmfgsize( group, size )
call pvmfgettid( group, inum, tid )
call pvmfgetinst( group, tid, inum )
call pvmfbarrier( group, count, info )
call pvmfbcast( group, msgtag, info )
call pvmfreduce( op, xp, nitem, type, tag,
group, root, info )
op options
PvmMax PvmMin PvmSum PvmProduct
Message Buers
call pvmfmkbuf( encoding, bufid )
call pvmffreebuf( bufid, info )
call pvmfgetsbuf( bufid )
call pvmfgetrbuf( bufid )
call pvmfsetsbuf( bufid, oldbuf )
call pvmfsetrbuf( bufid, oldbuf )
call pvmfinitsend( encoding, bufid )
Encoding options MEANING
PvmDataDefault
0 XDR
PvmDataRaw
1 no encoding
PvmDataInplace
2 data left in place
Sending
call pvmfpack( type, xp, nitem, stride, info )
Pack/unpack and Reduce type options
STRING
0
REAL4
4
BYTE1
1
COMPLEX8
5
INTEGER2
2
REAL8
6
INTEGER4
3
COMPLEX16
7
call pvmfsend( tid, msgtag, info )
call pvmfmcast( ntask, tids, msgtag, info )
call pvmfpsend( tid, msgtag, xp, nitem, type, info )
Receiving
call pvmfrecv( tid, msgtag, bufid )
call pvmfprobe( tid, msgtag, bufid )
call pvmfnrecv( tid, msgtag, bufid )
call pvmftrecv( tid, msgtag, sec, usec, bufid )
call pvmfprecv( tid, msgtag, xp, nitem, type,
rtid, rtag, ritem, info )
call pvmfbufinfo(bufid, bytes, msgtag, tid, info)
call pvmfunpack( type, xp, nitem, stride, info )
Declarations
INTEGER about, bud, count, dtid, enco ding
INTEGER ag, info, inum, msgtag, mstat
INTEGER narch, nhost, nitem, ntask, numt
INTEGER oldbuf, oldset, oldval, pstat, ptid
INTEGER ritem, root, rtag, rtid, sec, set
INTEGER signum, speed, stride, tid
INTEGER tids(ntask), type, usec, which
CHARACTER arch, group, host, msg, task, where
'type' xp(nitem*stride)
ERROR CODE MEANING
PvmOk 0 okay
PvmBadParam -2 bad parameter
PvmMismatch -3 barrier count mismatch
PvmNoData -5 read past end of buer
PvmNoHost -6 no such host
PvmNoFile -7 no such executable
PvmNoMem -10 can't get memory
PvmBadMsg -12 can't decode received msg
PvmSysErr -14 pvmd not responding
PvmNoBuf -15 no current buer
PvmNoSuchBuf -16 bad message id
PvmNullGroup -17 null group name is illegal
PvmDupGroup -18 already in group
PvmNoGroup -19 no group with that name
PvmNotInGroup -20 not in group
PvmNoInst -21 no such instance in group
PvmHostFail -22 host failed
PvmNoParent -23 no parent task
PvmNotImpl -24 function not implemented
PvmDSysErr -25 pvmd system error
PvmBadVersion -26 pvmd-pvmd protocol mismatch
PvmOutOfRes -27 out of resources
PvmDupHost -28 host already congured
PvmCantStart -29 failed to exec new slave pvmd
PvmAlready -30 already doing operation
PvmNoTask -31 no such task
PvmNoEntry -32 no such (group,instance)
PvmDupEntry -33 (group,instance) already exists
arallel
irtual
ac ine
Quick Reference Guide
Release 3.3
March 21, 1994
University of Tennessee
Oak Ridge National Laboratory
Emory University
Obtaining PVM
ftp:
netlib2.cs.utk.edu
directory pvm3/
email:
netlib@ornl.gov
with the message
send index from pvm3
.
2
pf2

Partial preview of the text

Download PVM Programming Interface: Fortran Code Snippet - Prof. Timothy Rolfe and more Study notes Computer Science in PDF only on Docsity!

Fortran^ In

terface

include^ 'fpvm3.h' Pro^ cess^ Control call^ pvmfmytid(

tid^ ) call^ pvmfexit(^

info^ ) call^ pvmfkill(^

tid,^ info^ ) call^ pvmfaddhost(

host,^ info^ ) call^ pvmfdelhost(

host,^ info^ ) call^ pvmfnotify(a

bout,^ msgtag,^ ntask,

tids,^ info) call^ pvmfspawn(

task,^ flag,^ where,ntask,^ tids,^ numt

Information call^ pvmfparent(

tid^ ) call^ pvmfperror(

msg,^ info^ ) call^ pvmftidtohos

t(^ tid,^ dtid^ ) call^ pvmfconfig(

nhost,^ narch,^

dtid,^ host,arch, speed, info) call^ pvmftasks(

which,^ ntask,

tid,^ ptid,^ dtid,flag, task, info) call^ pvmfgetopt(

what,^ val^ ) call^ pvmfsetopt(

what,^ val,^ oldval

Group^ Op^ erations call^ pvmfjoingrou

p(^ group,^ inum^

call^ pvmflvgroup(

group,^ info^

call^ pvmfgsize(

group,^ size

call^ pvmfgettid(

group,^ inum,

tid^ ) call^ pvmfgetinst(

group,^ tid,^

inum^ ) call^ pvmfbarrier(

group,^ count,

info^ ) call^ pvmfbcast(

group,^ msgtag,

info^ ) call^ pvmfreduce(

op,^ xp,^ nitem,

type,^ tag,group, root, info^ )

op^ options PvmMax^ PvmMin^

PvmSum^ PvmProdu

ct

Message^ Bu^

ers

call^ pvmfmkbuf(

encoding,^ bufid

call^ pvmffreebuf(

bufid,^ info^ ) call^ pvmfgetsbuf(

bufid^ ) call^ pvmfgetrbuf(

bufid^ ) call^ pvmfsetsbuf(

bufid,^ oldbuf^

call^ pvmfsetrbuf(

bufid,^ oldbuf^

call^ pvmfinitsend

(^ encoding,^ bufid

Enco^ ding^ options

MEANING

PvmDataDefault^

0 XDR

PvmDataRaw^

1 no^ enco^ ding

PvmDataInplace^

2 data^ left^ in^ place

Sending call^ pvmfpack(^

type,^ xp,^ nitem,

stride,^ info^ )

Pack/unpack^ and

Reduce^ typ^ e^ options STRING 0 REAL^

BYTE1^1

COMPLEX^8

INTEGER^2

REAL^

INTEGER^4

COMPLEX^16

call^ pvmfsend(^

tid,^ msgtag,^

info^ ) call^ pvmfmcast(

ntask,^ tids,^ msgtag,

info^ ) call^ pvmfpsend(

tid,^ msgtag,^ xp,

nitem,^ type,^ info

Receiving call^ pvmfrecv(^

tid,^ msgtag,^ bufid

call^ pvmfprobe(

tid,^ msgtag,^ bufid

call^ pvmfnrecv(

tid,^ msgtag,^ bufid

call^ pvmftrecv(

tid,^ msgtag,^ sec,

usec,^ bufid^ ) call^ pvmfprecv(

tid,^ msgtag,^ xp,

nitem,^ type, rtid,^ rtag,^ ritem,

info^ ) call^ pvmfbufinfo

(bufid,^ bytes,^

msgtag,^ tid,^ info) call^ pvmfunpack(

type,^ xp,^ nitem,

stride,^ info^ )

Declarations^ INTEGER^ ab

out,^ bu^ d,^ count,^ dtid,

enco^ ding INTEGER^ ag,^

info,^ inum,^ msgtag,

mstat INTEGER^ narch,

nhost,^ nitem,^ ntask,

numt INTEGER^ oldbuf,

oldset,^ oldval,^ pstat,

ptid INTEGER^ ritem,

ro^ ot,^ rtag,^ rtid,^ sec,

set INTEGER^ signum,

sp^ eed,^ stride,^ tid INTEGER^ tids(ntask),

typ^ e,^ usec,^ which CHARACTER^ arch,

group,^ host,^ msg,^ task,

where 'typ^ e'^ xp(nitem*stride) ERROR^ CODE^

MEANING PvmOk^

0 okay PvmBadParam^

-2^ bad^ parameter PvmMismatch^

-3^ barrier^ count^

mismatch PvmNoData^

-5^ read^ past^ end

of^ bu^ er PvmNoHost^

-6^ no^ such^ host PvmNoFile^

-7^ no^ such^ executable PvmNoMem^

-10^ can't^ get^ mem

ory PvmBadMsg^

-12^ can't^ deco^ de

received^ msg PvmSysErr^

-14^ pvmd^ not^ resp

onding PvmNoBuf^

-15^ no^ current^ bu

er PvmNoSuchBuf^

-16^ bad^ message

id PvmNullGroup^

-17^ null^ group^ name

is^ ill^ egal PvmDupGroup^

-18^ already^ in^ group PvmNoGroup^

-19^ no^ group^ with

that^ name PvmNotInGroup^

-20^ not^ in^ group PvmNoInst^

-21^ no^ such^ instance

in^ group PvmHostFail^

-22^ host^ failed PvmNoParent^

-23^ no^ parent^ task PvmNotImpl^

-24^ function^ not^

implemented PvmDSysErr^

-25^ pvmd^ system

error PvmBadVersion^

-26^ pvmd-pvmd^

proto^ col^ mismatch PvmOutOfRes^

-27^ out^ of^ resources PvmDupHost^

-28^ host^ already^

con^ gured PvmCantStart^

-29^ failed^ to^ exec

new^ slave^ pvmd PvmAlready^

-30^ already^ doing

op^ eration PvmNoTask^

-31^ no^ such^ task PvmNoEntry^

-32^ no^ such^ (group,instance) PvmDupEntry^

-33^ (group,instance)

already^ exists

arallel^ irtual^ ac^ ine Quick^ Reference

Guide

Release^ 3.3 March^ 21,^1994 University^

of^ Tennessee

Oak^ Ridge

National^ Lab

oratory

Emory^ Univ

ersity

Obtaining^

PVM

ftp:^ netlib2.cs

.utk.edu^ directory

pvm3/

email:^ netlib@o

rnl.gov^ with^ the

message

send^ index^ from

pvm^.

C^ Interface #include^ "pvm3.h" Pro^ cess^ Control int^ tid^ =^ pvm_mytid

(void) int^ info^ =^ pvm_exit(

void) int^ info^ =^ pvm_kill(

int^ tid) int^ info^ =^ pvm_addho

sts(char^ **hosts

,^ int^ nhost,int *infos) int^ info^ =^ pvm_delho

sts(char^ **hosts

,^ int^ nhost,int *infos) int^ numt^ =^ pvm_spawn

(char^ *task,^ char

**argv, int^ flag,^ char^

*where, int^ ntask,^ int^

*tids)

Spawn^ ag^ options

MEANING

PvmTaskDefault^

0 don't^ care^ where

PvmTaskHost^

1 \where"^ conta

ins^ host

PvmTaskArch^

2 \where"^ conta

ins^ arch

PvmTaskDebug^

4 start^ tasks^ with

debug^ on

PvmTaskTrace^

8 start^ tasks^ with

trace^ on

PvmHostCompl^

32 use^ complem

ent^ host^ set

Information int^ tid^ =^ pvm_paren

t(void) int^ dtid^ =^ pvm_tidto

host(int^ tid) int^ info^ =^ pvm_perro

r(char^ *msg) int^ info^ =^ pvm_confi

g(int^ *nhost,^ int

*narch, struct^ hostinfo

**hostp) int^ info^ =^ pvm_tasks

(int^ which,^ int

*ntask,struct taskinfo^ **taskp) int^ val^ =^ pvm_get

opt(int^ what) int^ oldval^ =^ pvm_set

opt(int^ what,^ int

val)

what^ option^

SETS/GETS^ This

PvmRoute^

1 routing^ p^ olicy

:^ PvmRouteDirec

t

PvmDebugMask^

2 debug^ level^

|^ PvmAllowDirec

t

PvmAutoErr^

3 auto^ error^ rep

orting

PvmOutputTid^

4 stdout^ device

for^ children

PvmOutputCode^

5 output^ msgtag

PvmTraceTid^

6 trace^ device^

for^ children

PvmTraceCode^

7 trace^ msgtag

PvmFragSize^

8 message^ fragmen

t^ size

Signalling int^ info^ =^ pvm_sends

ig(int^ tid,^ int

signum) int^ info^ =^ pvm_notif

y(int^ about,^ int

msgtag,int ntask, int *tids)

Ab^ out^ options^

MEANING

PvmTaskExit^

1 notify^ if^ task

exit

PvmHostDelete^

2 notify^ if^ deletion

PvmHostAdd^

3 notify^ if^ addition

Message^ Bu^

ers int^ bufid^ =^ pvm_mkbu

f(int^ encoding) int^ info^ =^ pvm_free

buf(int^ bufid) int^ bufid^ =^ pvm_gets

buf(void) int^ bufid^ =^ pvm_getr

buf(void) int^ oldbuf^ =^ pvm_sets

buf(int^ bufid) int^ oldbuf^ =^ pvm_setr

buf(int^ bufid) int^ bufid^ =^ pvm_init

send(int^ encoding

Enco^ ding^ options

MEANING

PvmDataDefault^

0 XDR

PvmDataRaw^

1 no^ enco^ ding

PvmDataInPlace^

2 data^ left^ in^ place

Sending int^ info^ =^ pvm_pack

f(^ printf-like

format...^ ) int^ info^ =^ pvm_pkby

te(^ char^ *cp,

int^ cnt,^ int^ std

int^ info^ =^ pvm_pkcp

lx(^ float^ *xp,

int^ cnt,^ int^ std

int^ info^ =^ pvm_pkdc

plx(^ double^ *zp,

int^ cnt,^ int^ std

int^ info^ =^ pvm_pkdo

uble(double^ *dp,

int^ cnt,^ int^ std

int^ info^ =^ pvm_pkfl

oat(^ float^ *fp,

int^ cnt,^ int^ std

int^ info^ =^ pvm_pkin

t(^ int^ *np,

int^ cnt,^ int^ std

int^ info^ =^ pvm_pklo

ng(^ long^ *np,

int^ cnt,^ int^ std

int^ info^ =^ pvm_pksh

ort(^ short^ *np,

int^ cnt,^ int^ std

int^ info^ =^ pvm_pkst

r(^ char^ *cp

int^ info^ =^ pvm_send

(^ int^ tid,^ int

msgtag^ ) int^ info^ =^ pvm_mcas

t(^ int^ *tids,^ int

ntask,^ int^ msgtag

int^ info^ =^ pvm_psen

d(^ int^ tid,^ int

msgtag,void *vp, int^ cnt,^ int^ type

Receiving int^ bufid^ =^ pvm_rec

v(^ int^ tid,^ int

msgtag^ ) int^ bufid^ =^ pvm_pro

be(^ int^ tid,^ int

msgtag^ ) int^ bufid^ =^ pvm_nre

cv(^ int^ tid,^ int

msgtag^ ) int^ bufid^ =^ pvm_pre

cv(^ int^ tid,^ int

msgtag,void *vp, int^ cnt,^ int^ typeint *rtid, int^ *rtag,^ int^ *rlen

int^ bufid^ =^ pvm_tre

cv(^ int^ tid,^ int

msgtag,struct timeval^ *tmout^ ) int^ info^ =^ pvm_bufi

nfo(^ int^ bufid,

int^ *bytes,int *msgtag,^ int^ *tid) int^ info^ =^ pvm_unpa

ckf(^ printf-li

ke^ format...^ ) int^ info^ =^ pvm_upkb

yte(^ char^ *cp,

int^ cnt,^ int^ std

int^ info^ =^ pvm_upkc

plx(^ float^ *xp,

int^ cnt,^ int^ std

int^ info^ =^ pvm_upkd

cplx(^ double^ *zp,

int^ cnt,^ int^ std

int^ info^ =^ pvm_upkd

ouble(double^ *dp,

int^ cnt,^ int^ std

int^ info^ =^ pvm_upkf

loat(^ float^ *fp,

int^ cnt,^ int^ std

int^ info^ =^ pvm_upki

nt(^ int^ *np,

int^ cnt,^ int^ std

int^ info^ =^ pvm_upkl

ong(^ long^ *np,

int^ cnt,^ int^ std

int^ info^ =^ pvm_upks

hort(^ short^ *np,

int^ cnt,^ int^ std

int^ info^ =^ pvm_upks

tr(^ char^ *cp

Group^ Op^ erations int^ inum^ =^ pvm_join

group(char^ *group) int^ info^ =^ pvm_lvgr

oup(^ char^ *group) int^ size^ =^ pvm_gsiz

e(^ char^ *group) int^ tid^ =^ pvm_gett

id(^ char^ *group,

int^ inum) int^ inum^ =^ pvm_geti

nst(^ char^ *group,

int^ tid) int^ info^ =^ pvm_barr

ier(^ char^ *group,

int^ count) int^ info^ =^ pvm_bcas

t(^ char^ *group,

int^ msgtag) int^ info^ =^ pvm_redu

ce(^ void^ *op,^ void

*vp,^ int^ cnt, int^ type,^ int^ msgtag,

char^ *group,^ int

root)

op^ options^

vp^ typ^ e^ options

PvmMax^ PVM_BYT

E^ PVM_FLOAT

PvmMin^ PVM_SHO

RT^ PVM_DOUBLE

PvmSum^ PVM_INT

PVM_CPLX

PvmProduct^ PVM_LON

G^ PVM_DCPLX

Starting^ PVM pvmd^ [-nhostname

]^ [-d]

[hostfile] pvm^ [hostfile]^

(starts^ console)

PVM^ Console

Commands help^ [command]^

{^ get^ information

ab^ out^ commands

conf^

{^ lists^ hosts^ in^ virtual

machine

add^ host(s)^

{^ add^ host(s)^ to^

virtual^ machine

delete^ host(s)^

{^ delete^ host(s)

spawn^ [opt]^ file

{^ spawn^ pro^ cess - { number^ of^ tasks^

to^ spawn

-^ {^ host

to^ spawn^ on

->^ {^ redirect

task^ output^ to^ console

->file^ {^ redirect

task^ output^ to^

le

->>file^ {^ app

end^ task^ output^

to^ le

ps^ [-a]^

{^ lists^ pro^ cesses^ on

virtual^ machine

alias^

{^ de^ ne/list^ comman

d^ aliases

unalias^

{^ unde^ ne^ comman

d^ alias

setenv^

{^ set/show^ enviro

nment^ variables

echo^

{^ echo^ arguments

version^

{^ print^ libpvm^ versio

n

id^

{^ print^ console^ tid

sig^ num^ tid^

{^ send^ signal^ num

to^ pro^ cess

kill^ tid^

{^ terminate^ a^ pro

cess

reset^

{^ kill^ all^ pro^ cesses

and^ reset^ PVM

quit^

{^ exit^ console^ (PVM

continues)

halt^

{^ kill^ all^ pvmds^ and

console

Compiling^ PVM

Applications cc^ -o^ task^ myprog.

c^ libpvm3.a f77^ -o^ task^ myprog

.f^ libfpvm3.a^ libpvm3.a

For^ groups^ add^ libgpvm

3.a^ b^ efore^ libpvm

.a