Conversation
| { | ||
| /// <summary> | ||
| /// then file is empty | ||
| /// </summary> |
There was a problem hiding this comment.
Что-то с отступами злое
| namespace ParallelMatrixMultiplication | ||
| { | ||
| /// <summary> | ||
| /// then we couldn't multiplication matrices |
There was a problem hiding this comment.
Как-то не по-английски
| static void Main(string[] args) | ||
| { | ||
| var matrixTest = new int[1000, 1000]; | ||
| Stopwatch stopWatch = new Stopwatch(); |
| stopWatch.Start(); | ||
| for (int i = 0; i < 10; i++) | ||
| { | ||
| var testTime =MatrixFunctions.MatrixMultiplicationParallel(matrixTest, matrixTest); |
There was a problem hiding this comment.
| var testTime =MatrixFunctions.MatrixMultiplicationParallel(matrixTest, matrixTest); | |
| var testTime = MatrixFunctions.MatrixMultiplicationParallel(matrixTest, matrixTest); |
| stopWatch.Stop(); | ||
| var time = stopWatch.ElapsedMilliseconds; | ||
| Console.WriteLine($"Среднее время обычного умножения матриц 1000*1000: {time / 10} ms"); | ||
| Console.WriteLine($"Среднее время параллельного умножения матриц 1000*1000: {timeParallel / 10} ms"); |
There was a problem hiding this comment.
Это лучше, чем ничего, но надо было на разных размерностях попробовать, чтобы понять, всегда ли многопоточный алгоритм быстрее. И записать сюда в комментарии результаты, которые конкретно у Вас получились
| { | ||
| if (filePath == "") | ||
| { | ||
| throw new Exception(); |
There was a problem hiding this comment.
ArgumentException лучше. Просто Exception вообще никогда не надо кидать, его не отфильтровать потом в catch-е
| fileOut.Delete(); | ||
| } | ||
| using var newFile = new FileStream(filePath, FileMode.Create); | ||
| var file = new StreamWriter(newFile); |
There was a problem hiding this comment.
Он вроде тоже IDisposable, так что using
| [Test] | ||
| public void TestNormalDataParallel() | ||
| { | ||
| var matrix1 = new int[1000,1000]; |
There was a problem hiding this comment.
Пробелов после "," не хватает
| var matrix1 = new int[1000,1000]; | ||
| var matrix2 = new int[1000,1000]; | ||
| var result = new int[1000,1000]; | ||
| var matrix = MatrixFunctions.MatrixMultiplicationParallel(matrix1, matrix2); |
There was a problem hiding this comment.
Мм, нулевые матрицы перемножаются?
| { | ||
| static void Main(string[] args) | ||
| { | ||
| var matrixTest = new int[1000, 1000]; |
There was a problem hiding this comment.
Непоказательно. Надо именно сгенерировать какие-нибудь матрицы с какими-нибудь адекватными числами
yurii-litvinov
left a comment
There was a problem hiding this comment.
Надо немного код в порядок привести
| [Test] | ||
| public void TestNormalFilePath() | ||
| { | ||
| int[,] result = {{ 2, 1, 2}, {4, 1, 5}, {1, 5, 3}} ; |
There was a problem hiding this comment.
Что-то как-то пробелы то ли один лишний, то ли много не хватает. И двумерные массивы лучше на нескольких строчках писать, чтобы было в виде матрицы.
| namespace ParallelMatrixMultiplication | ||
| { | ||
| /// <summary> | ||
| /// File's function |
There was a problem hiding this comment.
Функция Файла? :) Какая функция и какого файла? Надо по-английски тренироваться писать (можно сначала с Google Translate или аналогичным сервисом от Яндекса, потом привыкнете и можно будет без них)
| } | ||
| } | ||
|
|
||
| private static (int, int) CountSizeMatrix(string filePath) |
| /// </summary> | ||
| public static class MatrixFunctions | ||
| { | ||
| public static int[,] MatrixMultiplicationParallel(int[,] matrix1, int[,] matrix2) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| Результаты на матрицах размеров 128*128. | ||
| Количество повторов: 100. | ||
| Паралельное умножение: | ||
| Матожидание = 13,75 |
There was a problem hiding this comment.
Обязательно приводите размерность величин
| Количество повторов: 100. | ||
| Паралельное умножение: | ||
| Матожидание = 13,75 | ||
| Среднеквадратичное отклонение = 3,897114317029974 |
There was a problem hiding this comment.
Не надо столько знаков после запятой. Матожидание имеет два знака, так и тут можно.
|
|
||
| namespace ParallelMatrixMultiplication | ||
| { | ||
| public class Statistics |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
yurii-litvinov
left a comment
There was a problem hiding this comment.
Тут уже число попыток близко к исчерпанию, поэтому надо, чтобы в следующий раз всё было идеально, или всё-таки минус полбалла :)
| var matrix1 = new int[3,4]; | ||
| var matrix2 = new int[3,3]; |
There was a problem hiding this comment.
С пробелами беда. Научитесь пользоваться https://github.com/DotNetAnalyzers/StyleCopAnalyzers, поможет :)
| { | ||
| if (string.IsNullOrEmpty(filePath)) | ||
| { | ||
| throw new FilePathException("Error file path!"); |
There was a problem hiding this comment.
С английским беда. "Ошибка файл путь!"
|
|
||
| private static (int, int) CountMatrixSize(string filePath) | ||
| { | ||
| CheckFilePath((filePath)); |
There was a problem hiding this comment.
| CheckFilePath((filePath)); | |
| CheckFilePath(filePath); |
| CheckFilePath((filePath)); | ||
| (int length, int width) size = CountMatrixSize((filePath)); |
There was a problem hiding this comment.
Скобочки богу скобочек! https://lurkmore.to/LISP
| throw new MultiplicationException("Number of columns in the first matrix are not equal to the rows in the second matrix!"); | ||
| } | ||
| var matrix = new int[matrix1.GetLength(0), matrix2.GetLength(1)]; | ||
| var threads = new Thread[Environment.ProcessorCount]; |
There was a problem hiding this comment.
Если в матрице меньше строк, чем Environment.ProcessorCount, просто зря потоки создаёте
| */ | ||
|
|
||
| var matrixFirst = FileFunctions.CreateMatrix((args[0])); | ||
| var matrixSecond = FileFunctions.CreateMatrix(((args[1]))); |
There was a problem hiding this comment.
О, ещё больше скобок
| results[0] = (averageParallel, standardDeviationParallel); | ||
| results[1] = (averageNotParallel, standardDeviationNotParallel); | ||
| return results; | ||
| } |
There was a problem hiding this comment.
Тут вот с отступом не повезло, а я уж было хотел зачесть задачу полностью :) Рекомендую при коммите или хотя бы когда делаете пуллреквест просматривать диффы на предмет таких косяков, они сразу в глаза бросаются
yurii-litvinov
left a comment
There was a problem hiding this comment.
Да, всё хорошо, зачтена
No description provided.