Skip to content
Draft
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
84ece81
[upload]
gsvval Oct 29, 2025
dd39e3b
[]
gsvval Oct 30, 2025
90bb885
[][]
gsvval Oct 30, 2025
8d3caba
[][][]
gsvval Oct 30, 2025
7239884
[][][][]
gsvval Oct 30, 2025
1aa872f
[][][][][]
gsvval Oct 30, 2025
cb7a2c4
[][][][][][]
gsvval Oct 30, 2025
ccf9441
()
gsvval Oct 30, 2025
8437589
()()
gsvval Oct 30, 2025
d6a8b46
Merge branch 'learning-process:master' into guseva_a_matrix_sums
gsvval Oct 31, 2025
52ae2e3
()()()
gsvval Oct 31, 2025
c7f1d43
Merge branch 'guseva_a_matrix_sums' of https://github.com/gsvval/ppc-…
gsvval Oct 31, 2025
4964435
()()()()
gsvval Oct 31, 2025
59bff64
()()()
gsvval Oct 31, 2025
a2845ad
()()
gsvval Oct 31, 2025
03bd47f
()
gsvval Oct 31, 2025
dffa114
()()
gsvval Oct 31, 2025
a2ba8da
()()()
gsvval Nov 1, 2025
6f5bc6b
()()()()
gsvval Nov 1, 2025
535b7c5
()()()
gsvval Nov 1, 2025
428523a
()()
gsvval Nov 1, 2025
09cc0e7
()
gsvval Nov 1, 2025
5a614e7
()()
gsvval Nov 1, 2025
6329ffa
()()()
gsvval Nov 1, 2025
48c593f
Merge branch 'learning-process:master' into guseva_a_matrix_sums
gsvval Nov 3, 2025
6b09921
Merge branch 'learning-process:master' into guseva_a_matrix_sums
gsvval Nov 5, 2025
ea44c6c
Моя попытка номер 15544523110045
gsvval Nov 5, 2025
9c5efc1
Merge branch 'guseva_a_matrix_sums' of https://github.com/gsvval/ppc-…
gsvval Nov 5, 2025
6b7eff9
sdfgdsfgh
gsvval Nov 5, 2025
46199e4
bdb
gsvval Nov 5, 2025
e1398d3
jklds
gsvval Nov 5, 2025
8dc9d83
msg
gsvval Nov 5, 2025
68301d2
sdf
gsvval Nov 5, 2025
3f0c2bb
...
gsvval Nov 6, 2025
5b308b8
Господи помилуй
gsvval Nov 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tasks/guseva_a_matrix_sums/common/include/common.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include <tuple>

#include "task/include/task.hpp"

