Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pvm_getfds(3pvm) [debian man page]

GETFDS(3PVM)							  PVM Version 3.4						      GETFDS(3PVM)

NAME
pvm_getfds - Get file descriptors in use by PVM. SYNOPSIS
C int nfds = pvm_getfds( int **fds ) Fortran Not Available PARAMETERS
fds Returns integer array of file descriptors. DESCRIPTION
A PVM task uses sockets to communicate between libpvm and other tasks or the pvmd. It is sometimes useful to know the file descriptor num- bers of the sockets in order to wait from input from either PVM messages or an external source. For example, the PVM console waits on both keyboard input and notify messages. Input can be multiplexed by polling all sources, but this wastes cpu cycles. Instead, the select() system call can be used to wait until one or more sources of input are ready. If it completes successfully, pvm_getfds returns the number of sockets in use, and the file descriptor numbers in an array (allocated and freed by libpvm). At least one socket always exists (from task to pvmd), and its descriptor is always fds[0]. The number of sockets varies as direct routes are established to other tasks. It can be difficult to track the set of file descriptors if direct routing is enabled, because routes are created as messages are either sent or received. The simplest approach is to disable direct routing. When select returns with a PVM file descriptor ready, a complete message may be ready to be received, or instead only a fragment may be waiting. pvm_nrecv or pvm_probe should be used test without blocking. RESTRICTIONS
pvm_getfds is only available when running PVM on a Unix or similar system. EXAMPLES
The following program fragment waits until either keyboard input is available, or a PVM message has arrived. int *d; fd_set r; pvm_setopt(PvmRoute, PvmDontRoute); pvm_getfds(&d); FD_ZERO(&r); FD_SET(0, &r); FD_SET(d[0], &r); while(1) { if (select(d[0] + 1, &r, (fd_set*)0, (fd_set*)0, (struct timeval*)0) > 0) { if (FD_ISSET(0, &r)) ... /* read keyboard input */ if (FD_ISSET(d[0], &r) && pvm_nrecv(-1, -1) > 0) ... /* got a PVM message */ } } ERRORS
The following error condition can be returned by pvm_getfds: PvmSysErr pvmd not responding. SEE ALSO
pvm_notify(3PVM), pvm_trecv(3PVM) 22 Nov, 1994 GETFDS(3PVM)

Check Out this Related Man Page

ADVISE(3PVM)							  PVM Version 3.4						      ADVISE(3PVM)

NAME
pvm_advise() - Controls use of direct task-to-task routing. [In Version 3.2: Replaced by pvm_setopt] SYNOPSIS
C int info = pvm_advise( int route ) Fortran call pvmfadvise( route, info ) PARAMETERS
route Integer advising PVM to set up direct task-to-task links. route options PvmDontRoute 1 Don't allow direct links to this task PvmAllowDirect 2 Allow but don't request direct links PvmRouteDirect 3 Request direct links info Integer returning error status. DESCRIPTION
The routine pvm_advise advises PVM on whether or not to set up direct task-to-task links (using TCP) for all subsequent communication. Once a link is established it remains until the application finishes. If a direct link can not be established because one of the two tasks has requested PvmDontRoute or because no resources are available, then the default route through the PVM daemons is used. pvm_advise can be called multiple times to selectively establish direct links, but is typically set only once near the beginning of each task. PvmAllowDi- rect is the default advise setting. This setting on task A allows other tasks to set up direct links to A. Once a direct link is estab- lished between tasks both tasks will use it for sending messages. pvm_advise returns the error status in info. The performance of direct task-to-task links can be up to a factor of two better than the default route. The draw back is a lack of scalability of the direct links. Some versions of UNIX limit the number of links to no more than 30. EXAMPLES
C: info = pvm_advise( PvmRouteDirect ); Fortran: CALL PVMFADVISE( PVMROUTEDIRECT, INFO ) ERRORS
This error condition can be returned by pvm_advise PvmBadParam giving an invalid route value. SEE ALSO
pvm_setopt(3PVM) 30 August, 1993 ADVISE(3PVM)
Man Page