User`s guide
Cray XMT™ Programming Environment User’s Guide
Procedure 3. Creating and using a LUC client object
1. Include the header file <luc/luc_exported.h>. This header file includes
all of the definitions required for both the client and server endpoints, including
the LucEndpoint class definition, configuration variables, and external
function prototype definitions.
2. Declare a pointer to a LucEndpoint object. A LucEndpoint is the
abstract base class for both the Linux and MTK implementations of LUC
endpoints and defines the user interface as virtual functions. Internal to
the LUC implementation, there are two subclasses that are derived from
the LucEndpoint abstract class: LucPortalsEndpoint is the Linux
implementation, and LucFioEndpoint is the MTK implementation. These
derived classes implement the virtual functions for either Linux/Portals or
MTK/FAST I/O. From the user-application perspective, both derived classes
present an identical interface.
3. Allocate the object by calling luc_allocate_endpoint(). This function
takes a service type as an argument and allocates the correct LucEndpoint
derived class object. When compiling for a Linux node, the Linux version of
the object is returned. When compiling for an MTK node, the MTK version of
the object is returned.
4. Activate the client endpoint by calling startService. This causes LUC to
allocate a system wide unique endpoint identifier and to allocate the underlying
Fast I/O data streams. If an error is encountered while activating the service,
LUC returns an error code
5. Prepare the input and output buffers. The input buffer is provided as input to
the remote server function. The output buffer contains the output data from the
remote server function. The buffers may reside in nearby or global distributed
memory.
6. Invoke a remote function synchronously by calling remoteCallSync; provide
the server endpoint identifier, the service type, the function index, and the input
and output buffers and lengths. The outputDataLen parameter specifies the
size of the data buffer provided by the caller. On return from the function, this
parameter will contain the actual size of the output data, which is less than or
equal to the original value provided by the caller.
7. The service type and function index are application defined and can be any
integer value. As illustrated in the example that follows, the function indices
need not be consecutive. The service types describe the type of service provided
by the object.
8. Wait for the remote function to complete and then process the result. The
remoteCallSync() method will not return until the remote function has
completed or an error has occurred. The return value from remoteCallSync
is either a LUC error code or the return value from the remote function.
54 S–2479–20