Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removing extra space and fixing tab space size
  • Loading branch information
whit-schonbein committed May 2, 2024
commit 110096a223af5f9603179f8c26f675fcd8896199
2 changes: 1 addition & 1 deletion partitioned-communication/test_cancel0.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_datatype0.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) {

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

MPI_Finalize ();
MPI_Finalize();
return 0;

}
2 changes: 1 addition & 1 deletion partitioned-communication/test_datatype1.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();
return 0;

}
2 changes: 1 addition & 1 deletion partitioned-communication/test_datatype2.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();
return 0;

}
2 changes: 1 addition & 1 deletion partitioned-communication/test_datatype3.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();
return 0;

}
2 changes: 1 addition & 1 deletion partitioned-communication/test_datatype4.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();
return 0;

}
2 changes: 1 addition & 1 deletion partitioned-communication/test_datatype5.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();
return 0;

}
2 changes: 1 addition & 1 deletion partitioned-communication/test_example1a.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_example1b.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_example2.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ int main(int argc, char *argv[]) {

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

MPI_Finalize ();
MPI_Finalize();
return 0;
}
2 changes: 1 addition & 1 deletion partitioned-communication/test_example3a.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();
return 0;

}
2 changes: 1 addition & 1 deletion partitioned-communication/test_example3b.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();
return 0;

}
155 changes: 77 additions & 78 deletions partitioned-communication/test_example3c.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,86 +30,85 @@

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

int message[MESSAGE_LENGTH];
int send_partitions = PARTITIONS;
int send_partlength = PARTLENGTH;
int recv_partitions = 1;
int recv_partlength = MESSAGE_LENGTH;

int count = 1, source = 0, dest = 1, tag = 1, flag = 0;
int i, j;
int myrank;
int provided;
int my_thread_id;

MPI_Request request;
MPI_Status status;
MPI_Datatype send_type;
MPI_Info info = MPI_INFO_NULL;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
if (provided < MPI_THREAD_MULTIPLE) MPI_Abort(MPI_COMM_WORLD , EXIT_FAILURE);
MPI_Comm_rank(MPI_COMM_WORLD , &myrank);

/* Sender uses this datatype */
MPI_Type_contiguous(send_partlength, MPI_INT, &send_type);
MPI_Type_commit(&send_type);

if (myrank == 0) {

for (i = 0; i < send_partitions * send_partlength; ++i) message[i] = 100;

MPI_Psend_init(message, send_partitions, count, send_type, dest, tag, MPI_COMM_WORLD, info, &request);
MPI_Start(&request);

#pragma omp parallel shared(request,message) private(i, my_thread_id) num_threads(NUM_THREADS)
{
#pragma omp single
{
/* single thread creates 64 tasks to be executed by 8 threads */
for (int task_num=0; task_num < NUM_TASKS; task_num++) {
#pragma omp task firstprivate(task_num)
{
my_thread_id = omp_get_thread_num();
for (i=0; i < send_partlength; ++i) {
message[i + (task_num * send_partlength)] = i + (task_num * send_partlength);
int message[MESSAGE_LENGTH];
int send_partitions = PARTITIONS;
int send_partlength = PARTLENGTH;
int recv_partitions = 1;
int recv_partlength = MESSAGE_LENGTH;

int count = 1, source = 0, dest = 1, tag = 1, flag = 0;
int i, j;
int myrank;
int provided;
int my_thread_id;

MPI_Request request;
MPI_Status status;
MPI_Datatype send_type;
MPI_Info info = MPI_INFO_NULL;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
if (provided < MPI_THREAD_MULTIPLE) MPI_Abort(MPI_COMM_WORLD , EXIT_FAILURE);
MPI_Comm_rank(MPI_COMM_WORLD , &myrank);

/* Sender uses this datatype */
MPI_Type_contiguous(send_partlength, MPI_INT, &send_type);
MPI_Type_commit(&send_type);

if (0 == myrank) {

for (i = 0; i < send_partitions * send_partlength; ++i) message[i] = 100;

MPI_Psend_init(message, send_partitions, count, send_type, dest, tag, MPI_COMM_WORLD, info, &request);
MPI_Start(&request);

#pragma omp parallel shared(request,message) private(i, my_thread_id) num_threads(NUM_THREADS)
{
#pragma omp single
{
/* single thread creates 64 tasks to be executed by 8 threads */
for (int task_num=0; task_num < NUM_TASKS; task_num++) {
#pragma omp task firstprivate(task_num)
{
my_thread_id = omp_get_thread_num();
for (i=0; i < send_partlength; ++i) {
message[i + (task_num * send_partlength)] = i + (task_num * send_partlength);
}
MPI_Pready(task_num, request);
} /* end task */
} /* end for */
} /* end single */
} /* end parallel */

while(!flag) {
MPI_Test(&request, &flag, MPI_STATUS_IGNORE);
}

MPI_Request_free(&request);

} else if (1 == myrank) {
for (i = 0; i < recv_partitions * recv_partlength; ++i) message[i] = 101;

MPI_Precv_init(message, recv_partitions, recv_partlength, MPI_INT, source, tag, MPI_COMM_WORLD, info, &request);
MPI_Start(&request);

while(!flag) {
MPI_Test(&request, &flag, MPI_STATUS_IGNORE);
}

MPI_Request_free(&request);

/* all partitions received; check contents */
for (i = 0; i < MESSAGE_LENGTH; ++i) {
if (message[i] != i) {
fprintf(stderr, "ERROR: Contents received do not match contents sent (expected %d, found %d).\n",i,message[i]);
MPI_Abort(MPI_COMM_WORLD, 1);
}
MPI_Pready(task_num, request);
} /* end task */
} /* end for */
} /* end single */
} /* end parallel */

while(!flag) {
MPI_Test(&request, &flag, MPI_STATUS_IGNORE);
}
}

MPI_Request_free(&request);
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

} else if (myrank == 1) {
for (i = 0; i < recv_partitions * recv_partlength; ++i) message[i] = 101;

MPI_Precv_init(message, recv_partitions, recv_partlength, MPI_INT, source, tag, MPI_COMM_WORLD, info, &request);
MPI_Start(&request);

while(!flag) {
MPI_Test(&request, &flag, MPI_STATUS_IGNORE);
}

MPI_Request_free(&request);

/* all partitions received; check contents */
for (i = 0; i < MESSAGE_LENGTH; ++i) {
if (message[i] != i) {
fprintf(stderr, "ERROR: Contents received do not match contents sent (expected %d, found %d).\n",i,message[i]);
MPI_Abort(MPI_COMM_WORLD, 1);
}
}
}

MPI_Barrier(MPI_COMM_WORLD);
if (myrank == 0) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
return 0;

MPI_Finalize();
return 0;
}
2 changes: 1 addition & 1 deletion partitioned-communication/test_free0.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_init0.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_init1.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_local0.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (1 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_local1.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_numparts0.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_numparts1.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_order0.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_parrived0.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_parrived1.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_parrived2.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_partitions0.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_partitions1.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion partitioned-communication/test_partitions2.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD);
if (0 == myrank) {TEST_RAN_TO_COMPLETION();}

MPI_Finalize ();
MPI_Finalize();

return 0;
}
Expand Down
Loading