![]() | 1 2 3 4 5 6 7 8 9 Ім'я файлу: Розраха.docx Розширення: docx Розмір: 845кб. Дата: 12.08.2021 скачати Пов'язані файли: 5.docx Лаба 4_РТП_СЗІ_Кліщ Богдан.docx Лаба 5_РТП_СЗІ_Кліщ.docx Тести, статистика праці.docx Реферат Лесько П.В. Авторське право ЕЛЕП-11.docx.doc Індивідуальна нормативне.docx lab2.docx ЦЕРКВА РІЗДВА ПРЕСВЯТОЇ БОГОРОДИЦІ У САМБОРІ.docx ШАБЕЛЬКО КУРСОВА.docx Сучасні методики здорового харчування.docx Звіт до БД 2.docx звіт_від_ред.docx lab_8_Kravets.docx Сєрий.docx Сенсорне виховання.doc СПЗ_ЛАБ_1.docx lab5_бд.docx Фізика5 Моя лаба.doc Вебинар англ.docx 5.docx ЛР 3 ФДП.docx Методичка до ПЗ №5-6.doc зразок РГР 2021 (1).docx курсова 1.docx Міністерство_освіти_та_науки_України_PI.docx Контрольна робота Павло Коцаба.docx Метод Баркера.docx Grej_R._S.docx P5.cpp:#include "Header.h" #include using namespace std; ofstream f5; ifstream f55; void CPU_5() { MPI_Status stat1; //zminni int flag = 1; int N1 = 290; int N2 = 168; int N3 = 349; int** A5; int** Bi; int** B7; int** A5B0; int** A5B1; int** A5B2; int** A5B3; int** A5B4; int** A5B5; int** A5B6; int** A5B7; matrix(A5B0, 36, 43); matrix(A5B1, 36, 43); matrix(A5B2, 36, 43); matrix(A5B3, 36, 43); matrix(A5B4, 36, 43); matrix(A5B5, 36, 43); matrix(A5B6, 36, 43); matrix(A5B7, 36, 48); matrix(A5, 36, N2); matrix(Bi, N2, 43); matrix(B7, N2, 48); auto start_MPI = chrono::steady_clock::now(); MPI_Recv(&flag, 1, MPI_INT, 1, 0, MPI_COMM_WORLD, &stat1); cout << "Z(A5,B5)" << endl; read_matrix_from_file(A5, "A5", 36, N2); read_matrix_from_file(Bi, "B5", N2, 43); MPI_Send(&flag, 1, MPI_FLOAT, 3, 0, MPI_COMM_WORLD); MPI_Recv(&flag, 1, MPI_INT, 3, 0, MPI_COMM_WORLD, &stat1); A5B5 = dobytok_2_matruc(36, 43, N2, A5, Bi);//M(A5;B5) cout << "P5: Sending B5 to P3" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 3, 0, MPI_COMM_WORLD);//P(B5)->3 cout << "P5: Receiving B1 from P1" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 1, 0, MPI_COMM_WORLD, &stat1);//O(B1)<-1 A5B1 = dobytok_2_matruc(36, 43, N2, A5, Bi);//M(A5;B1) cout << "P5: Sending B1 to P3" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 3, 0, MPI_COMM_WORLD);//P(B1)->3 cout << "P5: Receiving B6 from P1" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 1, 0, MPI_COMM_WORLD, &stat1);//O(B6)<-1 A5B6 = dobytok_2_matruc(36, 43, N2, A5, Bi);//M(A5;B6) cout << "P5: Sending B6 to P3" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 3, 0, MPI_COMM_WORLD);//P(B6)->3 cout << "P5: Receiving B4 from P1" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 1, 0, MPI_COMM_WORLD, &stat1);//O(B4)<-1 A5B4 = dobytok_2_matruc(36, 43, N2, A5, Bi);//M(A5;B4) cout << "P5: Sending B4 to P3" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 3, 0, MPI_COMM_WORLD);//P(B4)->3 cout << "P5: Receiving B2 from P1" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 1, 0, MPI_COMM_WORLD, &stat1);//O(B2)<-1 A5B2 = dobytok_2_matruc(36, 43, N2, A5, Bi);//M(A5;B2) cout << "P5: Sending B2 to P3" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 3, 0, MPI_COMM_WORLD);//P(B2)->3 cout << "P5: Receiving B7 from P1" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(B7[i][0]), 48, MPI_INT, 1, 0, MPI_COMM_WORLD, &stat1);//O(B7)<-1 A5B7 = dobytok_2_matruc(36, 48, N2, A5, B7);//M(A5;B7) cout << "P5: Sending B7 to P3" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(B7[i][0]), 48, MPI_INT, 3, 0, MPI_COMM_WORLD);//P(B7)->3 cout << "P5: Receiving B0 from P1" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 1, 0, MPI_COMM_WORLD, &stat1);//O(B0)<-1 A5B0 = dobytok_2_matruc(36, 43, N2, A5, Bi);//M(A5;B0) cout << "P5: Sending B0 to P3" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 3, 0, MPI_COMM_WORLD);//P(B0)->3 cout << "P5: Receiving B3 from P1" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 1, 0, MPI_COMM_WORLD, &stat1);//O(B3)<-1 A5B3 = dobytok_2_matruc(36, 43, N2, A5, Bi);//M(A5;B3) MPI_Recv(&flag, 1, MPI_INT, 4, 0, MPI_COMM_WORLD, &stat1); write_matrix_to_fileC(f5, "C5", A5B0, A5B1, A5B2, A5B3, A5B4, A5B5, A5B6, A5B7, 36, 43, 48); cout << "W(C5)" << endl; MPI_Send(&flag, 1, MPI_FLOAT, 6, 0, MPI_COMM_WORLD); auto end_MPI = chrono::steady_clock::now(); float elapsed_time_MPI = float(chrono::duration_cast cout << "Elapsed time for P5 (milliseconds): " << elapsed_time_MPI << endl; MPI_Send(&elapsed_time_MPI, 1, MPI_FLOAT, 0, 0, MPI_COMM_WORLD); } 1 2 3 4 5 6 7 8 9 |