PURPOSE

To perform parallel processing

SYNOPSIS

CALL FMSPAR (NUMPAR, SNAME, P1, P2, ...)
CALL FMSRUN
CALL FMSYNC

INPUT PARAMETERS

OUTPUT PARAMETERS:

None.

FMS PARAMETERS:

The following FMS Parameters are especially important to this routine:
Parameter Description
MAXCPU Number of processors to use.
MYNODE Your process number.

DESCRIPTION:

These subroutines provide a way for you to run part of your application in parallel. To use this feature, you place the work to be performed into a subroutine, which we will call USERSUB for this example. This subroutine should be designed to be called once for each processor, with each call performing an equal piece of work.

For example, we will assume subroutine USERSUB has 3 arguments, A1, A2 and A3. You use the FMS parallel processing utilities to call USERSUB in parallel as follows:

	EXTERNAL USERSUB
	...
	CALL FMSIGT ('MAXCPU', MAXCPU)
	DO MYCPU = 2,MAXCPU
	   CALL FMSPAR (3, USERSUB, A1, A2, A3)
	ENDDO
	IF(MAXCPU .GT. 1) CALL FMSRUN
	CALL USERSUB (A1, A2, A3)
	IF(MAXCPU .GT. 1) CALL FMSYNC
The EXTERNAL statement lets the compiler know that USERSUB is a subroutine name (global symbol) and not a local variable. You must declare all subroutines passed to FMSPAR as EXTERNAL.

You may call FMSIGT to obtain MAXCPU, the number of processors actually running.

You then call FMSPAR to place the work for the children in a queue. After all of the work has been queued, you call FMSRUN to start the children running.

After the children are running, USERSUB is called by the parent to do its share of the work. The parent then calls FMSYNC to wait for the completion of the children.

Note that if there is only one process (MAXCPU=1), FMSPAR , FMSRUN and FMSYNC are not called.

In subroutine USERSUB you may include the statement

	CALL FMSIGT('MYNODE', MYNODE)
to obtain the process number (0 to MAXCPU-1; 0 is parent) of the subroutine. You may then use the value of MYNODE to determine your piece of work to compute.