source: CIVL/examples/complex/mpi_complex.cvl

acw/focus-triggers
Last change on this file was 49a3cc6, checked in by Stephen Siegel <siegel@…>, 9 days ago

Added support for complex datatype in MPI.
Found and remove some uses of deprecated $state and $collate CIVL primitives.

  • Property mode set to 100644
File size: 530 bytes
Line 
1#include <mpi.h>
2
3int nprocs, rank;
4
5int main(void) {
6 MPI_Init(NULL, NULL);
7 MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
8 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
9 $assert(nprocs >= 2);
10 if (rank == 0) {
11 double _Complex x = 3.14+2.718i;
12 MPI_Send(&x, 1, MPI_C_DOUBLE_COMPLEX, 1, 0, MPI_COMM_WORLD);
13 } else if (rank == 1) {
14 double _Complex y;
15 MPI_Recv(&y, 1, MPI_C_DOUBLE_COMPLEX, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
16 $print("Received: ", y, "\n");
17 $assert(y == 3.14 + 2.718i);
18 }
19 MPI_Finalize();
20}
Note: See TracBrowser for help on using the repository browser.