![]() | 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 P3.cpp:#include "Header.h" #include using namespace std; ofstream f3; ifstream f33; void CPU_3() { MPI_Status stat1; //zminni int flag = 1; int N1 = 290; int N2 = 168; int N3 = 349; int** A3; int** Bi; int** B7; int** A3B0; int** A3B1; int** A3B2; int** A3B3; int** A3B4; int** A3B5; int** A3B6; int** A3B7; matrix(A3B0, 36, 43); matrix(A3B1, 36, 43); matrix(A3B2, 36, 43); matrix(A3B3, 36, 43); matrix(A3B4, 36, 43); matrix(A3B5, 36, 43); matrix(A3B6, 36, 43); matrix(A3B7, 36, 48); matrix(A3, 36, N2); matrix(Bi, N2, 43); matrix(B7, N2, 48); auto start_MPI = chrono::steady_clock::now(); MPI_Recv(&flag, 1, MPI_INT, 5, 0, MPI_COMM_WORLD, &stat1); cout << "Z(A3,B3)" << endl; read_matrix_from_file(A3, "A3", 36, N2); read_matrix_from_file(Bi, "B3", N2, 43); MPI_Send(&flag, 1, MPI_FLOAT, 5, 0, MPI_COMM_WORLD); MPI_Send(&flag, 1, MPI_FLOAT, 1, 0, MPI_COMM_WORLD); MPI_Send(&flag, 1, MPI_FLOAT, 6, 0, MPI_COMM_WORLD); MPI_Send(&flag, 1, MPI_FLOAT, 4, 0, MPI_COMM_WORLD); MPI_Send(&flag, 1, MPI_FLOAT, 2, 0, MPI_COMM_WORLD); MPI_Send(&flag, 1, MPI_FLOAT, 7, 0, MPI_COMM_WORLD); MPI_Send(&flag, 1, MPI_FLOAT, 0, 0, MPI_COMM_WORLD); A3B3 = dobytok_2_matruc(36, 43, N2, A3, Bi);//M(A3;B3) cout << "P3: Sending B3 to P0" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 0, 0, MPI_COMM_WORLD);//P(B3)->0 cout << "P3: Receiving B5 from P5" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 5, 0, MPI_COMM_WORLD, &stat1);//O(B5)<-5 A3B5 = dobytok_2_matruc(36, 43, N2, A3, Bi);//M(A3;B5) cout << "P3: Sending B5 to P0" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 0, 0, MPI_COMM_WORLD);//P(B5)->0 cout << "P3: Receiving B1 from P5" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 5, 0, MPI_COMM_WORLD, &stat1);//O(B1)<-5 A3B1 = dobytok_2_matruc(36, 43, N2, A3, Bi);//M(A3;B1) cout << "P3: Sending B1 to P0" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 0, 0, MPI_COMM_WORLD);//P(B1)->0 cout << "P3: Receiving B6 from P5" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 5, 0, MPI_COMM_WORLD, &stat1);//O(B6)<-5 A3B6 = dobytok_2_matruc(36, 43, N2, A3, Bi);//M(A3;B6) cout << "P3: Sending B6 to P0" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 0, 0, MPI_COMM_WORLD);//P(B6)->0 cout << "P3: Receiving B4 from P5" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 5, 0, MPI_COMM_WORLD, &stat1);//O(B4)<-5 A3B4 = dobytok_2_matruc(36, 43, N2, A3, Bi);//M(A3;B4) cout << "P3: Sending B4 to P0" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 0, 0, MPI_COMM_WORLD);//P(B4)->0 cout << "P3: Receiving B2 from P5" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 5, 0, MPI_COMM_WORLD, &stat1);//O(B2)<-5 A3B2 = dobytok_2_matruc(36, 43, N2, A3, Bi);//M(A3;B2) cout << "P3: Sending B2 to P0" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 0, 0, MPI_COMM_WORLD);//P(B2)->0 cout << "P3: Receiving B7 from P5" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(B7[i][0]), 48, MPI_INT, 5, 0, MPI_COMM_WORLD, &stat1);//O(B7)<-5 A3B7 = dobytok_2_matruc(36, 48, N2, A3, B7);//M(A3;B7) cout << "P3: Sending B7 to P0" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(B7[i][0]), 48, MPI_INT, 0, 0, MPI_COMM_WORLD);//P(B7)->0 cout << "P3: Receiving B0 from P5" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 5, 0, MPI_COMM_WORLD, &stat1);//O(B0)<-5 A3B0 = dobytok_2_matruc(36, 43, N2, A3, Bi);//M(A3;B0) MPI_Recv(&flag, 1, MPI_INT, 2, 0, MPI_COMM_WORLD, &stat1); write_matrix_to_fileC(f3, "C3", A3B0, A3B1, A3B2, A3B3, A3B4, A3B5, A3B6, A3B7, 36, 43, 48); cout << "W(C3)" << endl; MPI_Send(&flag, 1, MPI_FLOAT, 4, 0, MPI_COMM_WORLD); auto end_MPI = chrono::steady_clock::now(); float elapsed_time_MPI = float(chrono::duration_cast cout << "Elapsed time for P3 (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 |