NXS Message-Passing Library
The NXS library is a small subset of the NX library provided by
Intel Corporation for their parallel computers.
The NXS library was developed for use with the
UNH C* system.
However, it can also be used for "directly" programming the
Galaxy
cluster.
The NXS library provides the following primitives:
- long numnodes(void): returns the number of processors
participating in the parallel computation.
- long mynode(void): returns the logical number
(0 ... numnodes()-1) of the processor executing the
call.
- void csend(long type, char *buf, long len, long node,
long pid): sends a message to another processor. This is
a non-blocking send: the message will be copied and queued for
transmission; return of this function does not imply the message
has been received at the destination processor.
A description of the parameters follows:
- type - user specified message type that can be used by the receiver to
selectively receive messages.
- buf - source of message, which must be a string of contiguous bytes.
- len - length of the message, which must not exceed CS__MESSAGE_LIMIT.
- node - logical number of the destination processor.
- pid - should always be set to zero.
Note: It is considered an error for a node to send
a message to itself.
- void crecv(long typesel, char *buf, long len): receive
a message. This is a blocking send: the function will not return until
a message with the matching type is received and copied to the given
buffer.
A description of the parameters follows:
- typesel - message type selector.
- buf - buffer in which to place the message.
- len - length of the buffer.
Note: it is an error to receive a message that is longer than the length
of the buffer.
- long iprobe(long typesel): check for the availability
of a message matching the given type selector. Returns 1 is a matching
message is available; returns 0 otherwise.
- long infocount(void): returns the length of the last
message received or the length of the last message found by iprobe.
- void gsync(void): the function synchronizes all processors
participating in the parallel computation. All processors must call this
function together, otherwise the computation will block forever.
IMPORTANT: Either numnodes() or
mynode() must be called before any other NXS primitive.
These routines will initialize the message-passing library, if it is not
already initialized.
You should include nxs.h in any source file using the
NXS library.
Programs using NXS should be compiled using the UNH C* driver.
The UNH C* driver will locate the NXS header file, will call the C compiler,
and will link with the NXS library.
See the
Galaxy
cluster homepage for details on accessing the UNH C* driver.
CAUTION: The UNH C* driver, by default, provides C*
versions of the ANSI stdio routines.
To use the conventional stdio routines with NXS programs, define
the symbol CS__NO_STDIO before including stdio.h.
The C* versions of the stdio routines must be executed by all processors.
The processors are synchronized for each operation so that only processor 0
actually does the I/O.
The side effects of the I/O operation are then broadcast to the other
processors.
If you use the C* stdio library with a NXS program, you must call
numnodes() or mynode() prior to invoking any I/O
operation.
Last modified on October 3, 1996.
Comments and questions should be directed to
pjh@cs.unh.edu