[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following miscellaneous library functions are provided. Several are simply cover functions for standard Unix library functions, but are provided to simplify the creation of portable GM programs, or to provide the ANSI functionality on non-ANSI systems, such as Windows NT.
abort()
. Aborts the current process.
priority
previously freed with gm_free_send_token()
or
returns 0
if no token is available. Clients may choose to maintain
their own send token counts without using this utility function.
gm_directed_send()
function. This is a
significant security hole, but is very useful on tightly coupled
clusters on trusted networks.
gm_blocking_receive()
, only
it sleeps the current thread immediately if no receive is pending. It
is well suited to applications with more than one CPU-intensive thread
per processor.
gm_mtu(port)
If any network error is encountered while sending the packet, the packet
is silently and immediately dropped. After the packet has been DMA'd
from host memory,
callback(port,context,status)
is called
inside a user invokation of gm_unknown()
, reporting the
status of the attempted send.
gm_register_memory()
.
gm_directed_send_with_callback()
instead.
Transfer the len bytes at source_buffer to
target_port_id on target_node_id with priority
priority and store the data at the remote virtual memory address
target_buffer. The order of the transfer is preserved
relative to messages of the same priority sent using gm_send()
or gm_send_to_peer()
.
callback(port,context,status)
when the
send completes or fails, with status indicating the status of the
send. The order of the transfer is preserved relative to messages of
the same priority sent using gm_send()
or
gm_send_to_peer()
.
gm_dma_calloc()
or gm_dma_malloc()
. Note that the memory is not necessarily
unlocked and returned to the operating system, but may be reused in
future calls to gm_dma_calloc()
and gm_dma_malloc()
.
GM_SEND_DROPPED
. This function requires a send token, which
is implicitly returned to the caller when the callback is called.
status
.
gm_finalize()
should be matched by a call to gm_init()
.
gm_malloc()
, or gm_calloc()
.
gm_alloc_pages()
.
priority
for port
so that it can later be allocated
using gm_alloc_send_token()
. Clients may choose to maintain their
own count of send tokens in the client's possession instead of using
this utility function.
gm_free_send_token()
, but can be used to free zero or more tokens.
*
n.
GM_DIRECTED_SEND_NOTIFICATION
event is received, programs
may optionally call this function instead of gm_unknown()
as an
optimization for handling send completions more efficiently. This
function does not improve performance on newer hardware, which does not
generate GM_DIRECTED_SEND_NOTIFICATION
events.
GM_DIRECTED_SEND_NOTIFICATION
event is
received, programs may optionally call this function instead of
gm_unknown()
as an optimization for handling send completions
more efficiently. This function does not improve performance on newer
hardware, which does not generate GM_DIRECTED_SEND_NOTIFICATION
events.
GM_NO_SUCH_NODE_ID
in case of an error.
GM_PAGE_LEN
). Each
call to gm_init()
should be matched by a call to gm_finalize()
.
(5)
gm_free()
.
*
n.
*n
.
memcmp()
function.
FAST
" receive
messages as described in See section 9. Receiving Messages. If message
and buffer differ, gm_memorize_message(port,
message,buffer)
copies the message pointed to by
message into the buffer pointed to by buffer.
gm_memorize_message()
returns buffer. This function is
optimized for performing such aligned copies.
on_exit()
, this functions registers a callback so
that callback(status,arg)
is called when the
program exits. Callbacks are called in the reverse of the order of
registration. This function is also somewhat similar to BSD
atexit()
.
*
p. This pointer must be passed to all
subsequent functions that operate on the opened port. port_name
is a null-terminated ASCII string that is used to identify the port
client for debugging (and potentially other) purposes; pass in the
name of your program.
Note that unit and port numbers start at 0, and that ports 0 and 1 reserved, so clients will usually open ports 2 and higher.
gm_page_alloc()
.
perror
, but takes the error code as a
parameter to allow thread safety in future implementations, and only
supports GM error numbers. Prints message followed by a
description of errno.
printf()
function.
gm_provide_receive_buffer_with_tag(...,0)
, and
no faster than doing so. It is included for backwards compatibility. Many
new clients will want to use gm_provide_receive_buffer_with_tag()
instead.
size
and priority
fields. It is the
client software's responsibility to provide buffers of each size
and priority that might be received; not doing so can cause
program deadlock, which will eventually result in the port being closed
after a timeout(6).
The client software may provide up to gm_num_receive_tokens()
different
receive buffers into which messages may be received.
Each buffer provided by the client software to GM via this function will
be used only once to receive a message. In other words, calling
gm_provide_receive_buffer(port, buffer, size,
priority)
provides GM a token to receive a single message of size
size and priority priority into the receive buffer
buffer. When a message is eventually received into this buffer,
gm_receive(port)
stores the buffer pointer buffer and
tag in the returned event, returning control of the buffer
(token) to the client software. If the client software wishes for the
buffer to be reused for a similar receive, it must call
gm_provide_receive_buffer()
again with the same or similar
parameters.
Once a buffer has been provided to GM, its content should not be changed
until control of the buffer has been returned to the client software via
gm_receive()
.
The tag parameter must be in the range [0,255], and is returned in the receive event describing a receive into the buffer. It may be used in any way the client desires, and need not be unique.
GM_NO_RECV_EVENT
is immediately returned.
gm_receive*)()
function will return the
event immediately, although gm_receive()
is preferred in this
case for efficiency.
gm_receive*)()
function will return the
event immediately, although gm_receive()
is preferred in this
case for efficiency.
gm_deregister_memory()
. Note that memory registration is an
expensive operation relative to sending and receiving packets, so you
should use persistent memory registrations wherever possible. Also note
that memory registration is not supported on Solaris due to operating
system limitations.
Queues the message of length len to be sent with priority
priority to node target_node_id. Before calling
gm_send()
, client software must first possess a send token of the
same priority, and by calling gm_send ()
the client implicitly
relinquishes this send token. After a call to gm_send(...,
message, len, ...)
, the memory specified by message
and len must not be modified until the send completes. The buffer
pointed to by message is not modified by GM between the time
gm_send(port, message,...)
is called and the time
that the sent message pointer appears in a GM_SENT_EVENT
.
gm_send()
, client software must first possess a send token of the
same priority, and by calling gm_send ()
the client implicitly
relinquishes this send token. After a call to gm_send(...,
message, len, ...)
, the memory specified by message
and len must not be modified until the send completes. After the
send completes,
callback(port,context,status)
will be
called inside gm_unknown()
, with status indicating the
status of the completed send. The buffer pointed to by message
should not be modified by GM between the time gm_send(port,
message,...)
is called and the time that the sent completes.
Like gm_send()
, only with the target_node_id implicitly set
to the same ID as port. This function is marginally faster than
gm_send()
.
gm_send_with_callback()
, only with the target_node_id
implicitly set to the same ID as port. This function is
marginally faster than gm_send_with_callback()
.
gm_alloc_send_token(port, priority)
would
return, without actually allocating a send token. This function allows
client software to test for the availability of a send token without
actually allocating the send token.
sleep()
, sleeping the entire process for
seconds seconds.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |