7.2.12 _gfortran_caf_get_remote_function_index — Get the index of an accessor

Synopsis:

int _gfortran_caf_get_remote_function_index (const int hash)

Description:

Return the index of the accessor in the lookup table build by _gfortran_caf_register_accessor — Register an accessor for remote access and _gfortran_caf_register_accessors_finish — Finish registering accessor functions. This function is expected to be fast, because it may be called often. A log(N) lookup time for a given hash is preferred. The reference implementation uses bsearch (), for example. The index returned shall be an array index to be used by _gfortran_caf_get_from_remote — Getting data from a remote image using a remote side accessor, i.e. a constant time operation is mandatory for quick access.

The GFortran compiler ensures that _gfortran_caf_get_remote_function_index is called once only for each hash and the result be stored in a static variable to prevent future redundant lookups.

Arguments:
hashintent(in) The hash of the accessor desired.
Result:

The zero based index to access the accessor funtion in a lookup table. On error, -1 can be returned.

Notes:

The function’s complexity is expected to be significantly smaller than N, where N is the number of all accessors registered. Although returning -1 is valid, will this most likely crash the Fortran program when accessing the -1-th accessor function. It is therefore advised to terminate with an error message, when the hash could not be found.