Returns the number of processing elements (PEs) running in the job.
#include <shmem.h> int num_pes(void);
The num_pes function returns the number of PEs running in an application.
For current implementation, this value is equal to the MP_PROCS environment variable.
#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; }
Subroutines: shmem_init, start_pes, my_pe