source: CIVL/examples/languageFeatures/bundleTestBad.cvl@ dfb0fef

1.23 2.0 main test-branch
Last change on this file since dfb0fef was a7065e4, checked in by Ziqing Luo <ziqing@…>, 12 years ago

new exmaples for bundle pack and unpack

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

  • Property mode set to 100644
File size: 969 bytes
RevLine 
[a7065e4]1/* Testing for bundle pack and unpack.
2 Bad example.
3 */
4#include <civlc.h>
5#include <mpi.h>
6
7CMPI_Gcomm Gcomm;
8void main(){
9 /* Process function */
10 void Process(int i){
11 MPI_Comm comm = CMPI_Comm_create($here, Gcomm, i);
12 int rank;
13
14 __MPI_Init(&comm);
15 MPI_Comm_rank(comm, &rank);
16 /* In total 2 processes, 0 sends and 1 receives */
17 if (rank == 0){
18 int a3d[3][4][5];
19 int counter = 0;
20
21 for(int i=0; i<3; i++)
22 for(int j=0; j<4; j++)
23 for(int k=0; k<5; k++)
24 a3d[i][j][k] = counter++;
25
26 MPI_Send(&a3d[1][0][3], 8, MPI_INT, 1, 0, comm);
27 }
28 else{
29 int a4d[2][2][2][2];
30
31 MPI_Recv(&a4d[1][0][1], 8, MPI_INT, 0, 0, comm, MPI_STATUS_IGNORE);
32 }
33 CMPI_Comm_destroy(comm);
34 __MPI_Finalize(&comm);
35 }
36
37 $proc procs[2];
38
39 Gcomm = CMPI_Gcomm_create($root, 2);
40 for(int i=0; i<2; i++)
41 procs[i] = $spawn Process(i);
42
43 for(int i=0; i<2; i++)
44 $wait(procs[i]);
45 CMPI_Gcomm_destroy(Gcomm);
46}
Note: See TracBrowser for help on using the repository browser.