namespace guseva_a_matrix_sums {
using InType = std::tuple<uint32_t, uint32_t, std::vector<double>>;
using OutType = std::vector<double>;
using TestType = std::string;
using BaseTask = ppc::task::Task<InType, OutType>;

} // namespace guseva_a_matrix_sums
3 changes: 3 additions & 0 deletions tasks/guseva_a_matrix_sums/data/cases/test1.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions tasks/guseva_a_matrix_sums/data/cases/test10.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions tasks/guseva_a_matrix_sums/data/cases/test2.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions tasks/guseva_a_matrix_sums/data/cases/test3.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions tasks/guseva_a_matrix_sums/data/cases/test4.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions tasks/guseva_a_matrix_sums/data/cases/test5.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions tasks/guseva_a_matrix_sums/data/cases/test6.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions tasks/guseva_a_matrix_sums/data/cases/test7.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions tasks/guseva_a_matrix_sums/data/cases/test8.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions tasks/guseva_a_matrix_sums/data/cases/test9.txt

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tasks/guseva_a_matrix_sums/data/expected/test1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
101
1194 1118 272 81 595 -741 -466 706 704 -324 432 343 -388 193 -578 -175 885 188 -63 155 -1625 479 170 -258 264 -293 68 -462 -187 60 -1399 412 -1017 -293 612 315 21 172 -229 1154 886 54 132 120 425 79 -291 1123 316 -237 -1287 -743 -997 -600 695 578 -306 -1059 1291 -428 -368 412 -376 625 28 57 827 -397 -273 682 -123 -434 246 -133 -125 122 161 -313 177 472 361 1594 261 -158 -646 31 -351 -88 -1839 381 -105 -99 277 -360 -421 -160 655 432 -217 -492 1310
2 changes: 2 additions & 0 deletions tasks/guseva_a_matrix_sums/data/expected/test10.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
103
336 135 -34 -1395 390 1252 -289 -458 -1185 643 -327 -363 -801 -744 -299 413 1133 -334 412 350 -321 -98 -1631 819 -421 662 966 -917 787 -1398 -432 -123 -531 -1076 -836 -172 138 -203 606 451 -51 52 246 754 -534 817 -230 347 -1130 -284 764 522 757 437 39 296 1114 -204 -1099 -776 -1278 756 136 374 -1248 -781 12 799 -152 373 -838 -1661 -23 417 -870 -586 396 690 -59 292 -109 -319 -323 1277 -93 -72 -156 1032 993 1214 -322 -212 633 1328 123 -141 554 -327 -64 1065 -513 -1211 774
2 changes: 2 additions & 0 deletions tasks/guseva_a_matrix_sums/data/expected/test11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
5
55.0 60.0 65.0 70.0 75.0
2 changes: 2 additions & 0 deletions tasks/guseva_a_matrix_sums/data/expected/test2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
138
170 -466 486 316 44 230 666 -598 400 354 154 -120 273 218 597 398 454 -486 203 -173 1223 545 580 -124 -519 -85 -132 577 57 -301 -417 -169 -591 684 232 646 -314 186 -225 -354 -173 596 797 -193 200 -2 -759 -78 747 673 845 -990 -3 908 929 -317 164 27 -381 264 -238 -272 -32 -588 -236 268 317 -325 -586 611 -415 1192 -17 -592 -429 -45 -432 -713 421 -947 -422 55 377 -252 -959 -179 -628 590 -609 -363 173 796 -215 20 1107 -619 -159 -494 -313 -343 -1400 1005 -322 317 605 229 1201 764 602 -268 -801 -281 -26 342 731 -670 1317 201 -350 -193 -1097 -390 466 -321 76 372 1062 25 -1123 295 -1554 -395 -1083 -910 1301 -459 -277 177
2 changes: 2 additions & 0 deletions tasks/guseva_a_matrix_sums/data/expected/test3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
154
600 -57 -689 -96 -585 1 -221 -131 1980 2011 -844 -28 -373 95 241 787 -714 202 332 888 -863 -1093 530 -1347 -87 513 -487 -491 -314 1027 30 267 379 305 368 -1064 -92 276 746 742 -1210 -107 273 -35 -249 691 -418 440 -205 10 -45 318 123 -1489 232 589 -445 -45 -131 -11 -505 446 718 -239 -387 726 1319 -614 -92 282 148 -1478 -285 -588 66 3 -738 -604 -34 560 -639 50 462 -32 -258 -173 347 128 605 97 -1045 249 239 97 -154 -221 -422 -2096 -281 277 541 426 -228 -369 -1745 -857 -542 -734 447 -121 174 -402 -45 -641 -52 -347 -271 824 -2 -330 141 -563 1356 -40 -1042 -1472 328 -186 234 702 -184 251 939 -254 219 -47 -96 499 -287 -1171 139 532 -134 441 -2597 -479 -791 191 485 248 -967 1099 -1100 -51
2 changes: 2 additions & 0 deletions tasks/guseva_a_matrix_sums/data/expected/test4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
197
650 -674 -68 787 -507 861 136 1592 -165 -446 214 -1137 995 -1184 -653 17 18 387 383 495 964 831 450 -311 -452 -197 -937 -186 -646 -509 -348 1172 686 735 -951 817 -332 305 -739 -773 -632 530 -528 -26 864 614 679 -267 -670 -588 407 244 746 1529 -169 -16 -230 -392 116 -790 -359 -1265 192 -1447 1164 1459 -373 596 -821 507 -1283 -244 -353 7 786 -320 -752 -537 1095 -67 -1017 573 473 662 428 25 -530 -738 1016 -170 706 -186 -69 1387 -73 184 465 -436 888 163 -560 -969 9 1369 258 1139 814 -105 -1043 704 -758 1075 -1029 -941 298 1080 722 747 -937 -127 -873 -678 614 516 -933 864 -187 -511 -289 -64 251 -53 -170 534 -1139 -211 476 -506 356 37 54 1417 -507 -542 812 -271 502 -762 -1613 403 1138 381 -58 716 246 -1571 -325 -225 105 -896 -700 356 617 826 326 -314 -425 265 -263 1332 -912 -276 651 16 1464 -996 711 -1093 1604 -235 673 1602 -813 -692 164 -31 313 580 -299 873 -541 341 -337 -1005 2035 -68 60
2 changes: 2 additions & 0 deletions tasks/guseva_a_matrix_sums/data/expected/test5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
148
76 211 71 220 483 396 -1549 -299 -1276 678 -560 -849 488 -505 -383 -42 -211 619 421 -173 -244 392 -180 456 773 246 -231 968 39 41 -174 -299 293 -860 -418 -290 -35 220 319 1043 -116 -58 327 -669 15 303 -644 -226 -98 -142 633 257 339 326 -1263 17 423 540 270 -614 -706 -464 -314 -71 617 -20 31 -362 59 270 -452 25 -232 -151 208 652 1166 661 566 -67 741 -230 -43 -261 -1030 -204 285 -311 25 -372 -721 -155 479 -1087 -910 318 -1103 -79 -302 -256 202 258 -260 534 -400 65 -505 -675 -484 -712 417 -729 669 -634 657 -606 103 243 946 79 307 46 -258 -527 155 -1008 -42 262 -215 -120 -93 -306 -239 -281 389 -42 189 261 246 -152 273 -568 55 124 400 639 764 50
2 changes: 2 additions & 0 deletions tasks/guseva_a_matrix_sums/data/expected/test6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
171
1531 -741 368 114 -1094 -252 1054 1163 1344 -1648 -410 727 1179 -524 1005 613 -1095 403 -104 178 -634 312 294 -14 116 -279 -395 122 -705 -123 -451 -804 -101 -1242 229 -383 -192 591 -735 287 545 534 250 -435 -690 161 93 -355 891 -1040 -252 -893 372 772 -639 -390 -1580 -155 -347 -353 298 -191 608 234 -966 -462 573 443 -889 405 1321 316 -744 233 -2234 -34 1088 1525 -312 137 380 -599 -231 891 -863 612 -234 363 1110 -197 253 1156 517 113 -255 67 402 -579 -104 -1073 835 -449 -34 -309 -955 -665 -996 -408 229 285 -235 412 112 -181 -38 -33 -1077 1597 1157 569 562 964 78 -159 -640 539 261 -774 -742 502 261 -27 -604 22 837 271 -205 -237 -302 211 -834 942 -33 -223 106 21 -488 -541 -221 -181 410 780 -317 -201 1060 -782 45 875 894 -182 -1186 -301 -514 551 -244 -135 -1311 718 -731 244 22
2 changes: 2 additions & 0 deletions tasks/guseva_a_matrix_sums/data/expected/test7.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
190
-219 -108 -989 -412 -804 858 -235 -734 571 635 -1046 -532 522 -290 687 197 -348 536 -352 -191 -119 871 -140 119 237 103 97 -234 837 964 594 309 -451 -447 -609 336 58 -146 -240 -25 -93 -206 -197 263 -132 -1494 725 -1652 -817 -781 -1536 147 -220 17 280 -735 138 -584 172 -383 267 67 507 1064 691 1033 364 -391 241 310 -1838 581 -139 -125 192 -226 732 355 -357 908 -794 1016 56 424 -46 -243 485 -177 -594 7 776 819 -897 889 -576 740 -85 -1280 1025 9 -1202 139 -683 1231 -1298 -466 -369 -136 529 245 -82 -290 122 265 -233 -44 1473 -1053 -4 288 -194 873 -96 -914 431 -9 878 491 -140 922 551 168 50 -137 207 856 -246 -202 146 -91 -160 562 744 208 276 1159 -745 380 -570 -517 606 -412 337 -643 -153 -282 327 -336 -297 -211 576 1199 -53 -471 -111 -862 421 -1104 -309 535 765 -1055 727 -346 1427 1492 700 -299 673 -794 566 -824 -231 -34 1207 486 566 -1022 375 -720
2 changes: 2 additions & 0 deletions tasks/guseva_a_matrix_sums/data/expected/test8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
173
-640 584 -28 -469 647 -259 1005 -96 -1072 -749 86 979 -1469 -759 -1538 549 660 1141 29 268 793 -844 359 655 -308 51 281 -1075 -445 -771 -17 -523 -244 -72 -10 -14 594 -1313 -168 91 665 270 -757 360 -104 205 784 -692 21 -647 -14 543 -582 -990 341 -181 -74 1345 -1599 -1077 826 -652 -114 -56 1250 908 224 1323 -1609 70 21 -122 -471 34 917 800 -1327 -1103 957 334 -59 937 -279 464 -723 1243 -710 -821 -1400 -747 -911 841 414 63 1259 -407 -520 758 854 -962 -246 -168 -480 287 -227 -729 34 1601 682 326 -16 771 993 -1090 -235 -211 1510 -512 898 267 380 946 389 569 886 -291 -475 395 733 -561 -796 821 -516 -691 1065 723 494 797 589 -50 939 560 -493 -818 -122 -347 -100 2352 385 1558 -90 -124 -1442 924 -349 -117 592 553 -30 422 -262 -891 98 -272 792 -3 -265 988 168 -803 1293 560 330
2 changes: 2 additions & 0 deletions tasks/guseva_a_matrix_sums/data/expected/test9.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
196
-255 191 964 -15 -323 773 410 -441 -340 119 -10 -298 266 -90 363 869 302 -749 -13 446 -527 -511 51 -812 168 -534 -1388 -332 -932 1687 -1497 -24 -725 59 135 -449 -1733 -295 36 -38 704 915 -404 162 98 644 -840 -598 263 45 492 -184 290 -831 1016 -590 -150 288 400 565 -233 -339 1078 1219 416 -125 -858 103 -515 433 -315 192 917 685 263 -1091 676 113 -98 -1571 542 316 -499 172 583 -556 -399 799 1267 1033 -102 200 -198 741 -655 300 184 605 706 14 304 109 -723 -286 -596 588 15 253 -361 -998 -694 24 -1172 788 -216 1552 -1325 520 -233 304 306 475 -405 1372 1239 -38 -278 350 -272 -244 158 205 -217 -184 -1234 -414 1443 174 -676 350 -1221 -227 197 247 515 -189 -683 1207 -868 -410 -1339 401 901 -691 -1394 389 527 -414 785 -37 -304 1003 942 -601 -85 -31 -212 401 629 -504 95 1446 -821 -907 584 -57 949 780 -567 694 -763 -323 -802 791 155 85 -1046 1130 -237 81 623 -510 -367 -212 -196 -583
2 changes: 2 additions & 0 deletions tasks/guseva_a_matrix_sums/data/perf/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1000
-949 2049 -285 322 3643 1270 736 1709 -409 -1394 802 1468 -2553 -6790 -750 725 -982 220 1193 -2806 -2608 -2833 425 -4546 -858 1998 1494 1523 929 179 -2959 -2166 -2375 -1633 2325 -376 -1049 961 -2164 -447 -164 181 -2850 3123 2735 -222 -790 949 -1004 -1447 -47 -540 -1333 2219 -1723 60 251 687 742 -1125 472 -2104 -303 -3591 41 2104 4841 1248 435 1719 1480 242 -10 -2636 -1263 148 -747 2011 2082 1979 1243 1390 -875 -4072 2040 2368 395 -1515 -1564 -2031 -2441 -145 73 3487 -2777 3116 1205 2052 2213 1742 -3521 989 381 -2433 -89 630 -120 -2032 1330 565 -828 -1629 -4204 -437 984 2533 -418 -2206 1352 -1564 1198 470 -1501 -230 -1368 2573 -2376 -3729 386 -467 1656 -3684 -62 -1340 3114 1902 -1931 -1307 -3169 -3024 -5449 -710 -1660 2511 161 3508 1910 1726 -1608 -1376 -1145 771 1252 -3683 3192 2454 2450 -3928 2292 -511 2957 1710 -1876 1754 -306 930 1799 733 -1170 1205 5094 -2132 -1631 1457 -116 533 -971 2466 -1256 126 -3482 -867 -689 -59 1724 -950 1236 -2383 -64 1519 -2254 2019 1042 -1125 2556 -2184 -1590 -1277 -432 2474 3415 502 -733 486 629 2219 -1583 -102 -3176 -4331 -4663 3535 -1834 -2352 -1241 -2216 -281 -862 -854 1106 -948 295 2885 -244 3416 -1712 -1726 1935 -706 1887 407 -2346 -1091 -1418 2192 895 2206 -2312 -728 -1223 -1196 100 115 4686 3091 2020 716 -565 -106 -554 555 -116 -3792 1368 2245 498 738 -2721 -2703 -1585 2361 3540 308 2515 -2007 655 -1071 2218 -3897 -551 -607 -1831 1415 308 260 1078 -1141 -46 2132 493 -1784 970 -1251 11 1997 -2056 -1489 -1251 -738 -799 1227 1824 -2214 -948 -3555 -555 -649 487 -627 2232 666 2769 158 1040 -1683 -1103 -1055 1508 975 776 5169 -1341 1749 819 -1604 939 -819 215 -2585 -20 1872 264 -2791 -1336 384 4064 1831 -461 1180 667 3199 1278 -2340 -3437 -1085 3283 528 1290 -716 3251 -1350 1142 703 -18 978 236 1291 2069 -7 363 -813 550 350 -2847 -567 -687 396 681 1602 432 -506 25 -455 -40 3193 993 1592 150 -514 -1936 3063 -1762 108 1338 2330 1119 140 -1465 -3977 668 -1903 2868 1881 -2497 247 1128 -1388 -977 1472 3868 228 -758 -1002 -1175 -955 795 -255 1414 1870 551 -2198 -1977 -1180 796 418 -99 170 1879 -2141 2258 2162 -3079 -1937 -1450 1400 57 359 -231 502 -440 19 1298 2238 1088 -2030 904 -46 65 624 -477 1216 2225 -2329 550 -786 1539 78 -3163 -574 2953 326 8 -1275 -236 -690 -2381 608 1418 -2133 1105 2935 1049 2375 1727 695 455 796 -1634 -1199 1773 356 -482 80 -1702 -1918 76 2722 4401 3503 -333 1264 1692 -104 703 2354 470 1500 22 857 -2873 4516 724 930 1652 -1998 779 1882 1370 -1477 1194 -1490 -1250 -489 2939 2855 -258 2032 777 2640 -1419 2390 -708 -1691 1485 -949 -2954 -2947 -4489 1414 -2714 -755 -261 1353 774 -509 -928 -2090 2123 2440 2672 -3462 -1476 -1794 752 679 823 251 -1075 1804 -1863 -1701 -3158 269 246 3299 371 1617 -1264 -1956 3148 672 3103 953 -2220 416 655 -1919 -2045 -3220 345 -1783 2904 -99 -2496 -1283 -2145 -1278 951 3440 563 -585 -1567 1160 -973 3191 1429 -1066 -3845 1313 1643 -2952 941 2578 2016 -1654 879 3275 2062 904 354 1855 -2684 1028 -1009 2644 10 954 -459 -1045 -884 2329 605 250 1513 2431 -3349 606 -1887 964 4296 -176 -403 -2666 1832 -2193 1992 -1320 -1914 -2823 -84 -1539 1359 -3394 -4041 1706 1926 1267 3388 606 1727 143 1056 421 362 2152 -1024 1255 1253 2095 -545 -2020 2166 1025 -1642 -972 -705 -1431 1824 231 -2020 -1198 728 3065 1233 -263 -2481 -1175 125 1450 -277 -278 291 -170 3163 -2023 562 -465 -415 2806 297 -1509 -1845 -600 -890 -1800 2475 -1609 1259 1261 2172 -419 -812 -1502 -1370 -357 324 3112 -5 2173 2067 -49 -3510 -651 1476 269 1084 1619 -3025 -1679 992 982 -6038 1077 -843 -1405 0 -1123 -15 -960 -3612 -5099 1846 2440 2687 -50 117 1880 -2529 -2204 189 -1749 -1908 -2387 -2004 1433 -1516 -2399 -3695 -477 612 1280 2951 -2086 2489 -1873 4373 -1258 -369 -1226 285 996 -1311 281 -158 368 131 112 1959 593 -2889 898 -2183 -1468 -1126 -621 2870 765 2544 -2294 3095 352 -696 -655 1342 2236 12 -872 -3006 2550 -1711 -1204 -1846 183 -65 -72 724 1501 191 -1973 -3071 -746 -2244 -803 -1720 -1310 -1748 -2756 -351 -3440 573 862 2426 1982 314 -535 -3692 4145 1383 -2852 581 3210 -1448 78 710 885 395 1440 -4700 -388 -91 3769 -573 -146 -6046 1469 1250 173 -898 -1653 -4116 -33 2248 1610 1524 1502 -3610 2953 323 -4595 1225 2462 -1727 -3274 -129 1807 -2065 1387 -562 447 2650 -1445 -1159 2644 -57 -1152 -793 -10 2324 2269 2075 -2641 611 -4426 1977 -112 -1759 593 215 140 -146 -465 -1683 -1878 -1826 -1636 1368 937 -3598 -842 -935 281 -276 -1485 -1508 -1330 281 -237 -1196 -3195 -750 2843 1815 -3030 -784 123 -99 2750 -1662 2913 -1322 2512 1171 -1278 258 -1659 -3851 -1178 813 2093 1667 582 1117 2178 2378 1144 2375 -5420 2626 -2067 566 -944 697 -38 -1216 1438 -2031 -685 -3687 1373 -2819 60 -1130 -479 771 -443 -1201 995 1174 856 499 -4061 -544 -1193 -3392 1029 1446 761 -594 -650 -925 -577 474 1328 -94 3257 1133 231 -846 -1090 -738 -1591 -1163 1368 159 456 -2080 -791 2636 -971 109 1705 191 -970 364 1334 -4137 -3186 2199 1776 -3380 -2256 -3337 1032 -1306 -1649 -424 104 -2678 1296 790 -307 -3539 1811 -1805 -946 193 -1318 549 -887 3803 -2545 4070 -3011 -1556 -752 -1637 514 2573 1846 145 -859 2226 -436 2201 -202 -744 963 1147 103 223
3 changes: 3 additions & 0 deletions tasks/guseva_a_matrix_sums/data/perf/input.txt

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions tasks/guseva_a_matrix_sums/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"student": {
"first_name": "Алёна",
"last_name": "Гусева",
"middle_name": "Алексеевна",
"group_number": "3823Б1ФИ2",
"task_number": "1"
}
}
22 changes: 22 additions & 0 deletions tasks/guseva_a_matrix_sums/mpi/include/ops_mpi.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once

