Skip to content

Commit 110096a

Browse files
removing extra space and fixing tab space size
1 parent c001fd2 commit 110096a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+117
-118
lines changed

partitioned-communication/test_cancel0.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int main(int argc, char *argv[]) {
9191
MPI_Barrier(MPI_COMM_WORLD);
9292
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
9393

94-
MPI_Finalize ();
94+
MPI_Finalize();
9595

9696
return 0;
9797
}

partitioned-communication/test_datatype0.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ int main(int argc, char *argv[]) {
8989

9090
if (myrank == 0) {TEST_RAN_TO_COMPLETION();}
9191

92-
MPI_Finalize ();
92+
MPI_Finalize();
9393
return 0;
9494

9595
}

partitioned-communication/test_datatype1.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ int main(int argc, char *argv[]) {
8989
MPI_Barrier(MPI_COMM_WORLD);
9090
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
9191

92-
MPI_Finalize ();
92+
MPI_Finalize();
9393
return 0;
9494

9595
}

partitioned-communication/test_datatype2.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ int main(int argc, char *argv[]) {
9090
MPI_Barrier(MPI_COMM_WORLD);
9191
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
9292

93-
MPI_Finalize ();
93+
MPI_Finalize();
9494
return 0;
9595

9696
}

partitioned-communication/test_datatype3.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ int main(int argc, char *argv[]) {
102102
MPI_Barrier(MPI_COMM_WORLD);
103103
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
104104

105-
MPI_Finalize ();
105+
MPI_Finalize();
106106
return 0;
107107

108108
}

partitioned-communication/test_datatype4.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int main(int argc, char *argv[]) {
7171
MPI_Barrier(MPI_COMM_WORLD);
7272
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
7373

74-
MPI_Finalize ();
74+
MPI_Finalize();
7575
return 0;
7676

7777
}

partitioned-communication/test_datatype5.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ int main(int argc, char *argv[]) {
7272
MPI_Barrier(MPI_COMM_WORLD);
7373
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
7474

75-
MPI_Finalize ();
75+
MPI_Finalize();
7676
return 0;
7777

7878
}

partitioned-communication/test_example1a.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int main(int argc, char *argv[]) {
7171
MPI_Barrier(MPI_COMM_WORLD);
7272
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
7373

74-
MPI_Finalize ();
74+
MPI_Finalize();
7575

7676
return 0;
7777
}

partitioned-communication/test_example1b.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int main(int argc, char *argv[]) {
6868
MPI_Barrier(MPI_COMM_WORLD);
6969
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
7070

71-
MPI_Finalize ();
71+
MPI_Finalize();
7272

7373
return 0;
7474
}

partitioned-communication/test_example2.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,6 @@ int main(int argc, char *argv[]) {
9595

9696
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
9797

98-
MPI_Finalize ();
98+
MPI_Finalize();
9999
return 0;
100100
}

partitioned-communication/test_example3a.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ int main(int argc, char *argv[]) {
110110
MPI_Barrier(MPI_COMM_WORLD);
111111
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
112112

113-
MPI_Finalize ();
113+
MPI_Finalize();
114114
return 0;
115115

116116
}

partitioned-communication/test_example3b.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ int main(int argc, char *argv[]) {
104104
MPI_Barrier(MPI_COMM_WORLD);
105105
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
106106

107-
MPI_Finalize ();
107+
MPI_Finalize();
108108
return 0;
109109

110110
}

partitioned-communication/test_example3c.c

+77-78
Original file line numberDiff line numberDiff line change
@@ -30,86 +30,85 @@
3030

