source: CIVL/examples/mpi/abstract_array.cvl@ bb03188

main test-branch
Last change on this file since bb03188 was 5514bd7, checked in by Stephen Siegel <siegel@…>, 15 months ago

Adding a few more tests and examples: 2 for MPI using lambdas, and one LanguageFeatureTest
using a bad lambda expression that should result in an error message but instead crashes.

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

  • Property mode set to 100644
File size: 441 bytes
RevLine 
[5514bd7]1#include <mpi.h>
2
3int main(void) {
4 int nproc, rank;
5 MPI_Init(NULL, NULL);
6 MPI_Comm_size(MPI_COMM_WORLD, &nproc);
7 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
8 int a[] = (int[3])$lambda(int i) rank;
9 $assert(nproc >= 2);
10 if (rank == 0)
11 MPI_Send(a, 3, MPI_INT, 1, 0, MPI_COMM_WORLD);
12 else {
13 MPI_Recv(a, 3, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
14 $assert($forall (int i:0 .. 2) a[i] == 0);
15 }
16 MPI_Finalize();
17}
Note: See TracBrowser for help on using the repository browser.