| <html>
|
| <head>
|
| <title>_my_pe</title>
|
| </head>
|
| <h2 id="top">_my_pe</h2>
|
| <h4>Purpose</h4>
|
|
|
|
|
| <p>Returns the processing element (PE) number of the calling PE.
|
| </p>
|
|
|
| <h4>C syntax</h4>
|
|
|
| <pre>
|
| #include <shmem.h>
|
|
|
| int _my_pe(void);
|
|
|
| </pre>
|
|
|
| <h4>Description</h4>
|
|
|
| <div class="ledi">
|
| <p>The _my_pe routine returns the processing element (PE) number of the calling PE. It takes no arguments. The result is an integer between 0 and (npes 1), where npes is the total number of PEs executing in the current job. </p>
|
|
|
| <h4>C examples</h4>
|
| <pre>
|
| #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;
|
| }
|
|
|
| </pre>
|
|
|
| <h4>Related information</h4>
|
|
|
| <p>Subroutines: num_pes, my_pe
|
| </p>
|
| <hr><a href="apiIndex.html">OpenSHMEM API Index</a> |
| </html> |