3131
int main(int argc, char *argv[]) {
3232

33-
int message[MESSAGE_LENGTH];
34-
int send_partitions = PARTITIONS;
35-
int send_partlength = PARTLENGTH;
36-
int recv_partitions = 1;
37-
int recv_partlength = MESSAGE_LENGTH;
38-
39-
int count = 1, source = 0, dest = 1, tag = 1, flag = 0;
40-
int i, j;
41-
int myrank;
42-
int provided;
43-
int my_thread_id;
44-
45-
MPI_Request request;
46-
MPI_Status status;
47-
MPI_Datatype send_type;
48-
MPI_Info info = MPI_INFO_NULL;
49-
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
50-
if (provided < MPI_THREAD_MULTIPLE) MPI_Abort(MPI_COMM_WORLD , EXIT_FAILURE);
51-
MPI_Comm_rank(MPI_COMM_WORLD , &myrank);
52-
53-
/* Sender uses this datatype */
54-
MPI_Type_contiguous(send_partlength, MPI_INT, &send_type);
55-
MPI_Type_commit(&send_type);
56-
57-
if (myrank == 0) {
58-
59-
for (i = 0; i < send_partitions * send_partlength; ++i) message[i] = 100;
60-
61-
MPI_Psend_init(message, send_partitions, count, send_type, dest, tag, MPI_COMM_WORLD, info, &request);
62-
MPI_Start(&request);
63-
64-
#pragma omp parallel shared(request,message) private(i, my_thread_id) num_threads(NUM_THREADS)
65-
{
66-
#pragma omp single
67-
{
68-
/* single thread creates 64 tasks to be executed by 8 threads */
69-
for (int task_num=0; task_num < NUM_TASKS; task_num++) {
70-
#pragma omp task firstprivate(task_num)
71-
{
72-
my_thread_id = omp_get_thread_num();
73-
for (i=0; i < send_partlength; ++i) {
74-
message[i + (task_num * send_partlength)] = i + (task_num * send_partlength);
33+
int message[MESSAGE_LENGTH];
34+
int send_partitions = PARTITIONS;
35+
int send_partlength = PARTLENGTH;
36+
int recv_partitions = 1;
37+
int recv_partlength = MESSAGE_LENGTH;
38+
39+
int count = 1, source = 0, dest = 1, tag = 1, flag = 0;
40+
int i, j;
41+
int myrank;
42+
int provided;
43+
int my_thread_id;
44+
45+
MPI_Request request;
46+
MPI_Status status;
47+
MPI_Datatype send_type;
48+
MPI_Info info = MPI_INFO_NULL;
49+
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
50+
if (provided < MPI_THREAD_MULTIPLE) MPI_Abort(MPI_COMM_WORLD , EXIT_FAILURE);
51+
MPI_Comm_rank(MPI_COMM_WORLD , &myrank);
52+
53+
/* Sender uses this datatype */
54+
MPI_Type_contiguous(send_partlength, MPI_INT, &send_type);
55+
MPI_Type_commit(&send_type);
56+
57+
if (0 == myrank) {
58+
59+
for (i = 0; i < send_partitions * send_partlength; ++i) message[i] = 100;
60+
61+
MPI_Psend_init(message, send_partitions, count, send_type, dest, tag, MPI_COMM_WORLD, info, &request);
62+
MPI_Start(&request);
63+
64+
#pragma omp parallel shared(request,message) private(i, my_thread_id) num_threads(NUM_THREADS)
65+
{
66+
#pragma omp single
67+
{
68+
/* single thread creates 64 tasks to be executed by 8 threads */
69+
for (int task_num=0; task_num < NUM_TASKS; task_num++) {
70+
#pragma omp task firstprivate(task_num)
71+
{
72+
my_thread_id = omp_get_thread_num();
73+
for (i=0; i < send_partlength; ++i) {
74+
message[i + (task_num * send_partlength)] = i + (task_num * send_partlength);
75+
}
76+
MPI_Pready(task_num, request);
77+
} /* end task */
78+
} /* end for */
79+
} /* end single */
80+
} /* end parallel */
81+
82+
while(!flag) {
83+
MPI_Test(&request, &flag, MPI_STATUS_IGNORE);
84+
}
85+
86+
MPI_Request_free(&request);
87+
88+
} else if (1 == myrank) {
89+
for (i = 0; i < recv_partitions * recv_partlength; ++i) message[i] = 101;
90+
91+
MPI_Precv_init(message, recv_partitions, recv_partlength, MPI_INT, source, tag, MPI_COMM_WORLD, info, &request);
92+
MPI_Start(&request);
93+
94+
while(!flag) {
95+
MPI_Test(&request, &flag, MPI_STATUS_IGNORE);
96+
}
97+
98+
MPI_Request_free(&request);
99+
100+
/* all partitions received; check contents */
101+
for (i = 0; i < MESSAGE_LENGTH; ++i) {
102+
if (message[i] != i) {
103+
fprintf(stderr, "ERROR: Contents received do not match contents sent (expected %d, found %d).\n",i,message[i]);
104+
MPI_Abort(MPI_COMM_WORLD, 1);
75105
}
76-
MPI_Pready(task_num, request);
77-
} /* end task */
78-
} /* end for */
79-
} /* end single */
80-
} /* end parallel */
81-
82-
while(!flag) {
83-
MPI_Test(&request, &flag, MPI_STATUS_IGNORE);
106+
}
84107
}
85108

86-
MPI_Request_free(&request);
109+
MPI_Barrier(MPI_COMM_WORLD);
110+
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
87111

88-
} else if (myrank == 1) {
89-
for (i = 0; i < recv_partitions * recv_partlength; ++i) message[i] = 101;
90-
91-
MPI_Precv_init(message, recv_partitions, recv_partlength, MPI_INT, source, tag, MPI_COMM_WORLD, info, &request);
92-
MPI_Start(&request);
93-
94-
while(!flag) {
95-
MPI_Test(&request, &flag, MPI_STATUS_IGNORE);
96-
}
97-
98-
MPI_Request_free(&request);
99-
100-
/* all partitions received; check contents */
101-
for (i = 0; i < MESSAGE_LENGTH; ++i) {
102-
if (message[i] != i) {
103-
fprintf(stderr, "ERROR: Contents received do not match contents sent (expected %d, found %d).\n",i,message[i]);
104-
MPI_Abort(MPI_COMM_WORLD, 1);
105-
}
106-
}
107-
}
108-
109-
MPI_Barrier(MPI_COMM_WORLD);
110-
if (myrank == 0) {TEST_RAN_TO_COMPLETION();}
111-
112-
MPI_Finalize ();
113-
return 0;
114-
112+
MPI_Finalize();
113+
return 0;
115114
}

partitioned-communication/test_free0.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ int main(int argc, char *argv[]) {
8383
MPI_Barrier(MPI_COMM_WORLD);
8484
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
8585

86-
MPI_Finalize ();
86+
MPI_Finalize();
8787

8888
return 0;
8989
}

partitioned-communication/test_init0.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int main(int argc, char *argv[]) {
9191
MPI_Barrier(MPI_COMM_WORLD);
9292
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
9393

94-
MPI_Finalize ();
94+
MPI_Finalize();
9595

9696
return 0;
9797
}

partitioned-communication/test_init1.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ int main(int argc, char *argv[]) {
7979
MPI_Barrier(MPI_COMM_WORLD);
8080
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
8181

82-
MPI_Finalize ();
82+
MPI_Finalize();
8383

8484
return 0;
8585
}

partitioned-communication/test_local0.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ int main(int argc, char *argv[]) {
7979
MPI_Barrier(MPI_COMM_WORLD);
8080
if (1 == myrank) {TEST_RAN_TO_COMPLETION();}
8181

82-
MPI_Finalize ();
82+
MPI_Finalize();
8383

8484
return 0;
8585
}

partitioned-communication/test_local1.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int main(int argc, char *argv[]) {
7878
MPI_Barrier(MPI_COMM_WORLD);
7979
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
8080

81-
MPI_Finalize ();
81+
MPI_Finalize();
8282

8383
return 0;
8484
}

partitioned-communication/test_numparts0.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ int main(int argc, char *argv[]) {
7575
MPI_Barrier(MPI_COMM_WORLD);
7676
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
7777

78-
MPI_Finalize ();
78+
MPI_Finalize();
7979

8080
return 0;
8181
}

partitioned-communication/test_numparts1.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ int main(int argc, char *argv[]) {
7575
MPI_Barrier(MPI_COMM_WORLD);
7676
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
7777

78-
MPI_Finalize ();
78+
MPI_Finalize();
7979

8080
return 0;
8181
}

partitioned-communication/test_order0.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ int main(int argc, char *argv[]) {
109109
MPI_Barrier(MPI_COMM_WORLD);
110110
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
111111

112-
MPI_Finalize ();
112+
MPI_Finalize();
113113

114114
return 0;
115115
}

partitioned-communication/test_parrived0.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ int main(int argc, char *argv[]) {
8585
MPI_Barrier(MPI_COMM_WORLD);
8686
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
8787

88-
MPI_Finalize ();
88+
MPI_Finalize();
8989

9090
return 0;
9191
}

partitioned-communication/test_parrived1.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int main(int argc, char *argv[]) {
5050
MPI_Barrier(MPI_COMM_WORLD);
5151
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
5252

53-
MPI_Finalize ();
53+
MPI_Finalize();
5454

5555
return 0;
5656
}

partitioned-communication/test_parrived2.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int main(int argc, char *argv[]) {
6767
MPI_Barrier(MPI_COMM_WORLD);
6868
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
6969

70-
MPI_Finalize ();
70+
MPI_Finalize();
7171

7272
return 0;
7373
}

partitioned-communication/test_partitions0.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int main(int argc, char *argv[]) {
7373
MPI_Barrier(MPI_COMM_WORLD);
7474
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
7575

76-
MPI_Finalize ();
76+
MPI_Finalize();
7777

7878
return 0;
7979
}

partitioned-communication/test_partitions1.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int main(int argc, char *argv[]) {
7373
MPI_Barrier(MPI_COMM_WORLD);
7474
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
7575

76-
MPI_Finalize ();
76+
MPI_Finalize();
7777

7878
return 0;
7979
}

partitioned-communication/test_partitions2.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int main(int argc, char *argv[]) {
7171
MPI_Barrier(MPI_COMM_WORLD);
7272
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}
7373

74-
MPI_Finalize ();
74+
MPI_Finalize();
7575

7676
return 0;
7777
}

0 commit comments

Comments
 (0)