# blacs_setup

Allocates virtual machine and spawns processes.

## Syntax

call blacs_setup( mypnum, nprocs )

## Input Parameters

nprocs | INTEGER. On the process spawned from the keyboard rather than from pvmspawn, this parameter indicates the number of processes to create when building the virtual machine.

## Output Parameters

mypnum | INTEGER. An integer between 0 and (nprocs - 1) that uniquely identifies each process.
nprocs | INTEGER. For all processes other than spawned from the keyboard, this parameter means the number of processes available for BLACS use.

## Description

This routine only accomplishes meaningful work in the PVM BLACS. On all other platforms, it is functionally equivalent to blacs_pinfo. The BLACS assume a static system, that is, the given number of processes does not change. PVM supplies a dynamic system, allowing processes to be added to the system on the fly.

blacs_setup is used to allocate the virtual machine and spawn off processes. It reads in a file called blacs_setup.dat, in which the first line must be the name of your executable. The second line is optional, but if it exists, it should be a PVM spawn flag. Legal values at this time are 0 (PvmTaskDefault), 4 (PvmTaskDebug), 8 (PvmTaskTrace), and 12 (PvmTaskDebug + PvmTaskTrace). The primary reason for this line is to allow the user to easily turn on and off PVM debugging. Additional lines, if any, specify what machines should be added to the current configuration before spawning nprocs-1 processes to the machines in a round robin fashion.

nprocs is input on the process which has no PVM parent (that is, mypnum=0), and both parameters are output for all processes. So, on PVM systems, the call to blacs_pinfo informs you that the virtual machine has not been set up, and a call to blacs_setup then sets up the machine and returns the real values for mypnum and nprocs.

Note that if the file blacs_setup.dat does not exist, the BLACS prompt the user for the executable name, and processes are spawned to the current PVM configuration.

## See Also

BLACS Routines Usage Example
Parent topic: Initialization Routines