![]()
Definition
MPI_Get_address retrieves the memory address of of the element given.
![]()
Parameters
- location
- The element to obtain the address of.
- address
- The variable in which store the address of the element passed.
![]()
Returned value
The error code returned from the memory address retrieval.
- MPI_SUCCESS
- The routine successfully completed.
#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;
}
![]()
Definition
MPI_Get_address retrieves the memory address of of the element given.
![]()
Parameters
- location
- The element to obtain the address of.
- address
- The variable in which store the address of the element passed.
- ierror
- The error code returned from the memory address retrieval.
!> @brief Illustrate how to obtain the address of an element.
PROGRAM main
USE mpi
IMPLICIT NONE
INTEGER :: ierror
INTEGER(KIND=MPI_ADDRESS_KIND) :: addr
INTEGER :: a(0:9)
CALL MPI_Init(ierror)
CALL MPI_Get_address(a(2), addr, ierror)
WRITE(*,'(A,I0,A)') 'The address of the third element is ', addr, '.'
CALL MPI_Finalize(ierror)
END PROGRAM main
![]()
Definition
MPI_Get_address retrieves the memory address of of the element given.
SUBROUTINE MPI_Get_address(location, address, ierror)
TYPE(*), DIMENSION(..), ASYNCHRONOUS :: location
INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(OUT) :: address
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
![]()
Parameters
- location
- The element to obtain the address of.
- address
- The variable in which store the address of the element passed.
- ierror [Optional]
- The error code returned from the memory address retrieval.
!> @brief Illustrate how to obtain the address of an element.
PROGRAM main
USE mpi_f08
IMPLICIT NONE
INTEGER(KIND=MPI_ADDRESS_KIND) :: addr
INTEGER :: a(0:9)
CALL MPI_Init()
CALL MPI_Get_address(a(2), addr)
WRITE(*,'(A,I0,A)') 'The address of the third element is ', addr, '.'
CALL MPI_Finalize()
END PROGRAM main