source: CIVL/examples/messagePassing/commBad.cvl@ 6f5cd7f

1.23 2.0 main test-branch
Last change on this file since 6f5cd7f was 69bf2e6, checked in by Manchun Zheng <zmanchun@…>, 12 years ago

cleaned up examples and tests.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@611 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 671 bytes
Line 
1#include<civlc.h>
2
3$proc global;
4$comm comm;
5_Bool _start0 = $false;
6_Bool _start1 = $false;
7
8void 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
25void mpi_proc1(int rank){
26 $when(_start1);
27 $comm_add(&comm, global, rank);
28}
29
30void 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.