/* * Circuit Satisfiability, Version 1 * * This MPI program determines whether a circuit is * satisfiable, that is, whether there is a combination of * inputs that causes the output of the circuit to be 1. * The particular circuit being tested is "wired" into the * logic of function 'check_circuit'. All combinations of * inputs that satisfy the circuit are printed. * * Programmed by Michael J. Quinn * * Last modification: 3 September 2002 */ #include "mpi.h" #include int main (int argc, char *argv[]) { int i; int id; /* Process rank */ int p; /* Number of processes */ void check_circuit (int, int); MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &id); MPI_Comm_size (MPI_COMM_WORLD, &p); for (i = id; i < 65536; i += p) check_circuit (id, i); printf ("Process %d is done\n", id); fflush (stdout); MPI_Finalize(); return 0; } /* Return 1 if 'i'th bit of 'n' is 1; 0 otherwise */ #define EXTRACT_BIT(n,i) ((n&(1<
This is a personal WEB site developed and maintained by an individual and not by Seattle University. The content and link(s) provided on this site do not represent or reflect the view(s) of Seattle University. The individual who authored this site is solely responsible for the site's content. This site and its author are subject to applicable University policies including the Computer Acceptable Use Policy (www.seattleu.edu/policies).