Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ee280cb
seq version is done and tested
vassyusha Jan 1, 2026
bbb11dd
added test cases
vassyusha Jan 2, 2026
4d43fda
mpi version is done
vassyusha Jan 2, 2026
6569da6
fix: test cases passed correctly
vassyusha Jan 2, 2026
adae6cb
perf tests are done
vassyusha Jan 2, 2026
675f306
clang fix: size_t is int
vassyusha Jan 2, 2026
a7d15ed
clang fix: int is size_t in func tests check
vassyusha Jan 2, 2026
a01f781
clang fix: added static_cast to int
vassyusha Jan 2, 2026
7326c9f
clang fix: added static cast to size_t in validation
vassyusha Jan 2, 2026
dc90e49
clang fix: size_t is int
vassyusha Jan 2, 2026
1a8e9f5
clang fix: vert_sendcounts initializing for all ranks
vassyusha Jan 2, 2026
d6db834
debug: added cout in func tests
vassyusha Jan 2, 2026
1a791d3
fix: clang-tidy
vassyusha Jan 2, 2026
3be7a67
fix: clang-tidy build
vassyusha Jan 2, 2026
24be56d
big clang-tidy fix
vassyusha Jan 3, 2026
4572630
clang-tidy fix
vassyusha Jan 3, 2026
5f8c9e6
clang-tidy fix
vassyusha Jan 3, 2026
19605fa
another try to fix clang-tidy
vassyusha Jan 3, 2026
8bdf9ab
added nolint
vassyusha Jan 3, 2026
eef7c91
another NOLINT
vassyusha Jan 3, 2026
b1d01be
another clang-tidy fix
vassyusha Jan 3, 2026
839220d
fix: correct decllaration for ProcessLocalR
vassyusha Jan 3, 2026
590a204
NOLINT for the cycle
vassyusha Jan 3, 2026
c21e91e
clang-format
vassyusha Jan 3, 2026
3a740b6
report is almost done
vassyusha Jan 3, 2026
1008236
added new way of initializing perf tests
vassyusha Jan 3, 2026
8b78814
clang-tidy fix
vassyusha Jan 3, 2026
c63c186
oks
vassyusha Jan 3, 2026
ed9a66b
changed adding into queues
vassyusha Jan 3, 2026
59e249c
new data in report
vassyusha Jan 3, 2026
9b13080
test data should be reworked
vassyusha Jan 4, 2026
f387514
clang-tidy
vassyusha Jan 4, 2026
f906942
algorithm fixes
vassyusha Jan 4, 2026
17d1dfd
clang-tidy
vassyusha Jan 4, 2026
2837e9b
report is done
vassyusha Jan 4, 2026
546ce6e
everything should be ok
vassyusha Jan 4, 2026
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
29 changes: 29 additions & 0 deletions tasks/romanova_v_dijkstra_crs/common/include/common.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once

#include <functional>
#include <queue>
#include <string>
#include <utility>
#include <vector>

#include "task/include/task.hpp"

