Ремизов Кирилл. Технология STL. Умножение плотных матриц алгоритмом Кэннона. Вариант 1#679
Open
BlackCorbeau wants to merge 37 commits intolearning-process:masterfrom
Conversation
MultiplyBlock - Multiplies two block matrices of size block_size × block_size ShiftBlocksLeft - Performs a cyclic shift of the blocks of matrix A to the left ShiftBlocksUp - Performs a cyclic shift of the blocks of matrix B up RunCannonCycle - Main loop of Cannon's algorithm InitializeBlocks - Initial distribution of blocks according to Cannon's algorithm AssembleOutput - Собирает результат из блоков в итоговую матрицу
Helper function for parallel execution of for from begin to end with division of work between std::thread::hardware_concurrency() threads
Helper function for parallel execution of for from element i to element j with division of work between std::thread::hardware_concurrency() threads
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (87.07%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #679 +/- ##
==========================================
+ Coverage 82.27% 82.30% +0.03%
==========================================
Files 497 499 +2
Lines 21191 21369 +178
Branches 8691 8754 +63
==========================================
+ Hits 17434 17587 +153
- Misses 2614 2627 +13
- Partials 1143 1155 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Описание
Реализация
Алгоритм Кэннона реализован с блочным разбиением матриц. Пользователь задаёт размер блока
block_size, который должен делить размер матрицыnбез остатка.Этапы:
AиBразбиваются на блоки размеромblock_size × block_size. Согласно схеме Кэннона, блокA[i][j]сдвигается влево наiпозиций, а блокB[i][j]– вверх наjпозиций (начальная перестановка).block_count = n / block_sizeшагов. На каждом шаге:A[i][j]иB[i][j], результат накапливается вC[i][j](стандартное умножение блоков).Aвлево и всех столбцов блоковBвверх.Cсобирается итоговая матрица.Параллелизация (STL)
std::threadс количеством потоков, равнымstd::thread::hardware_concurrency()(но не менее 1).ParallelFor(одномерный цикл) иParallelFor2D(двумерный цикл), которые разбивают диапазон итераций на непрерывные фрагменты (chunks) и запускают потоки для их обработки.ParallelFor2Dпоi,j);ParallelFor2D);ParallelFor2D);ShiftBlocksLeft) и по столбцам (дляShiftBlocksUp) с помощьюParallelFor.Содержание отчёта
В отчёте описывается:
ParallelFor,ParallelFor2D, управление потоками);Чек-лист
remizov_k_dense_matrix_multiplication_cannon_algorithmclang-formatлокально в моем форке (нет ошибок форматирования)clang-tidyлокально в моем форке (нет предупреждений/ошибок)remizov_k_dense_matrix_multiplication_cannon_algorithm)