start_pes

Purpose

Called at the beginning of a SHMEM program to identify the number of processes desired.

C syntax

#include <shmem.h>
 
void start_pes(int npes);
 

Parameters

INPUT
npes
Identifies the total number of processing elements (PEs) desired. If npes is 0, the number of PEs is selected by the MP_PROCS environment variable.

Description

The start_pes routine identifies the number of processes for a program. This statement must be the first statement in a program that uses IBM SHMEM communication routines.

The value of npes must be less than or equal to the value specified by MP_PROCS environment variable.

IBM NOTES

For current implementation, any npes value other than 0 is ignored. Users can only do the initialization once by invoking either shmem_init or start_pes in the beginning of their programs

C examples

#include <shmem.h>
#include <stdio.h>


int main (int argc, char* argv[])
{
    int total_tasks = -1;
    int my_task = -1;

    start_pes(0);

    total_tasks = _num_pes();

    if (total_tasks <= 0) {
        printf("FAILED\n");
        return 0;
    } else {
        printf("number of pes is %d\n", total_tasks);
    }

    my_task = _my_pe();

    if (my_task < 0){
        printf("FAILED\n");
        return 0;
    } else {
        printf("my pe id is %d\n", my_task);
    }

    printf("PASSED\n");
    return 0;
}

Related information

Subroutines: num_pes, my_pe


OpenSHMEM API Index