namespace romanova_v_dijkstra_crs {

struct Graph {
std::vector<double> weights;
std::vector<int> edges;
std::vector<int> offsets;

int vertices{};
int source{};
};

using MinHeap = std::priority_queue<std::pair<double, int>, std::vector<std::pair<double, int>>, std::greater<>>;

using InType = Graph;
using OutType = std::vector<double>;
using TestType = std::string;
using BaseTask = ppc::task::Task<InType, OutType>;

} // namespace romanova_v_dijkstra_crs
6 changes: 6 additions & 0 deletions tasks/romanova_v_dijkstra_crs/data/bigTest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
10 24
4 1 4 2 3 2 7 3 2 7 1 4 2 1 3 1 2 2 1 5 4 2 1 5
1 3 0 2 4 1 5 2 6 3 7 8 4 6 9 5 8 6 7 9 7 8 0 9
0 2 5 7 9 12 15 17 20 22 24
0
0 4 4 1 6 4 3 7 5 7
6 changes: 6 additions & 0 deletions tasks/romanova_v_dijkstra_crs/data/complGraphTest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
4 12
1 3 2 1 1 4 3 1 1 2 4 1
1 2 3 0 2 3 0 1 3 0 1 2
0 3 6 9 12
0
0 1 2 2
6 changes: 6 additions & 0 deletions tasks/romanova_v_dijkstra_crs/data/cycleGraphTest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
4 5
1 10 1 1 1
1 2 2 3 0
0 2 3 4 5
0
0 1 2 3
6 changes: 6 additions & 0 deletions tasks/romanova_v_dijkstra_crs/data/disconGraphTest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
3 1
5.0
1
0 1 1 1
0
0.0 5.0 -1.0
6 changes: 6 additions & 0 deletions tasks/romanova_v_dijkstra_crs/data/linGraphTest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
5 4
1 2 3 4
1 2 3 4
0 1 2 3 4 4
0
0 1 3 6 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
4 4
10 5 1 1
1 2 3 1
0 2 3 4 4
0
0 6 5 7
6 changes: 6 additions & 0 deletions tasks/romanova_v_dijkstra_crs/data/perf1000000.txt

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions tasks/romanova_v_dijkstra_crs/data/reallyBigTest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
100 200
8 4 3 9 6 2 5 7 1 3 6 4 8 5 2 7 9 1 4 5 3 7 6 2 8 9 1 5 4 6 3 8 7 2 9 1 6 5 7 4 9 8 3 1 2 7 6 8 5 1 9 4 2 3 8 7 9 6 2 1 5 3 4 9 8 1 7 3 2 6 4 5 1 9 2 8 4 3 7 5 6 2 1 3 9 5 4 8 6 7 3 2 4 1 6 5 9 7 8 4 3 5 2 7 6 1 8 9 5 4 6 3 8 7 2 9 1 6 5 7 4 9 8 3 1 2 7 6 8 5 1 9 4 2 3 8 7 9 6 2 1 5 3 4 9 8 1 7 3 2 6 4 5 1 9 2 8 4 3 7 5 6 2 1 3 9 5 4 8 6 7 3 2 4 1 6 5 9 7 8 4 3 5 2 7 6 1 8 9 5 4 6 3 8 7 2 9 1 8 7
12 45 67 23 89 34 56 78 90 15 36 58 79 91 24 47 69 80 92 13 35 57 68 81 93 14 37 59 70 82 94 16 38 60 71 83 95 17 39 61 72 84 96 18 40 62 73 85 97 19 41 63 74 86 98 10 42 64 75 87 99 11 43 65 76 88 99 20 44 66 77 88 90 21 45 67 78 89 91 22 46 68 79 90 92 23 47 69 80 91 93 24 48 70 81 92 94 25 49 71 82 93 95 26 50 72 83 94 96 27 51 73 84 95 97 28 52 74 85 96 98 29 53 75 86 97 99 30 54 76 87 98 99 31 55 77 88 99 0 32 56 78 89 0 1 33 57 79 90 1 2 34 58 80 91 2 3 35 59 81 92 3 4 36 60 82 93 4 5 37 61 83 94 5 6 38 62 84 95 6 7 39 63 85 96 7 8 40 64 86 97 8 9 41 65 87 98 9 10 42
0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168 170 172 174 176 178 180 182 184 186 188 190 192 194 196 198 200
0
0 40 20 15 28 30 14 20 8 24 34 33 8 29 17 31 39 45 40 7 45 39 19 38 6 32 54 49 50 35 30 26 19 42 18 26 30 30 19 14 15 29 33 30 20 4 21 27 25 -1 39 47 33 19 45 41 20 41 32 25 26 11 25 24 37 18 24 38 17 17 21 54 34 44 38 14 27 30 22 22 9 29 23 24 28 21 26 13 20 22 29 19 14 7 28 27 21 11 27 26
6 changes: 6 additions & 0 deletions tasks/romanova_v_dijkstra_crs/data/severalWaysTest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
4 5
3 1 1 5 1
1 2 3 3 1
0 2 3 5 5
0
0 2 1 3
6 changes: 6 additions & 0 deletions tasks/romanova_v_dijkstra_crs/data/simpleTest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
4 6
10.0 5.0 2.0 1.0 3.0 9.0
1 2 2 3 1 3
0 2 4 6 6
0
0.0 8.0 5.0 9.0
6 changes: 6 additions & 0 deletions tasks/romanova_v_dijkstra_crs/data/smallTest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
2 1
1.0
1
0 1 1
0
0.0 1.0
6 changes: 6 additions & 0 deletions tasks/romanova_v_dijkstra_crs/data/trivialTest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
1 0


0 0
0
0.0
9 changes: 9 additions & 0 deletions tasks/romanova_v_dijkstra_crs/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ФИ3",
"task_number": "3"
}
}
77 changes: 77 additions & 0 deletions tasks/romanova_v_dijkstra_crs/mpi/include/ops_mpi.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#pragma once

#include <mpi.h>

#include <vector>

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

namespace romanova_v_dijkstra_crs {

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

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

void RemoveFromQueues(int vert);
void CleanUpQueues();
void UpdateQueues(int vert);

void SetupMasterProcessData();
void CalculateGlobalMinInOut();
void BroadcastParameters();
void SetupLocalVertexRange(int rank);
void InitializeLocalArrays();
void SetupMinInOutArrays(int rank, int n);
[[nodiscard]] std::vector<int> CalculateVertexSendCounts(int rank, int n) const;
static std::vector<int> CalculateVertexDisplacements(int rank, int n, const std::vector<int> &vert_sendcounts);
void InitializeQueues();
void BroadcastGraphData(int rank);

void InitializeSource();
void RecieveData(int &flag, MPI_Status &status);
static void WaitRequests(std::vector<MPI_Request> &send_requests);
void MakeLocalR(std::vector<int> &local_r, double global_l, double global_m);
void ProcessLocalR(std::vector<int> &local_r, int &flag, MPI_Status &status);
std::vector<int> IsGlobalStop();
static double GetGlobalMin(MinHeap &q);

Graph data_;
std::vector<double> res_weights_;

std::vector<double> glob_min_in_;
std::vector<double> glob_min_out_;

std::vector<double> min_in_; // минимальный вес входящих ребер
std::vector<double> min_out_; // минимальный вес исходящих ребер

int local_n_{};
int st_vert_{};
int en_vert_{};

int delta_{};
int extra_{};

std::vector<double> local_d_; // приоритеты для qin и qout будем вычислять динамически, используя min_in_, min_out_
std::vector<bool> in_s_;
std::vector<bool> visited_;

MinHeap qd_;
MinHeap qin_;
MinHeap qout_;

std::vector<bool> in_qd_;
std::vector<bool> in_qin_;
std::vector<bool> in_qout_;
};

} // namespace romanova_v_dijkstra_crs
Loading
Loading