Copies vectors of data from a remote task to a local task.
Availability Library (liblapi_r.a)
#include <lapi.h>
int LAPI_Getv(hndl, tgt, tgt_vec, org_vec, tgt_cntr, org_cntr)
lapi_handle_t hndl;
uint tgt;
lapi_vec_t *tgt_vec;
lapi_vec_t *org_vec;
lapi_cntr_t *tgt_cntr;
lapi_cntr_t *org_cntr;
typedef struct {
lapi_vectype_t vec_type; /* operation code */
uint num_vecs; /* number of vectors */
void **info; /* vector of information */
ulong *len; /* vector of lengths */
} lapi_vec_t;
include 'lapif.h'
LAPI_GETV(hndl, tgt, tgt_vec, org_vec, tgt_cntr, org_cntr, ierror)
INTEGER hndl
INTEGER tgt
INTEGER (KIND=LAPI_ADDR_TYPE) :: tgt_vec
TYPE (LAPI_VEC_T) :: org_vec
INTEGER (KIND=LAPI_ADDR_TYPE) :: tgt_cntr
TYPE (LAPI_CNTR_T) :: org_cntr
INTEGER ierror
The
32-bit version of the LAPI_VEC_T type is
defined as: TYPE LAPI_VEC_T
SEQUENCE
INTEGER(KIND = 4) :: vec_type
INTEGER(KIND = 4) :: num_vecs
INTEGER(KIND = 4) :: info
INTEGER(KIND = 4) :: len
END TYPE LAPI_VEC_T
The 64-bit version of the LAPI_VEC_T type
is defined as: TYPE LAPI_VEC_T
SEQUENCE
INTEGER(KIND = 4) :: vec_type
INTEGER(KIND = 4) :: num_vecs
INTEGER(KIND = 8) :: info
INTEGER(KIND = 8) :: len
END TYPE LAPI_VEC_T
Type of call: point-to-point communication (non-blocking)
This subroutine is the vector version of the LAPI_Get call. Use LAPI_Getv to transfer vectors of data from the target task to the origin task. Both the origin and target vector descriptions are located in the address space of the origin task. But, the values specified in the info array of the target vector must be addresses in the address space of the target task.
The calling program cannot assume that the origin buffer can be changed or that the contents of the origin buffers on the origin task are ready for use upon function return. After the origin counter (org_cntr) is incremented, the origin buffers can be modified by the origin task. After the target counter (tgt_cntr) is incremented, the target buffers can be modified by the target task. If you provide a completion counter (cmpl_cntr), it is incremented at the origin after the target counter (tgt_cntr) has been incremented at the target. If the values of any of the counters or counter addresses are NULL (in C) or LAPI_ADDR_NULL (in FORTRAN), the data transfer occurs, but the corresponding counter increments do not occur.
LAPI does not check for any overlapping regions among vectors either at the origin or the target. If the overlapping regions exist on the origin side, the contents of the origin buffer are undefined after the operation.
See LAPI_Amsendv for details about commuication using different LAPI vector types. (LAPI_Getv does not support the LAPI_GEN_GENERIC type.)
{
/* retrieve a remote data buffer address for data to transfer, */
/* such as through LAPI_Address_init */
/* task that calls LAPI_Getv sets up both org_vec and tgt_vec */
org_vec->num_vecs = NUM_VECS;
org_vec->vec_type = LAPI_GEN_IOVECTOR;
org_vec->len = (unsigned long *)
malloc(NUM_VECS*sizeof(unsigned long));
org_vec->info = (void **) malloc(NUM_VECS*sizeof(void *));
/* each org_vec->info[i] gets a base address on the origin task */
/* each org_vec->len[i] gets the number of bytes to write to */
/* org_vec->info[i] */
tgt_vec->num_vecs = NUM_VECS;
tgt_vec->vec_type = LAPI_GEN_IOVECTOR;
tgt_vec->len = (unsigned long *)
malloc(NUM_VECS*sizeof(unsigned long));
tgt_vec->info = (void **) malloc(NUM_VECS*sizeof(void *));
/* each tgt_vec->info[i] gets a base address on the target task */
/* each tgt_vec->len[i] gets the number of bytes to transfer */
/* from vec->info[i] */
/* For LAPI_GEN_IOVECTOR, num_vecs, vec_type, and len must be */
/* the same */
LAPI_Getv(hndl, tgt, tgt_vec, org_vec, tgt_cntr, org_cntr);
/* tgt_cntr and org_cntr can both be NULL */
/* data will be retrieved as follows: */
/* org_vec->len[0] bytes will be retrieved from */
/* tgt_vec->info[0] and written to org_vec->info[0] */
/* org_vec->len[1] bytes will be retrieved from */
/* tgt_vec->info[1] and written to org_vec->info[1] */
.
.
.
/* org_vec->len[NUM_VECS-1] bytes will be retrieved */
/* from tgt_vec->info[NUM_VECS-1] and written to */
/* org_vec->info[NUM_VECS-1] */
}
For examples of other vector types, see LAPI_Amsendv.