![]() | 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 знайомий реферат.docx ОКРО.docx Zvit№1ПСМ.doc P4.cpp:#include "Header.h" #include using namespace std; ofstream f4; ifstream f44; void CPU_4() { MPI_Status stat1; //zminni int flag = 1; int N1 = 290; int N2 = 168; int N3 = 349; int** A4; int** Bi; int** B7; int** A4B0; int** A4B1; int** A4B2; int** A4B3; int** A4B4; int** A4B5; int** A4B6; int** A4B7; matrix(A4B0, 36, 43); matrix(A4B1, 36, 43); matrix(A4B2, 36, 43); matrix(A4B3, 36, 43); matrix(A4B4, 36, 43); matrix(A4B5, 36, 43); matrix(A4B6, 36, 43); matrix(A4B7, 36, 48); matrix(A4, 36, N2); matrix(Bi, N2, 43); matrix(B7, N2, 48); auto start_MPI = chrono::steady_clock::now(); MPI_Recv(&flag, 1, MPI_INT, 2, 0, MPI_COMM_WORLD, &stat1); cout << "Z(A4,B4)" << endl; read_matrix_from_file(A4, "A4", 36, N2); read_matrix_from_file(Bi, "B4", N2, 43); MPI_Send(&flag, 1, MPI_FLOAT, 6, 0, MPI_COMM_WORLD); MPI_Recv(&flag, 1, MPI_INT, 3, 0, MPI_COMM_WORLD, &stat1); A4B4 = dobytok_2_matruc(36, 43, N2, A4, Bi);//M(A4;B4) cout << "P4: Sending B4 to P6" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 6, 0, MPI_COMM_WORLD);//P(B4)->6 cout << "P4: Receiving B2 from P2" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 2, 0, MPI_COMM_WORLD, &stat1);//O(B2)<-2 A4B2 = dobytok_2_matruc(36, 43, N2, A4, Bi);//M(A4;B2) cout << "P4: Sending B2 to P6" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 6, 0, MPI_COMM_WORLD);//P(B2)->6 cout << "P4: Receiving B7 from P2" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(B7[i][0]), 48, MPI_INT, 2, 0, MPI_COMM_WORLD, &stat1);//O(B7)<-2 A4B7 = dobytok_2_matruc(36, 48, N2, A4, B7);//M(A4;B7) cout << "P4: Sending B7 to P6" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(B7[i][0]), 48, MPI_INT, 6, 0, MPI_COMM_WORLD);//P(B7)->6 cout << "P4: Receiving B0 from P2" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 2, 0, MPI_COMM_WORLD, &stat1);//O(B0)<-2 A4B0 = dobytok_2_matruc(36, 43, N2, A4, Bi);//M(A4;B0) cout << "P4: Sending B0 to P6" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 6, 0, MPI_COMM_WORLD);//P(B0)->6 cout << "P4: Receiving B3 from P2" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 2, 0, MPI_COMM_WORLD, &stat1);//O(B3)<-2 A4B3 = dobytok_2_matruc(36, 43, N2, A4, Bi);//M(A4;B3) cout << "P4: Sending B3 to P6" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 6, 0, MPI_COMM_WORLD);//P(B3)->6 cout << "P4: Receiving B5 from P2" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 2, 0, MPI_COMM_WORLD, &stat1);//O(B5)<-2 A4B5 = dobytok_2_matruc(36, 43, N2, A4, Bi);//M(A4;B5) cout << "P4: Sending B5 to P6" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 6, 0, MPI_COMM_WORLD);//P(B5)->6 cout << "P4: Receiving B1 from P2" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 2, 0, MPI_COMM_WORLD, &stat1);//O(B1)<-2 A4B1 = dobytok_2_matruc(36, 43, N2, A4, Bi);//M(A4;B1) cout << "P4: Sending B1 to P6" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 6, 0, MPI_COMM_WORLD);//P(B1)->6 cout << "P4: Receiving B6 from P2" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 2, 0, MPI_COMM_WORLD, &stat1);//O(B6)<-2 A4B6 = dobytok_2_matruc(36, 43, N2, A4, Bi);//M(A4;B6) MPI_Recv(&flag, 1, MPI_INT, 3, 0, MPI_COMM_WORLD, &stat1); write_matrix_to_fileC(f4, "C4", A4B0, A4B1, A4B2, A4B3, A4B4, A4B5, A4B6, A4B7, 36, 43, 48); cout << "W(C4)" << endl; MPI_Send(&flag, 1, MPI_FLOAT, 5, 0, MPI_COMM_WORLD); auto end_MPI = chrono::steady_clock::now(); float elapsed_time_MPI = float(chrono::duration_cast cout << "Elapsed time for P4 (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 |