source: CIVL/examples/messagePassing/mp_root2.cvh@ 0f26e04

1.23 2.0 main test-branch
Last change on this file since 0f26e04 was 18cad8a, checked in by Stephen Siegel <siegel@…>, 12 years ago

Adding new version of MPI example ring2.cvl. It's starting to look very much like real MPI.

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

  • Property mode set to 100644
File size: 756 bytes
Line 
1#define MPI_ANY_SOURCE $COMM_ANY_SOURCE
2#define MPI_ANY_TAG $COMM_ANY_TAG
3typedef $comm *MPI_Comm;
4$input int NPROCS;
5$proc __procs[NPROCS];
6_Bool __start = 0;
7$comm __MPI_Comm_World;
8MPI_Comm MPI_COMM_WORLD = &__MPI_Comm_World;
9
10typedef int MPI_Datatype;
11
12#define MPI_INT 1
13#define MPI_DOUBLE 2
14#define MPI_FLOAT 3
15#define MPI_CHAR 4
16
17struct __MPI_Status {
18 int source;
19 int tag;
20 int size;
21};
22
23typedef struct __MPI_Status MPI_Status;
24
25void MPI_Process (int rank);
26
27void init() {
28 for (int i=0; i<NPROCS; i++)
29 __procs[i] = $spawn MPI_Process(i);
30 __MPI_Comm_World = $comm_create(NPROCS, __procs);
31 __start=1;
32}
33
34void finalize() {
35 for (int i=0; i<NPROCS; i++)
36 $wait __procs[i];
37}
38
39void main() {
40 $atomic{
41 init();
42 finalize();
43 }
44}
Note: See TracBrowser for help on using the repository browser.