# 5.2.63 hdfql_mpi_get_rank

Part of: [5 Application Programming Interface](5-application-programming-interface.md) › [5.2 Functions](5-2-functions.md)

### Syntax

int hdfql_mpi_get_rank(void)

### Description

Get the rank of the calling process associated with the default MPI communicator (MPI_COMM_WORLD) or with a user-defined MPI communicator (that may have been set through the function [hdfql_mpi_use_communicator](5-2-60-hdfql-mpi-use-communicator.md)). Of note, the function is essentially a wrapper for the MPI function “MPI_Comm_rank” (please refer to <https://www.mpich.org/static/docs/v3.4/www3/MPI_Comm_rank.html> or <https://www.open-mpi.org/doc/v3.1/man3/MPI_Comm_rank.3.php> for additional information in case the MPI library used is MPICH or Open MPI, respectively).

### Parameter(s)

None

### Return

int – depending on the success in getting the rank of the calling process associated with the default MPI communicator (MPI_COMM_WORLD) or with a user-defined MPI communicator, it can be equal to or greater than zero (i.e. the rank of the calling process), [HDFQL_ERROR_NOT_SUPPORTED](5-1-constants.md#hdfql_error_not_supported) (in case MPI itself was not initialized properly or when using an HDFql non MPI-based distribution), or [HDFQL_ERROR_UNKNOWN](5-1-constants.md#hdfql_error_unknown).

### Example(s)

```c
// display rank of the MPI process (if the program (that employs HDFql) is launched as, e.g., "mpiexec -n 3 ./my_program", the message "Rank of the MPI process is X" will be displayed three times where X is 0, 1, or 2 (not necessarily in this order))
printf("Rank of the MPI process is %d\n", hdfql_mpi_get_rank());
```
