C****************************************************************************** C PVM TEMPLATE CODES C FILE: pvm.ex1.worker.f C DESCRIPTION: See pvm.ex1.master.f C PVM VERSION: 2.4 C LAST REVISED: 5/24/93 bbarney C****************************************************************************** program example1_worker integer ARRAYSIZE, FROMMASTER_MSG, FROMWORKER_MSG parameter(ARRAYSIZE = 60000) parameter(FROMMASTER_MSG = 1) parameter(FROMWORKER_MSG = 2) integer i, index, msgtype, rc, bytes, masternum, chunksize real*4 result(ARRAYSIZE) character*16 master C******************* enroll this component in pvm **************************** call fenroll("ex1.w", rc) if (rc .lt. 0) then print *, 'WORKER: Unable to enroll this component.' print *, ' Return code = ', rc print *, ' Quitting.' stop else print *, 'WORKER: Component enrolled as instance = ', rc endif C******************* receive data from master component ************************ msgtype = FROMMASTER_MSG call frcv(msgtype, rc) call fgetnint(index, 1, rc) call fgetnint(chunksize, 1, rc) call fgetnfloat(result(index), chunksize, rc) call frcvinfo(bytes, msgtype, master, masternum, rc) C******************* modify the array and then send back to master *********** do 10 i=index, index + chunksize result(i) = i + 1 10 continue msgtype = FROMWORKER_MSG call finitsend() call fputnint(index, 1, rc) call fputnfloat(result(index), chunksize, rc) call fsnd(master, masternum, msgtype, rc) C *** leave PVM *** call fleave() end