#include "guseva_a_matrix_sums/common/include/common.hpp"
#include "task/include/task.hpp"

namespace guseva_a_matrix_sums {

class GusevaAMatrixSumsMPI : public BaseTask {
public:
static constexpr ppc::task::TypeOfTask GetStaticTypeOfTask() {
return ppc::task::TypeOfTask::kMPI;
}
explicit GusevaAMatrixSumsMPI(const InType &in);

private:
bool ValidationImpl() override;
bool PreProcessingImpl() override;
bool RunImpl() override;
bool PostProcessingImpl() override;
};

} // namespace guseva_a_matrix_sums
93 changes: 93 additions & 0 deletions tasks/guseva_a_matrix_sums/mpi/src/ops_mpi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#include "guseva_a_matrix_sums/mpi/include/ops_mpi.hpp"

#include <mpi.h>

#include <cstdint>

namespace guseva_a_matrix_sums {

GusevaAMatrixSumsMPI::GusevaAMatrixSumsMPI(const InType &in) {
SetTypeOfTask(GetStaticTypeOfTask());
GetInput() = in;
GetOutput() = {};
}

bool GusevaAMatrixSumsMPI::ValidationImpl() {
return (static_cast<uint64_t>(std::get<0>(GetInput())) * std::get<1>(GetInput()) == std::get<2>(GetInput()).size()) &&
(GetOutput().empty());
}

bool GusevaAMatrixSumsMPI::PreProcessingImpl() {
GetOutput().clear();
GetOutput().resize(std::get<1>(GetInput()), 0.0);
return true;
}

bool GusevaAMatrixSumsMPI::RunImpl() {
int rows = 0;
int columns = 0;
std::vector<double> matrix;
int wsize = 0;
int rank = 0;

MPI_Comm_size(MPI_COMM_WORLD, &wsize);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);

if (rank == 0) {
rows = static_cast<int>(std::get<0>(GetInput()));
columns = static_cast<int>(std::get<1>(GetInput()));
matrix = std::get<2>(GetInput());
}

MPI_Bcast(&rows, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast(&columns, 1, MPI_INT, 0, MPI_COMM_WORLD);

uint32_t rows_per_proc = rows / wsize;
uint32_t remainder = rows % wsize;

std::vector<int> displs(wsize, 0);
std::vector<int> counts;
counts.reserve(wsize);

if (rank == 0) {
for (int rnk = 0; rnk < wsize; rnk++) {
uint32_t start_row = (rnk * rows_per_proc) + std::min(static_cast<uint32_t>(rnk), remainder);
uint32_t end_row = ((rnk + 1) * rows_per_proc) + std::min(static_cast<uint32_t>(rnk + 1), remainder);
uint32_t start_pos = start_row * columns;
uint32_t end_pos = end_row * columns;
counts.push_back(static_cast<int>(end_pos - start_pos));
for (int i = rnk + 1; i < wsize; i++) {
displs[i] += counts.back();
}
}
}

MPI_Bcast(counts.data(), static_cast<int>(counts.size()), MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast(displs.data(), static_cast<int>(displs.size()), MPI_INT, 0, MPI_COMM_WORLD);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Badge Broadcast uses uninitialized counts buffer

counts is only filled on rank 0 but other ranks keep it empty. The subsequent MPI_Bcast(counts.data(), counts.size(), MPI_INT, 0, MPI_COMM_WORLD) therefore broadcasts wsize elements from the root while receivers provide count=0 and a null buffer, which violates MPI’s requirement that all ranks pass the same element count and leaves no storage for the incoming data. On multi‑process runs this results in an MPI error or crash and counts[rank] is undefined before MPI_Scatterv. The vector should be resized to wsize (and populated via the broadcast) before calling MPI_Bcast.

Useful? React with 👍 / 👎.


uint32_t start_row = (rank * rows_per_proc) + std::min(static_cast<uint32_t>(rank), remainder);
uint32_t end_row = ((rank + 1) * rows_per_proc) + std::min(static_cast<uint32_t>(rank + 1), remainder);

uint32_t start_pos = start_row * columns;
uint32_t end_pos = end_row * columns;

std::vector<double> slice(end_pos - start_pos, 0);
MPI_Scatterv(matrix.data(), counts.data(), displs.data(), MPI_DOUBLE, slice.data(), counts[rank], MPI_DOUBLE, 0,
MPI_COMM_WORLD);
std::vector<double> local_sums(columns, 0);
for (uint32_t i = 0; i < end_pos - start_pos; i++) {
local_sums[i % columns] += slice[i];
}

std::vector<double> global_sums(columns, 0);
MPI_Reduce(local_sums.data(), global_sums.data(), columns, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Bcast(global_sums.data(), columns, MPI_DOUBLE, 0, MPI_COMM_WORLD);
GetOutput().assign(global_sums.begin(), global_sums.end());
return true;
}

bool GusevaAMatrixSumsMPI::PostProcessingImpl() {
return true;
}

} // namespace guseva_a_matrix_sums
Empty file.
22 changes: 22 additions & 0 deletions tasks/guseva_a_matrix_sums/seq/include/ops_seq.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once

#include "guseva_a_matrix_sums/common/include/common.hpp"
#include "task/include/task.hpp"

namespace guseva_a_matrix_sums {

class GusevaAMatrixSumsSEQ : public BaseTask {
public:
static constexpr ppc::task::TypeOfTask GetStaticTypeOfTask() {
return ppc::task::TypeOfTask::kSEQ;
}
explicit GusevaAMatrixSumsSEQ(const InType &in);

private:
bool ValidationImpl() override;
bool PreProcessingImpl() override;
bool RunImpl() override;
bool PostProcessingImpl() override;
};

} // namespace guseva_a_matrix_sums
38 changes: 38 additions & 0 deletions tasks/guseva_a_matrix_sums/seq/src/ops_seq.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "guseva_a_matrix_sums/seq/include/ops_seq.hpp"

namespace guseva_a_matrix_sums {

GusevaAMatrixSumsSEQ::GusevaAMatrixSumsSEQ(const InType &in) {
SetTypeOfTask(GetStaticTypeOfTask());
GetInput() = in;
GetOutput() = {};
}

bool GusevaAMatrixSumsSEQ::ValidationImpl() {
return (static_cast<uint64_t>(std::get<0>(GetInput())) * std::get<1>(GetInput()) == std::get<2>(GetInput()).size()) &&
(GetOutput().empty());
}

bool GusevaAMatrixSumsSEQ::PreProcessingImpl() {
GetOutput().clear();
GetOutput().resize(std::get<1>(GetInput()), 0.0);
return true;
}

bool GusevaAMatrixSumsSEQ::RunImpl() {
auto &matrix = std::get<2>(GetInput());
auto &columns = std::get<1>(GetInput());
auto &rows = std::get<0>(GetInput());
for (uint32_t i = 0; i < rows; i++) {
for (uint32_t j = 0; j < columns; j++) {
GetOutput()[j] += matrix[(i * columns) + j];
}
}
return true;
}

bool GusevaAMatrixSumsSEQ::PostProcessingImpl() {
return true;
}

} // namespace guseva_a_matrix_sums
7 changes: 7 additions & 0 deletions tasks/guseva_a_matrix_sums/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tasks_type": "processes",
"tasks": {
"mpi": "enabled",
"seq": "enabled"
}
}
Loading
Loading