7.2.12 _gfortran_caf_get — Getting data from a remote image


Called to get an array section or a whole array from a remote, image identified by the image_index.


void _gfortran_caf_get (caf_token_t token, size_t offset, int image_index, gfc_descriptor_t *src, caf_vector_t *src_vector, gfc_descriptor_t *dest, int src_kind, int dst_kind, bool may_require_tmp, int *stat)

tokenintent(in) An opaque pointer identifying the coarray.
offsetintent(in) By which amount of bytes the actual data is shifted compared to the base address of the coarray.
image_indexintent(in) The ID of the remote image; must be a positive number.
destintent(out) Array descriptor of the local array to store the data retrieved from the remote image
srcintent(in) Array descriptor for the remote image for the bounds and the size. The base_addr shall not be accessed.
src_vectorintent(in) If not NULL, it contains the vector subscript of the source array; the values are relative to the dimension triplet of the src argument.
dst_kindintent(in) Kind of the destination argument
src_kindintent(in) Kind of the source argument
may_require_tmpintent(in) The variable is false when it is known at compile time that the dest and src either cannot overlap or overlap (fully or partially) such that walking src and dest in element wise element order (honoring the stride value) will not lead to wrong results. Otherwise, the value is true.
statintent(out) When non-NULL give the result of the operation, i.e., zero on success and non-zero on error. When NULL and an error occurs, then an error message is printed and the program is terminated.

It is permitted to have image_index equal the current image; the memory of the send-to and the send-from might (partially) overlap in that case. The implementation has to take care that it handles this case, e.g. using memmove which handles (partially) overlapping memory. If may_require_tmp is true, the library might additionally create a temporary variable, unless additional checks show that this is not required (e.g. because walking backward is possible or because both arrays are contiguous and memmove takes care of overlap issues).

Note that the library has to handle numeric-type conversion and for strings, padding and different character kinds.