GETNTYPE(2)

NAME
getnodeid, getnodetype, getorigin, getncomp, getnotb, getnall, getntype - Get information on LAM nodes.

SYNOPSIS
#include <net.h>
int getnodeid ();
int getnodetype ();
int getorigin ();
int getnall ();
int getncomp ();
int getnjones ();
int getnotb ();
int getntype (int nodetype, int typemask);

FORTRAN SYNOPSIS
integer function IGNDID ()
integer function IGNDTP ()
integer function IGORGN ()
integer function IGNALL ()
integer function IGNCMP ()
integer function IGNJON ()
integer function IGNOTB ()
integer function IGNTP (nodetype, typemask)
integer nodetype, typemask

DESCRIPTION
These functions return node information obtained from the local route daemon, a modular component of the LAM daemon, regarding the currently running LAM network. A node is defined by its identifier, an arbitrary 32 bit value, and its type, a combination of flags describing the capabilities of the node. These flags (see CONSTANTS(5) and/or <net.h>) are:

NT_ITB
    node running LAM natively

NT_CAST
    node multicast, a group of nodes

NT_WASTE
    node not part of main computing group

NT_DISK
    node has a disk

NT_TUBE
    node has a video display unit

NT_JONES
    node is a neighbour of the local node

NT_BOOT
    node is booted by the local node

getnodeid() returns the local node identifier. getnodetype() returns the local node type. getorigin() returns the origin node identifier, from which LAM was booted.

getncomp() returns the number of nodes marked for the "main" computation. A typical application will use most (maybe all) of the nodes in a parallel machine to compute portions of decomposed data. Programmers frequently need to know the number of these "compute" nodes. Other nodes may be present in the multicomputer to handle peripherals or sequential portions of an application.

getnotb() returns the total number of OTB nodes. getnall() returns the total number of nodes in the system. getnjones() returns the caller's number of neighbour (directly connected) nodes.

getntype() is a general function that is used to determine the number of nodes whose node types have certain bits set to certain values. This is a flexible tool which allows the user to obtain very specific information about the capabilities of nodes in the system.

  Type Inquiries
You may need more detailed information on the number and types of nodes in the system than provided by the convenience functions. You may, for example, want to know the number of computing nodes with attached video displays. The getntype() function is used for this purpose.

Node types are interpreted as bit fields, and each node type has a different bit set. A bitmask having all bits set, NT_ALL, is also available. Note that NT_ALL does not include NT_JONES nor NT_BOOT since these node characteristics are not inherent to the nodes, but depend on the node from which the query is made. The node types are thus:

Nodetype	Value	Bitmask
NT_ITB	1	...00000001
NT_CAST	2	...00000010
NT_WASTE	4	...00000100
NT_DISK	8	...00001000
NT_TUBE	16	...00010000
NT_ALL	31	...00011111
NT_JONES	32	...00100000
NT_BOOT	64	...01000000

The typemask argument to getntype() is used to specify which bits are of interest. These are set to 1, all others are set to 0. The nodetype argument is used to specify what values these bits should take. getntype() then compares the relevant bits (as specified by typemask) in the node type of each node in the system, to see if they have the appropriate value (as specified by nodetype).

To learn the number of nodes that have video capabilities, the bits of interest are NT_WASTE and NT_TUBE, thus typemask is 20. NT_WASTE must be 0 and NT_TUBE must be 1, which combined gives nodetype as 16. The complete call to getntype() is:

nnodes = getntype(NT_TUBE, NT_TUBE | NT_WASTE);

To learn the number of compute nodes that have an attached video display, but no other capabilities, all bits must be considered and all bits except NT_TUBE must be clear (0). The complete function call is:

nnodes = getntype(NT_TUBE, NT_ALL);

C RETURN VALUE
getnodeid() and getorigin() both return node identifiers. NOTNODEID (defined in <net.h>) is returned if an error occurred. Likewise, getnodetype() returns a valid node type or NOTNODETYPE in the case of error. The return values upon successful completion for the remaining functions are described above; they return -1 if an error occurs. In all cases of error, the global error variable errno is set to indicate the error.

FORTRAN RETURN VALUE
IGNDID() and IGORGN() both return node identifiers. NOTNODEID (see CONSTANTS(5)) is returned if an error occurred. Likewise, IGNDTP() returns a valid node type or NOTNODETYPE in the case of error. The return values upon successful completion for the remaining functions are described above; they return -1 if an error occurs.

SEE ALSO
getroute(2), CONSTANTS(5)