Serves as a wrapper function for LAPI data transfer functions.
Availability Library (liblapi_r.a)
#include <lapi.h>
int LAPI_Xfer(hndl, xfer_cmd)
lapi_handle_t hndl;
lapi_xfer_t *xfer_cmd;
typedef struct {
uint src; /* Target task ID */
uint reason; /* LAPI return codes */
ulong reserve[6]; /* Reserved */
} lapi_sh_info_t;
typedef void (scompl_hndlr_t)(lapi_handle_t *hndl, void *completion_param,
lapi_sh_info_t *info);
include 'lapif.h'
LAPI_XFER(hndl, xfer_cmd, ierror)
INTEGER hndl
TYPE (fortran_xfer_type) :: xfer_cmd
INTEGER ierror
Type of call: point-to-point communication (non-blocking)
The LAPI_Xfer subroutine provides a superset of the functionality of these subroutines: LAPI_Amsend, LAPI_Amsendv, LAPI_Put, LAPI_Putv, LAPI_Get, LAPI_Getv, and LAPI_Rmw. In addition, LAPI_Xfer provides data gather/scatter program (DGSP) messages transfer.
In C, the LAPI_Xfer command is passed a pointer to a union. It examines the first member of the union, Xfer_type, to determine the transfer type, and to determine which union member was passed. LAPI_Xfer expects every field of the identified union member to be set. It does not examine or modify any memory outside of the identified union member. LAPI_Xfer treats all union members (except status) as read-only data.
typedef union {
lapi_xfer_type_t Xfer_type;
lapi_get_t Get;
lapi_am_t Am;
lapi_rmw_t Rmw;
lapi_put_t Put;
lapi_getv_t Getv;
lapi_putv_t Putv;
lapi_amv_t Amv;
lapi_amdgsp_t Dgsp;
} lapi_xfer_t;
Though the lapi_xfer_t structure
applies only to the C version of LAPI_Xfer,
the following tables include the FORTRAN equivalents of the C datatypes.Value of Xfer_type (C or FORTRAN) | Union member as interpreted by LAPI_Xfer (C) | Value of fortran_xfer_type (FORTRAN) |
---|---|---|
LAPI_AM_XFER | lapi_am_t | LAPI_AM_T |
LAPI_AMV_XFER | lapi_amv_t | LAPI_AMV_T |
LAPI_DGSP_XFER | lapi_amdgsp_t | LAPI_AMDGSP_T |
LAPI_GET_XFER | lapi_get_t | LAPI_GET_T |
LAPI_GETV_XFER | lapi_getv_t | LAPI_GETV_T |
LAPI_PUT_XFER | lapi_put_t | LAPI_PUT_T |
LAPI_PUTV_XFER | lapi_putv_t | LAPI_PUTV_T |
LAPI_RMW_XFER | lapi_rmw_t | LAPI_RMW_T |
lapi_am_t details
lapi_am_t field name (C) | lapi_am_t field type (C) | Equivalent FORTRAN datatype | Equivalent LAPI_Amsend parameter |
---|---|---|---|
Xfer_type | lapi_xfer_type_t | INTEGER(KIND = 4) | implicit in C LAPI_Xfer value in FORTRAN: LAPI_AM_XFER |
flags | int | INTEGER(KIND = 4) | none LAPI_Xfer parameter in FORTRAN: flags |
tgt | uint | INTEGER(KIND = 4) | tgt |
none | none | INTEGER(KIND = 4) | LAPI_Xfer parameter in FORTRAN: pad |
hdr_hdl | lapi_long_t | INTEGER(KIND = 8) | hdr_hdl |
uhdr_len | uint | INTEGER(KIND = 4) | uhdr_len |
none | none | INTEGER(KIND = 4) | LAPI_Xfer parameter in FORTRAN (64-bit): pad2 |
uhdr | void * | INTEGER(KIND = 4) (32-bit) |
uhdr |
udata | void * | INTEGER(KIND = 4) (32-bit) |
udata |
udata_len | ulong | INTEGER(KIND = 4) (32-bit) |
udata_len |
shdlr | scompl_hndlr_t * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: shdlr |
sinfo | void * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: sinfo |
tgt_cntr | lapi_long_t | INTEGER(KIND = 8) | tgt_cntr |
org_cntr | lapi_cntr_t * | INTEGER(KIND = 4) (32-bit) |
org_cntr |
cmpl_cntr | lapi_cntr_t * | INTEGER(KIND = 4) (32-bit) |
cmpl_cntr |
lapi_amv_t details
lapi_amv_t field name (C) | lapi_amv_t field type (C) | Equivalent FORTRAN datatype | Equivalent LAPI_Amsendv parameter |
---|---|---|---|
Xfer_type | lapi_xfer_type_t | INTEGER(KIND = 4) | implicit in C LAPI_Xfer value in FORTRAN: LAPI_AMV_XFER |
flags | int | INTEGER(KIND = 4) | none LAPI_Xfer parameter in FORTRAN: flags |
tgt | uint | INTEGER(KIND = 4) | tgt |
none | none | INTEGER(KIND = 4) | LAPI_Xfer parameter in FORTRAN: pad |
hdr_hdl | lapi_long_t | INTEGER(KIND = 8) | hdr_hdl |
uhdr_len | uint | INTEGER(KIND = 4) | uhdr_len |
none | none | INTEGER(KIND = 4) | LAPI_Xfer parameter in FORTRAN (64-bit): pad2 |
uhdr | void * | INTEGER(KIND = 4) (32-bit) |
uhdr |
shdlr | scompl_hndlr_t * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: shdlr |
sinfo | void * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: sinfo |
org_vec | lapi_vec_t * | INTEGER(KIND = 4) (32-bit) |
org_vec |
none | none | INTEGER(KIND = 4) | LAPI_Xfer parameter in FORTRAN (32-bit): pad2 |
tgt_cntr | lapi_long_t | INTEGER(KIND = 8) | tgt_cntr |
org_cntr | lapi_cntr_t * | INTEGER(KIND = 4) (32-bit) |
org_cntr |
cmpl_cntr | lapi_cntr_t * | INTEGER(KIND = 4) (32-bit) |
cmpl_cntr |
lapi_amdgsp_t details
lapi_amdgsp_t field name (C) | lapi_amdgsp_t field type (C) | Equivalent FORTRAN datatype | LAPI_Xfer usage |
---|---|---|---|
Xfer_type | lapi_xfer_type_t | INTEGER(KIND = 4) | LAPI_DGSP_XFER |
flags | int | INTEGER(KIND = 4) | This field allows users to specify directives or hints to LAPI. If you do not want to use any directives or hints, you must set this field to 0. See The lapi_amdgsp_t flags field for more information. |
tgt | uint | INTEGER(KIND = 4) | target task |
none | none | INTEGER(KIND = 4) | pad (padding alignment for FORTRAN only) |
hdr_hdl | lapi_long_t | INTEGER(KIND = 8) | header handler to invoke at target |
uhdr_len | uint | INTEGER(KIND = 4) | user header length (multiple of processor's doubleword size) |
none | none | INTEGER(KIND = 4) | pad2 (padding alignment for 64-bit FORTRAN only) |
uhdr | void * | INTEGER(KIND = 4) (32-bit) |
pointer to user header |
udata | void * | INTEGER(KIND = 4) (32-bit) |
pointer to user data |
udata_len | ulong | INTEGER(KIND = 4) (32-bit) |
user data length |
shdlr | scompl_hndlr_t * | INTEGER(KIND = 4) (32-bit) |
send completion handler (optional) |
sinfo | void * | INTEGER(KIND = 4) (32-bit) |
data pointer to pass to send completion handler (optional) |
tgt_cntr | lapi_long_t | INTEGER(KIND = 8) | target counter (optional) |
org_cntr | lapi_cntr_t * | INTEGER(KIND = 4) (32-bit) |
origin counter (optional) |
cmpl_cntr | lapi_cntr_t * | INTEGER(KIND = 4) (32-bit) |
completion counter (optional) |
dgsp | lapi_dg_handle_t | INTEGER(KIND = 4) (32-bit) |
Handle of a registered DGSP |
status | lapi_status_t | INTEGER(KIND = 4) (32-bit) |
Status to return (future use) |
none | none | INTEGER(KIND = 4) | pad3 (padding alignment for 64-bit FORTRAN only) |
When the origin data buffer is free to be modified, the send completion handler (shdlr) is called with the send completion data (sinfo), if shdlr is not a NULL pointer (in C) or LAPI_ADDR_NULL (in FORTRAN).
See Using lapi_am_dgsp_t for scatter-side DGSP processing for more information.
The lapi_amdgsp_t flags field
One or more flags can be set using the | (bitwise or) operator. User directives are always followed and could result in incorrect results if used improperly. Appropriate hints might improve performance, but they may be ignored by LAPI. Inappropriate hints might degrade performance, but they will not cause incorrect results.
These hints may or may not be honored by the communication library.
Using lapi_am_dgsp_t for scatter-side DGSP processing
Beginning with AIX® 5.2, LAPI allows additional information to be returned from the header handler through the use of the lapi_return_info_t datatype. See RSCT for AIX 5L™: LAPI Programming Guide for more information about lapi_return_info_t. In the case of transfer type lapi_am_dgsp_t, this mechanism can be used to instruct LAPI to run a user DGSP to scatter data on the receive side.
To use this mechanism, pass a lapi_return_info_t * pointer back to LAPI through the msg_len member of the user header handler. The dgsp_handle member of the passed structure must point to a DGSP description that has been registered on the receive side. See LAPI_Util and RSCT for AIX 5L: LAPI Programming Guide for details on building and registering DGSPs.
lapi_get_t details
lapi_get_t field name (C) | lapi_get_t field type (C) | Equivalent FORTRAN datatype | Equivalent LAPI_Get parameter |
---|---|---|---|
Xfer_type | lapi_xfer_type_t | INTEGER(KIND = 4) | implicit in C LAPI_Xfer value in FORTRAN: LAPI_GET_XFER |
flags | int | INTEGER(KIND = 4) | none LAPI_Xfer parameter in FORTRAN: flags |
tgt | uint | INTEGER(KIND = 4) | tgt |
none | none | INTEGER(KIND = 4) | LAPI_Xfer parameter in FORTRAN: pad |
tgt_addr | lapi_long_t | INTEGER(KIND = 8) | tgt_addr |
org_addr | void * | INTEGER(KIND = 4) (32-bit) |
org_addr |
len | ulong | INTEGER(KIND = 4) (32-bit) |
len |
tgt_cntr | lapi_long_t | INTEGER(KIND = 8) | tgt_cntr |
org_cntr | lapi_cntr_t * | INTEGER(KIND = 4) (32-bit) |
org_cntr |
chndlr | compl_hndlr_t * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: chndlr |
cinfo | void * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: cinfo |
lapi_getv_t details
lapi_getv_t field name (C) | lapi_getv_t field type (C) | Equivalent FORTRAN datatype | Equivalent LAPI_Getv parameter |
---|---|---|---|
Xfer_type | lapi_xfer_type_t | INTEGER(KIND = 4) | implicit in C LAPI_Xfer value in FORTRAN: LAPI_GETV_XFER |
flags | int | INTEGER(KIND = 4) | none LAPI_Xfer parameter in FORTRAN: flags |
tgt | uint | INTEGER(KIND = 4) | tgt |
none | none | INTEGER(KIND = 4) | LAPI_Xfer parameter in FORTRAN (64-bit): pad |
org_vec | lapi_vec_t * | INTEGER(KIND = 4) (32-bit) |
org_vec |
tgt_vec | void * | INTEGER(KIND = 4) (32-bit) |
tgt_vec |
none | none | INTEGER(KIND = 4) | LAPI_Xfer parameter in FORTRAN (32-bit): pad |
tgt_cntr | lapi_long_t | INTEGER(KIND = 8) | tgt_cntr |
org_cntr | lapi_cntr_t * | INTEGER(KIND = 4) (32-bit) |
org_cntr |
chndlr | compl_hndlr_t * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: chndlr |
cinfo | void * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: cinfo |
none | none | INTEGER(KIND = 4) | LAPI_Xfer parameter in FORTRAN (32-bit): pad2 |
When the origin data buffer has completely arrived, the pointer to the completion handler (chndlr) is called with the completion data (cinfo) if chndlr is not a NULL pointer (in C) or LAPI_ADDR_NULL (in FORTRAN). Otherwise, the behavior is identical to that of LAPI_Getv.
lapi_put_t details
lapi_put_t field name (C) | lapi_put_t field type (C) | Equivalent FORTRAN datatype | Equivalent LAPI_Put parameter |
---|---|---|---|
Xfer_type | lapi_xfer_type_t | INTEGER(KIND = 4) | implicit in C LAPI_Xfer value in FORTRAN: LAPI_PUT_XFER |
flags | int | INTEGER(KIND = 4) | none LAPI_Xfer parameter in FORTRAN: flags |
tgt | uint | INTEGER(KIND = 4) | tgt |
none | none | INTEGER(KIND = 4) | LAPI_Xfer parameter in FORTRAN: pad |
tgt_addr | lapi_long_t | INTEGER(KIND = 8) | tgt_addr |
org_addr | void * | INTEGER(KIND = 4) (32-bit) |
org_addr |
len | ulong | INTEGER(KIND = 4) (32-bit) |
len |
shdlr | scompl_hndlr_t * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: shdlr |
sinfo | void * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: sinfo |
tgt_cntr | lapi_long_t | INTEGER(KIND = 8) | tgt_cntr |
org_cntr | lapi_cntr_t * | INTEGER(KIND = 4) (32-bit) |
org_cntr |
cmpl_cntr | lapi_cntr_t * | INTEGER(KIND = 4) (32-bit) |
cmpl_cntr |
lapi_putv_t details
lapi_putv_t field name (C) | lapi_putv_t field type (C) | Equivalent FORTRAN datatype | Equivalent LAPI_Putv parameter |
---|---|---|---|
Xfer_type | lapi_xfer_type_t | INTEGER(KIND = 4) | implicit in C LAPI_Xfer value in FORTRAN: LAPI_PUT_XFER |
flags | int | INTEGER(KIND = 4) | none LAPI_Xfer parameter in FORTRAN: flags |
tgt | uint | INTEGER(KIND = 4) | tgt |
none | none | INTEGER(KIND = 4) | LAPI_Xfer parameter in FORTRAN (64-bit): pad |
shdlr | scompl_hndlr_t * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: shdlr |
sinfo | void * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: sinfo |
org_vec | lapi_vec_t * | INTEGER(KIND = 4) (32-bit) |
org_vec |
tgt_vec | void * | INTEGER(KIND = 4) (32-bit) |
tgt_vec |
none | none | INTEGER(KIND = 4) | LAPI_Xfer parameter in FORTRAN (32-bit): pad |
tgt_cntr | lapi_long_t | INTEGER(KIND = 8) | tgt_cntr |
org_cntr | lapi_cntr_t * | INTEGER(KIND = 4) (32-bit) |
org_cntr |
cmpl_cntr | lapi_cntr_t * | INTEGER(KIND = 4) (32-bit) |
cmpl_cntr |
When the origin data buffer is free to be modified, the pointer to the send completion handler (shdlr) is called with the send completion data (sinfo), if shdlr is not a NULL pointer (in C) or LAPI_ADDR_NULL (in FORTRAN). Otherwise, the behavior is identical to that of LAPI_Putv.
lapi_rmw_t details
lapi_rmw_t field name (C) | lapi_rmw_t field type (C) | Equivalent FORTRAN datatype | Equivalent LAPI_Rmw parameter |
---|---|---|---|
Xfer_type | lapi_xfer_type_t | INTEGER(KIND = 4) | implicit in C LAPI_Xfer value in FORTRAN: LAPI_RMW_XFER |
op | Rmw_ops_t | INTEGER(KIND = 4) | op |
tgt | uint | INTEGER(KIND = 4) | tgt |
size | uint | INTEGER(KIND = 4) | implicit in C LAPI_Xfer parameter in FORTRAN: size (must be 32 or 64) |
tgt_var | lapi_long_t | INTEGER(KIND = 8) | tgt_var |
in_val | void * | INTEGER(KIND = 4) (32-bit) |
in_val |
prev_tgt_val | void * | INTEGER(KIND = 4) (32-bit) |
prev_tgt_val |
org_cntr | lapi_cntr t * | INTEGER(KIND = 4) (32-bit) |
org_cntr |
shdlr | scompl_hndlr_t * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: shdlr |
sinfo | void * | INTEGER(KIND = 4) (32-bit) |
none LAPI_Xfer parameter in FORTRAN: shdlr |
none | none | INTEGER(KIND = 4) | LAPI_Xfer parameter in FORTRAN (32-bit): pad |
Parameters
Return Values
Note: if Xfer_type = LAPI_DGSP_XFER, the case in which udata is NULL (in C) or LAPI_ADDR_NULL (in FORTRAN) and udata_len is greater than 0 is valid, so an error is not returned.
C Examples
{
lapi_xfer_t xfer_struct;
/* initialize the table buffer for the data addresses */
/* get remote data buffer addresses */
LAPI_Address_init(hndl,(void *)data_buffer,data_buffer_list);
.
.
.
/* retrieve data_len bytes from address data_buffer_list[tgt] on */
/* task tgt. write the data starting at address data_buffer. */
/* tgt_cntr and org_cntr can be NULL. */
xfer_struct.Get.Xfer_type = LAPI_GET_XFER;
xfer_struct.Get.flags = 0;
xfer_struct.Get.tgt = tgt;
xfer_struct.Get.tgt_addr = data_buffer_list[tgt];
xfer_struct.Get.org_addr = data_buffer;
xfer_struct.Get.len = data_len;
xfer_struct.Get.tgt_cntr = tgt_cntr;
xfer_struct.Get.org_cntr = org_cntr;
LAPI_Xfer(hndl, &xfer_struct);
}
{
lapi_xfer_t xfer_struct; /* info for LAPI_Xfer call */
lapi_vec_t vec; /* data for data transfer */
.
.
.
vec->num_vecs = NUM_VECS; /* NUM_VECS = number of vectors to transfer */
/* must match that of the target vector */
vec->vec_type = LAPI_GEN_STRIDED_XFER; /* same as target vector */
vec->info[0] = buffer_address; /* starting address for data copy */
vec->info[1] = block_size; /* bytes of data to copy */
vec->info[2] = stride; /* distance from copy block to copy block */
/* data will be copied as follows: */
/* block_size bytes will be copied from buffer_address */
/* block_size bytes will be copied from buffer_address+stride */
/* block_size bytes will be copied from buffer_address+(2*stride) */
/* block_size bytes will be copied from buffer_address+(3*stride) */
.
.
.
/* block_size bytes will be copied from buffer_address+((NUM_VECS-1)*stride) */
.
.
.
xfer_struct.Amv.Xfer_type = LAPI_AMV_XFER;
xfer_struct.Amv.flags = 0;
xfer_struct.Amv.tgt = tgt;
xfer_struct.Amv.hdr_hdl = hdr_hdl_list[tgt];
xfer_struct.Amv.uhdr_len = uhdr_len; /* user header length */
xfer_struct.Amv.uhdr = uhdr;
/* LAPI_AMV_XFER allows the use of a send completion handler */
/* If non-null, the shdlr function is invoked at the point */
/* the origin counter would increment. Note that both the */
/* org_cntr and shdlr can be used. */
/* The user's shdlr must be of type scompl_hndlr_t *. */
/* scompl_hndlr_t is defined in /usr/include/lapi.h */
xfer_struct.shdlr = shdlr;
/* Use sinfo to pass user-defined data into the send */
/* completion handler, if desired. */
xfer_struct.sinfo = sinfo; /* send completion data */
xfer_struct.org_vec = vec;
xfer_struct.tgt_cntr = tgt_cntr;
xfer_struct.org_cntr = org_cntr;
xfer_struct.cmpl_cntr = cmpl_cntr;
LAPI_Xfer(hndl, &xfer_struct);
.
.
.
}
Location