source:
CIVL/examples/messagePassing/mp_root.cvh@
cf2a996
| Last change on this file since cf2a996 was 767f15e, checked in by , 12 years ago | |
|---|---|
|
|
| File size: 466 bytes | |
| Rev | Line | |
|---|---|---|
| [0be7a7ea] | 1 | |
| 2 | $input int NPROCS; | |
| 3 | $proc __procs[NPROCS]; | |
| 4 | _Bool __start = 0; | |
| 5 | $comm MPI_COMM_WORLD; | |
| [767f15e] | 6 | $comm REDUCE_COMM; |
| [0be7a7ea] | 7 | |
| 8 | void MPI_Process (int rank); | |
| 9 | ||
| 10 | ||
| 11 | void init() { | |
| 12 | for (int i=0; i<NPROCS; i++) | |
| 13 | __procs[i] = $spawn MPI_Process(i); | |
| 14 | MPI_COMM_WORLD = $comm_create(NPROCS, __procs); | |
| [767f15e] | 15 | REDUCE_COMM = $comm_create(NPROCS, __procs); |
| [0be7a7ea] | 16 | __start=1; |
| 17 | } | |
| 18 | ||
| 19 | void finalize() { | |
| 20 | for (int i=0; i<NPROCS; i++) | |
| 21 | $wait __procs[i]; | |
| 22 | } | |
| 23 | ||
| 24 | void main() { | |
| [18cad8a] | 25 | $atomic{ |
| 26 | init(); | |
| 27 | finalize(); | |
| 28 | } | |
| [0be7a7ea] | 29 | } |
Note:
See TracBrowser
for help on using the repository browser.
