PURPOSETo perform parallel processing
CALL FMSPAR (NUMPAR, SNAME, P1, P2, ...)
- NUMPAR = Integer
(FMSPAR only) Specifies the number of parameters to be passed to SNAME.
Maximum value is 16.
- SNAME = Address of entry point
(FMSPAR only) Specifies the subroutine to be called in parallel.
This subroutine must be declared EXTERNAL in your program.
- P1, P2,... = Integer, Real or Complex
(FMSPAR only) Parameters to be passed to SNAME. There must be NUMPAR parameters specified. These parameters must be address pointers to shared memory.
FMS PARAMETERS:The following FMS Parameters are especially important to this routine:
|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 FMSYNCThe 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 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