source: CIVL/examples/mpi/mpiFeature/input_branch_bad.c@ 7d77e64

main test-branch
Last change on this file since 7d77e64 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

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

  • Property mode set to 100644
File size: 519 bytes
Line 
1/* Example where the deadlock depends on a (command line) input.
2 * It deadlocks when the commandline input equals to two.
3 * Run with nprocs=2.
4 */
5#include <mpi.h>
6#include <stdlib.h>
7#define comm MPI_COMM_WORLD
8
9int main(int argc, char * argv[]) {
10 int rank;
11
12 MPI_Init(&argc, &argv);
13 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
14
15 if (rank == 0 && atoi(argv[1]) != 2)
16 MPI_Send(NULL, 0, MPI_INT, 1, 0, comm);
17 if (rank == 1)
18 MPI_Recv(NULL, 0, MPI_INT, 0, 0, comm, MPI_STATUS_IGNORE);
19 MPI_Finalize();
20}
Note: See TracBrowser for help on using the repository browser.