| 62 | |
| 63 | ou |
| 64 | |
| 65 | {{{ |
| 66 | #include <stdio.h> |
| 67 | #include <mpi.h> |
| 68 | |
| 69 | int main(int argc, char** argv){ |
| 70 | int rank, size; |
| 71 | |
| 72 | MPI_Init (&argc, &argv); /* starts MPI */ |
| 73 | MPI_Comm_rank (MPI_COMM_WORLD, &rank); /* get current process id */ |
| 74 | MPI_Comm_size (MPI_COMM_WORLD, &size); /* get number of processes */ |
| 75 | char processor_name[MPI_MAX_PROCESSOR_NAME]; |
| 76 | int name_len; |
| 77 | MPI_Get_processor_name(processor_name, &name_len); |
| 78 | printf( "Hello world from process %d of %d executed on %s\n", rank, size, processor_name ); |
| 79 | MPI_Finalize(); |
| 80 | return 0; |
| 81 | } |
| 82 | |
| 83 | }}} |