1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | #include<civlc.h>
|
|---|
| 2 |
|
|---|
| 3 | $proc global;
|
|---|
| 4 | $comm comm;
|
|---|
| 5 | _Bool _start0 = $false;
|
|---|
| 6 | _Bool _start1 = $false;
|
|---|
| 7 |
|
|---|
| 8 | void mpi_proc0(int rank){
|
|---|
| 9 | void thread(tid){
|
|---|
| 10 | $message out;
|
|---|
| 11 |
|
|---|
| 12 | $when (initialized);
|
|---|
| 13 | out = $message_pack(rank, (rank+1)%NPROCS, TAG, &x, sizeof(double));
|
|---|
| 14 | $comm_enqueue(&MPI_COMM_WORLD, out);
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | $when(_start0);
|
|---|
| 18 | _
|
|---|
| 19 | $proc thread = $spawn thread(0);
|
|---|
| 20 | global = thread;
|
|---|
| 21 | _start1 = $true;
|
|---|
| 22 | $comm_add(&comm, thread, rank);
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | void mpi_proc1(int rank){
|
|---|
| 26 | $when(_start1);
|
|---|
| 27 | $comm_add(&comm, global, rank);
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | void main(){
|
|---|
| 31 | $proc procs[2];
|
|---|
| 32 |
|
|---|
| 33 | procs[0] = $spawn mpi_proc0(0);
|
|---|
| 34 | procs[1] = $spawn mpi_proc1(1);
|
|---|
| 35 |
|
|---|
| 36 | comm = $comm_create(2, procs);
|
|---|
| 37 |
|
|---|
| 38 | $wait procs[0];
|
|---|
| 39 | $wait procs[1];
|
|---|
| 40 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.