1.23
2.0
acw/focus-triggers
main
test-branch
|
Last change
on this file since 13ac9574 was b70deeb, checked in by Stephen Siegel <siegel@…>, 12 years ago |
|
Added streamlined version of hybrid example, but still can't complete model checking of entire state space.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@563 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | /* CIVL model of simple hybrid MPI+threads program.
|
|---|
| 2 | * The program has a defect.
|
|---|
| 3 | */
|
|---|
| 4 | #include<civlc.h>
|
|---|
| 5 | #define TAG 0
|
|---|
| 6 |
|
|---|
| 7 | $comm comm;
|
|---|
| 8 | _Bool initialized = $false;
|
|---|
| 9 |
|
|---|
| 10 | void MPI_Process (int pid) {
|
|---|
| 11 | $proc threads[2];
|
|---|
| 12 | void Thread(int tid) {
|
|---|
| 13 | int x = pid;
|
|---|
| 14 | $message in, out = $message_pack(pid, 1-pid, TAG, &x, sizeof(int));
|
|---|
| 15 |
|
|---|
| 16 | for (int j=0; j<2; j++) {
|
|---|
| 17 | if (pid == 1) {
|
|---|
| 18 | for (int i=0; i<2; i++) $comm_enqueue(&comm, out);
|
|---|
| 19 | for (int i=0; i<2; i++) in = $comm_dequeue(&comm, 1-pid, pid, TAG);
|
|---|
| 20 | } else {
|
|---|
| 21 | for (int i=0; i<2; i++) in = $comm_dequeue(&comm, 1-pid, pid, TAG);
|
|---|
| 22 | for (int i=0; i<2; i++) $comm_enqueue(&comm, out);
|
|---|
| 23 | }
|
|---|
| 24 | }
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | $when (initialized) $atomic {
|
|---|
| 28 | for (int i=0; i<2; i++) threads[i] = $spawn Thread(i);
|
|---|
| 29 | for (int i=0; i<2; i++) $wait threads[i];
|
|---|
| 30 | }
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | void main() {
|
|---|
| 34 | $proc procs[2];
|
|---|
| 35 |
|
|---|
| 36 | $atomic {
|
|---|
| 37 | for (int i=0; i<2; i++) procs[i] = $spawn MPI_Process(i);
|
|---|
| 38 | comm = $comm_create(2, procs);
|
|---|
| 39 | initialized = $true;
|
|---|
| 40 | for (int i=0; i<2; i++) $wait procs[i];
|
|---|
| 41 | }
|
|---|
| 42 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.