next up previous

3.2 Fortran 77 Example

Figure 3 gives the Fortran code for the master program which is contained in the file master.f. Figure 4 shows the Fortran code for the worker portion of the PVM example application stored in the file worker.f. Below, we examine each program to see how the PVM calls are used.

Figure 3: Fortran 77 version of master example.

Figure 4: Fortran 77 version of worker example.

The PVM Fortran routines are interface routines to the corresponding C functions. As such, the last parameter of all Fortran routines has been designated to return the value returned by the equivalent C function. For most routines this will be nothing more than an informational code to report on the success of the routine call. The parameter used in this case is info. Other values returned have other uses under PVM and will be detailed as required.

The first line of both programs includes the Fortran PVM header file. This file gives definitions to PVM symbolic names and routines. If PVM is available in a system directory, this header file will be installed as well. Consult with the system administrator for the proper directory.

The first PVM call in the master program informs the PVM daemon of its existence by enrolling the task in the virtual machine. The routine pvmfmytid() is used for this purpose and assigns a task id to the calling task.

call pvmfmytid(mytid)
The task id is returned through the integer mytid parameter.