![]() | 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 P1.cpp:#include "Header.h" #include using namespace std; ofstream f1; ifstream f11; void CPU_1() { MPI_Status stat1; //zminni int flag = 1; int N1 = 290; int N2 = 168; int N3 = 349; int** A1; int** Bi; int** B7; int** A1B0; int** A1B1; int** A1B2; int** A1B3; int** A1B4; int** A1B5; int** A1B6; int** A1B7; matrix(A1B0, 36, 43); matrix(A1B1, 36, 43); matrix(A1B2, 36, 43); matrix(A1B3, 36, 43); matrix(A1B4, 36, 43); matrix(A1B5, 36, 43); matrix(A1B6, 36, 43); matrix(A1B7, 36, 48); matrix(A1, 36, N2); matrix(Bi, N2, 43); matrix(B7, N2, 48); auto start_MPI = chrono::steady_clock::now(); MPI_Recv(&flag, 1, MPI_INT, 6, 0, MPI_COMM_WORLD, &stat1); cout << "Z(A1,B1)" << endl; read_matrix_from_file(A1, "A1", 36, N2); read_matrix_from_file(Bi, "B1", N2, 43); MPI_Send(&flag, 1, MPI_FLOAT, 5, 0, MPI_COMM_WORLD); MPI_Recv(&flag, 1, MPI_INT, 3, 0, MPI_COMM_WORLD, &stat1); A1B1 = dobytok_2_matruc(36, 43, N2, A1, Bi);//M(A1;B1) cout << "P1: Sending B1 to P5" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 5, 0, MPI_COMM_WORLD);//P(B1)->5 cout << "P1: Receiving B6 from P6" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 6, 0, MPI_COMM_WORLD, &stat1);//O(B6)<-6 A1B6 = dobytok_2_matruc(36, 43, N2, A1, Bi);//M(A1;B6) cout << "P1: Sending B6 to P5" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 5, 0, MPI_COMM_WORLD);//P(B6)->5 cout << "P1: Receiving B4 from P6" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 6, 0, MPI_COMM_WORLD, &stat1);//O(B4)<-6 A1B4 = dobytok_2_matruc(36, 43, N2, A1, Bi);//M(A1;B4) cout << "P1: Sending B4 to P5" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 5, 0, MPI_COMM_WORLD);//P(B4)->5 cout << "P1: Receiving B2 from P6" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 6, 0, MPI_COMM_WORLD, &stat1);//O(B2)<-6 A1B2 = dobytok_2_matruc(36, 43, N2, A1, Bi);//M(A1;B2) cout << "P1: Sending B2 to P5" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 5, 0, MPI_COMM_WORLD);//P(B2)->5 cout << "P1: Receiving B7 from P6" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(B7[i][0]), 48, MPI_INT, 6, 0, MPI_COMM_WORLD, &stat1);//O(B7)<-6 A1B7 = dobytok_2_matruc(36, 48, N2, A1, B7);//M(A1;B7) cout << "P1: Sending B7 to P5" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(B7[i][0]), 48, MPI_INT, 5, 0, MPI_COMM_WORLD);//P(B7)->5 cout << "P1: Receiving B0 from P6" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 6, 0, MPI_COMM_WORLD, &stat1);//O(B0)<-6 A1B0 = dobytok_2_matruc(36, 43, N2, A1, Bi);//M(A1;B0) cout << "P1: Sending B0 to P5" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 5, 0, MPI_COMM_WORLD);//P(B0)->5 cout << "P1: Receiving B3 from P6" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 6, 0, MPI_COMM_WORLD, &stat1);//O(B3)<-6 A1B3 = dobytok_2_matruc(36, 43, N2, A1, Bi);//M(A1;B3) cout << "P1: Sending B3 to P5" << endl; for (int i = 0; i < N2; i++) MPI_Send(&(Bi[i][0]), 43, MPI_INT, 5, 0, MPI_COMM_WORLD);//P(B3)->5 cout << "P1: Receiving B5 from P6" << endl; for (int i = 0; i < N2; i++) MPI_Recv(&(Bi[i][0]), 43, MPI_INT, 6, 0, MPI_COMM_WORLD, &stat1);//O(B5)<-6 A1B5 = dobytok_2_matruc(36, 43, N2, A1, Bi);//M(A1;B5) MPI_Recv(&flag, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &stat1); write_matrix_to_fileC(f1, "C1", A1B0, A1B1, A1B2, A1B3, A1B4, A1B5, A1B6, A1B7, 36, 43, 48); cout << "W(C1)" << endl; MPI_Send(&flag, 1, MPI_FLOAT, 2, 0, MPI_COMM_WORLD); auto end_MPI = chrono::steady_clock::now(); float elapsed_time_MPI = float(chrono::duration_cast cout << "Elapsed time for P1 (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 |