Addressing

C | Fortran-2008 | Fortran-90

MPI_Get_address

Parameters

location

The element to obtain the address of.

address

The variable in which store the address of the element passed.

Return value

The error code returned from the memory address retrieval.

Example

Copy

Feedback

#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>

/**
 * @brief Illustrate how to obtain the address of an element.
 **/
int main(int argc, char* argv[])
{
    MPI_Init(&argc, &argv);

    int a[10];

    MPI_Aint addr;
    MPI_Get_address(&a[2], &addr);

    printf("The address of the third element is %ld.\n", addr);

    MPI_Finalize();

    return EXIT_SUCCESS;
}