flux_get_rank(3)
SYNOPSIS
#include <flux/core.h>
int flux_get_rank (flux_t *h, uint32_t *rank);
int flux_get_size (flux_t *h, uint32_t *size);
Link with -lflux-core.
DESCRIPTION
flux_get_rank()
and flux_get_size()
ask the
Flux broker for its rank in the Flux instance, and the size of the Flux
instance.
Ranks are numbered 0 through size - 1.
RETURN VALUE
These functions return zero on success. On error, -1 is returned, and errno is set appropriately.
ERRORS
- EINVAL
Some arguments were invalid.
EXAMPLES
Example:
#include <flux/core.h>
#include "die.h"
int main (int argc, char **argv)
{
flux_t *h;
uint32_t rank, n;
if (!(h = flux_open (NULL, 0)))
die ("could not connect to broker");
if (flux_get_rank (h, &rank) < 0)
die ("error getting rank");
if (flux_get_size (h, &n) < 0)
die ("error getting size");
flux_close (h);
return (0);
}
RESOURCES
Flux: http://flux-framework.org
Flux RFC: https://flux-framework.readthedocs.io/projects/flux-rfc
Issue Tracker: https://github.com/flux-framework/flux-core/issues