![]() | 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 P2.cpp:#include "Header.h" #include using namespace std; ofstream f2; ifstream f22; void CPU_2() { MPI_Status stat1; //zminni int flag = 1; int N1 = 290; int N2 = 168; int N3 = 349; int** A2; int** Bi; int** B7; int** A2B0; int** A2B1; int** A2B2; int** A2B3; int** A2B4; int** A2B5; int** A2B6; int** A2B7; matrix(A2B0, 36, 43); matrix(A2B1, 36, 43); matrix(A2B2, 36, 43); matrix(A2B3, 36, 43); matrix(A2B4, 36, 43); matrix(A2B5, 36, 43); matrix(A2B6, 36, 43); matrix(A2B7, 36, 48); matrix(A2, 36, N2); matrix(Bi, N2, 43); matrix(B7, N2, 48); auto start_MPI = chrono::steady_clock::now(); MPI_Recv(&flag, 1, MPI_INT, 7, 0, MPI_COMM_WORLD, &stat1); cout << "Z(A2,B2)" << endl; read_matrix_from_file(A2, "A2", 36, N2); read_matrix_from_file(Bi, "B2", N2, 43); MPI_Send(&flag, 1, MPI_FLOAT, 4, 0, MPI_COMM_WORLD); MPI_Recv(&flag, 1, MPI_INT, 3, 0, MPI_COMM_WORLD, &stat1); A2B2 = dobytok_2_matruc(36, 43, N2, A2, Bi);//M(A2;B2) cout << "P2: Sending B2 to P4" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 4, 0, MPI_COMM_WORLD);//P(B2)->4 cout << "P2: Receiving B7 from P7" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(B7[i][0]), 48, MPI_INT, 7, 0, MPI_COMM_WORLD, &stat1);//O(B7)<-7 A2B7 = dobytok_2_matruc(36, 48, N2, A2, B7);//M(A2;B7) cout << "P2: Sending B7 to P4" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(B7[i][0]), 48, MPI_INT, 4, 0, MPI_COMM_WORLD);//P(B7)->4 cout << "P2: Receiving B0 from P7" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 7, 0, MPI_COMM_WORLD, &stat1);//O(B0)<-7 A2B0 = dobytok_2_matruc(36, 43, N2, A2, Bi);//M(A2;B0) cout << "P2: Sending B0 to P4" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 4, 0, MPI_COMM_WORLD);//P(B0)->4 cout << "P2: Receiving B3 from P7" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 7, 0, MPI_COMM_WORLD, &stat1);//O(B3)<-7 A2B3 = dobytok_2_matruc(36, 43, N2, A2, Bi);//M(A2;B3) cout << "P2: Sending B3 to P4" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 4, 0, MPI_COMM_WORLD);//P(B3)->4 cout << "P2: Receiving B5 from P7" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 7, 0, MPI_COMM_WORLD, &stat1);//O(B5)<-7 A2B5 = dobytok_2_matruc(36, 43, N2, A2, Bi);//M(A2;B5) cout << "P2: Sending B5 to P4" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 4, 0, MPI_COMM_WORLD);//P(B5)->4 cout << "P2: Receiving B1 from P7" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 7, 0, MPI_COMM_WORLD, &stat1);//O(B1)<-7 A2B1 = dobytok_2_matruc(36, 43, N2, A2, Bi);//M(A2;B1) cout << "P2: Sending B1 to P4" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 4, 0, MPI_COMM_WORLD);//P(B1)->4 cout << "P2: Receiving B6 from P7" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 7, 0, MPI_COMM_WORLD, &stat1);//O(B6)<-7 A2B6 = dobytok_2_matruc(36, 43, N2, A2, Bi);//M(A2;B6) cout << "P2: Sending B6 to P4" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 4, 0, MPI_COMM_WORLD);//P(B6)->4 cout << "P2: Receiving B4 from P7" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 7, 0, MPI_COMM_WORLD, &stat1);//O(B4)<-7 A2B4 = dobytok_2_matruc(36, 43, N2, A2, Bi);//M(A2;B4) MPI_Recv(&flag, 1, MPI_INT, 1, 0, MPI_COMM_WORLD, &stat1); write_matrix_to_fileC(f2, "C2", A2B0, A2B1, A2B2, A2B3, A2B4, A2B5, A2B6, A2B7, 36, 43, 48); cout << "W(C2)" << endl; MPI_Send(&flag, 1, MPI_FLOAT, 3, 0, MPI_COMM_WORLD); auto end_MPI = chrono::steady_clock::now(); float elapsed_time_MPI = float(chrono::duration_cast cout << "Elapsed time for P2 (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 |