1.23
2.0
main
test-branch
|
Last change
on this file since 325d439 was 48bfab9, checked in by Manchun Zheng <zmanchun@…>, 12 years ago |
|
added checking for memory leak when collecting a dyscope and for process leak when the main process returns; fixed all test cases accordingly; added a filesystem_destroy call for IOTransformer to get rid of memory leak.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@912 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
1019 bytes
|
| Line | |
|---|
| 1 | /* Create nprocs processes. Have them exchange data in a cycle.
|
|---|
| 2 | * Commandline example:
|
|---|
| 3 | * civl verify -input_NP=3 ring2.cvl -simplify=false
|
|---|
| 4 | */
|
|---|
| 5 | #include<civlc.h>
|
|---|
| 6 | #include<stdio.h>
|
|---|
| 7 | #include "mp_root2.cvh"
|
|---|
| 8 |
|
|---|
| 9 | void MPI_Process (int __rank) {
|
|---|
| 10 | #include "mp_proc2.cvh"
|
|---|
| 11 |
|
|---|
| 12 | // ******************* BEGIN PROGRAM SOURCE *************************
|
|---|
| 13 |
|
|---|
| 14 | int rank, nprocs, count;
|
|---|
| 15 | double x, y;
|
|---|
| 16 | MPI_Status stat;
|
|---|
| 17 | MPI_Comm MPI_COMM_WORLD = $comm_create($here, __MPI_Comm_World, __rank);
|
|---|
| 18 |
|
|---|
| 19 | MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
|---|
| 20 | MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
|
|---|
| 21 | x = rank;
|
|---|
| 22 | MPI_Send(&x, 1, MPI_DOUBLE, (rank+1)%nprocs, 0, MPI_COMM_WORLD);
|
|---|
| 23 | MPI_Recv(&y, 1, MPI_DOUBLE, (rank+nprocs-1)%nprocs, 0, MPI_COMM_WORLD, &stat);
|
|---|
| 24 | $assert(y == (rank+nprocs-1)%nprocs);
|
|---|
| 25 | MPI_Get_count(&stat, MPI_DOUBLE, &count);
|
|---|
| 26 | $assert(count == 1);
|
|---|
| 27 | $assert(stat.MPI_SOURCE == (rank+nprocs-1)%nprocs);
|
|---|
| 28 | $assert(stat.MPI_TAG == 0);
|
|---|
| 29 | $comm_destroy(MPI_COMM_WORLD);
|
|---|
| 30 |
|
|---|
| 31 | // ******************** END PROGRAM SOURCE ***************************
|
|---|
| 32 |
|
|---|
| 33 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.