The unified diff between revisions [c551b2a3..] and [ad68e82c..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'aca319/lab9q1.c'
#
#
# patch "aca319/lab9q1.c"
# from [c719fbf91d9af1045203903b9c51b1e62462d26d]
# to [102fe71ba1e4a6a75718cf047f43a298cf01dfdd]
#
============================================================
--- aca319/lab9q1.c c719fbf91d9af1045203903b9c51b1e62462d26d
+++ aca319/lab9q1.c 102fe71ba1e4a6a75718cf047f43a298cf01dfdd
@@ -19,7 +19,7 @@
#define BREAK_DISTANCE 2
#define ACCELERATE_DISTANCE 5
-#define INSPECT_RANK 14
+#define INSPECT_RANK 255
struct car {
int track_pos;
@@ -108,7 +108,13 @@ main(int argc, char *argv[])
}
for (;;) {
+ /* every processor element updates, and exchanges information
+ * to satisfy data dependency
+ */
drive(&this_car, rank, size);
+ /* processor 0 outputs the track state, all other processors
+ * send their state to 0
+ */
if (rank == 0) {
int i, position;
MPI_Status status;
@@ -135,7 +141,7 @@ main(int argc, char *argv[])
} else {
MPI_Send(&this_car.track_pos, 1, MPI_INT, 0, 60, MPI_COMM_WORLD);
}
- sleep(2);
+ sleep(1);
}
if (rank == 0) {