|
9 | 9 | \usepackage{hyperref} % For hyperlinks
|
10 | 10 | \usepackage{listings}
|
11 | 11 | \usepackage{xcolor}
|
| 12 | +\usepackage{tikz} |
12 | 13 | \usepackage[T1]{fontenc}
|
13 | 14 |
|
14 | 15 | \lstdefinestyle{CStyle}{
|
|
64 | 65 | \tableofcontents
|
65 | 66 | \end{frame}
|
66 | 67 |
|
67 |
| -\section{Introduction} |
| 68 | +\section{The introduction to the repository} |
68 | 69 |
|
69 |
| -\begin{frame}{Slide} |
| 70 | +\begin{frame}[fragile]{Parallel programming technologies} |
| 71 | + \begin{itemize} |
| 72 | + \item \textbf{MPI} |
| 73 | + \item OpenMP |
| 74 | + \item TBB |
| 75 | + \item std::thread |
| 76 | + \end{itemize} |
70 | 77 | \end{frame}
|
71 | 78 |
|
72 |
| -\begin{frame} |
73 |
| - \centering |
74 |
| - \Huge{Thank You!} |
| 79 | +\begin{frame}[fragile]{Step-by-step guide to build the project} |
| 80 | + \begin{itemize} |
| 81 | + \item Download all submodules |
| 82 | + \item Set up your environment |
| 83 | + \item Build the project with CMake |
| 84 | + \end{itemize} |
| 85 | +\end{frame} |
| 86 | + |
| 87 | +\begin{frame}[fragile]{Download all submodules \& Set up your environment} |
| 88 | + |
| 89 | + \lstset{style=CStyle, caption=Git submodules} |
| 90 | + \begin{lstlisting} |
| 91 | + git submodule update --init --recursive |
| 92 | + \end{lstlisting} |
| 93 | + |
| 94 | + \lstset{style=CStyle, caption=Download MPI} |
| 95 | + \begin{lstlisting} |
| 96 | + // Windows |
| 97 | + msmpisdk.msi & msmpisetup.exe |
| 98 | + // Linux (gcc and clang) |
| 99 | + sudo apt install -y mpich openmpi-bin libopenmpi-dev |
| 100 | + // MacOS (apple clang) |
| 101 | + brew install open-mpi |
| 102 | + \end{lstlisting} |
| 103 | + |
| 104 | +\end{frame} |
| 105 | + |
| 106 | +\begin{frame}[fragile]{Build the project with help CMake} |
| 107 | + |
| 108 | + \lstset{style=CStyle, caption=Configure the build} |
| 109 | + \begin{lstlisting} |
| 110 | + cmake -S <source code/path to CMakeLists.txt> \ |
| 111 | + -B <build directory> \ |
| 112 | + -D USE_SEQ=ON \ |
| 113 | + -D USE_MPI=ON \ |
| 114 | + -D USE_FUNC_TESTS=ON \ |
| 115 | + -D USE_PERF_TESTS=ON \ |
| 116 | + -D CMAKE_BUILD_TYPE=Release .. |
| 117 | + \end{lstlisting} |
| 118 | + |
| 119 | + \lstset{style=CStyle, caption=Build the project} |
| 120 | + \begin{lstlisting} |
| 121 | + cmake --build <build directory> \ |
| 122 | + --config Release \ |
| 123 | + --parallel |
| 124 | + \end{lstlisting} |
| 125 | + |
| 126 | +\end{frame} |
| 127 | + |
| 128 | +\section{How to submit your work} |
| 129 | + |
| 130 | +\begin{frame}[fragile]{Directories} |
| 131 | + \begin{table}[h!] |
| 132 | + \resizebox{8cm}{!} { |
| 133 | + \begin{tabular}{| p{4.2 cm} | p{4.2 cm} |} |
| 134 | + \hline |
| 135 | + \textbf{Directory} & \textbf{What is it?} \\ |
| 136 | + \hline |
| 137 | + \textbf{.github/workflows} & CI \\ |
| 138 | + \hline |
| 139 | + \textbf{1stsamples} & Simple examples \\ |
| 140 | + \hline |
| 141 | + \textbf{3rdparty} & Auxiliary libraries \\ |
| 142 | + \hline |
| 143 | + \textbf{cmake} & CMake scripts \\ |
| 144 | + \hline |
| 145 | + \textbf{modules} & API source code \\ |
| 146 | + \hline |
| 147 | + \textbf{scripts} & Auxiliary scripts \\ |
| 148 | + \hline |
| 149 | + \textbf{tasks} & Students tasks \\ |
| 150 | + \hline |
| 151 | + \end{tabular} |
| 152 | + } |
| 153 | + \caption{Root directories} |
| 154 | + \end{table} |
| 155 | + |
| 156 | + \begin{table}[h!] |
| 157 | + \resizebox{8cm}{!} { |
| 158 | + \begin{tabular}{| p{4.2 cm} | p{4.2 cm} |} |
| 159 | + \hline |
| 160 | + \textbf{Directory} & \textbf{What is it?} \\ |
| 161 | + \hline |
| 162 | + \textbf{mpi} & MPI \\ |
| 163 | + \hline |
| 164 | + \textbf{omp} & OpenMP \\ |
| 165 | + \hline |
| 166 | + \textbf{seq} & Sequential \\ |
| 167 | + \hline |
| 168 | + \textbf{stl} & std:thread \\ |
| 169 | + \hline |
| 170 | + \textbf{tbb} & Threading Building Blocks \\ |
| 171 | + \hline |
| 172 | + \end{tabular} |
| 173 | + } |
| 174 | + \caption{Tasks directories} |
| 175 | + \end{table} |
| 176 | + |
| 177 | +\end{frame} |
| 178 | + |
| 179 | +\begin{frame}[fragile]{Directories} |
| 180 | + \begin{tikzpicture} |
| 181 | + [scale=.8,auto=left,every node/.style={circle,fill=blue!20}] |
| 182 | + \node (n1) at (1,10) {PPC}; |
| 183 | + \node (n2) at (3,8) {tasks}; |
| 184 | + \node (n3) at (5,6) {mpi}; |
| 185 | + \node (n4) at (9,11) {src}; |
| 186 | + \node (n5) at (9,9.5) {include}; |
| 187 | + \node (n6) at (9,7) {func\_tests}; |
| 188 | + \node (n7) at (9,4) {perf\_tests}; |
| 189 | + |
| 190 | + \foreach \from/\to in {n1/n2,n2/n3,n3/n4,n3/n5,n3/n6,n3/n7} |
| 191 | + \draw (\from) -- (\to); |
| 192 | + |
| 193 | +\end{tikzpicture} |
| 194 | +\end{frame} |
| 195 | + |
| 196 | +\section{API of the course's repository} |
| 197 | + |
| 198 | +\begin{frame}[fragile]{Task's prototype} |
| 199 | + \lstset{style=CStyle, caption=include/ops\_seq.hpp} |
| 200 | + \begin{lstlisting} |
| 201 | + class TestTaskSequential : public ppc::core::Task { |
| 202 | + public: |
| 203 | + explicit TestTaskSequential(std::shared_ptr<ppc::core::TaskData> taskData_) : Task(std::move(taskData_)) {} |
| 204 | + bool pre_processing() override; |
| 205 | + bool validation() override; |
| 206 | + bool run() override; |
| 207 | + bool post_processing() override; |
| 208 | + |
| 209 | + private: |
| 210 | + int input_{}, res{}; |
| 211 | + }; |
| 212 | + \end{lstlisting} |
| 213 | +\end{frame} |
| 214 | + |
| 215 | +\begin{frame}[fragile]{Task's source code} |
| 216 | + \lstset{style=CStyle, caption=src/ops\_seq.cpp | pre\_processing} |
| 217 | + \begin{lstlisting} |
| 218 | + bool nesterov_a_test_task_seq::TestTaskSequential::pre_processing() { |
| 219 | + internal_order_test(); |
| 220 | + // Init value for input and output |
| 221 | + input_ = reinterpret_cast<int*>(taskData->inputs[0])[0]; |
| 222 | + res = 0; |
| 223 | + return true; |
| 224 | + } |
| 225 | + \end{lstlisting} |
| 226 | + |
| 227 | + \lstset{style=CStyle, caption=src/ops\_seq.cpp | validation} |
| 228 | + \begin{lstlisting} |
| 229 | + bool nesterov_a_test_task_seq::TestTaskSequential::validation() { |
| 230 | + internal_order_test(); |
| 231 | + // Check count elements of output |
| 232 | + return taskData->inputs_count[0] == 1 && taskData->outputs_count[0] == 1; |
| 233 | + } |
| 234 | + \end{lstlisting} |
| 235 | +\end{frame} |
| 236 | + |
| 237 | +\begin{frame}[fragile]{Task's source code} |
| 238 | + \lstset{style=CStyle, caption=src/ops\_seq.cpp | run} |
| 239 | + \begin{lstlisting} |
| 240 | + bool nesterov_a_test_task_seq::TestTaskSequential::run() { |
| 241 | + internal_order_test(); |
| 242 | + for (int i = 0; i < input_; i++) { |
| 243 | + res++; |
| 244 | + } |
| 245 | + return true; |
| 246 | + } |
| 247 | + \end{lstlisting} |
| 248 | + |
| 249 | + \lstset{style=CStyle, caption=src/ops\_seq.cpp | post\_processing} |
| 250 | + \begin{lstlisting} |
| 251 | + bool nesterov_a_test_task_seq::TestTaskSequential::post_processing() { |
| 252 | + internal_order_test(); |
| 253 | + reinterpret_cast<int*>(taskData->outputs[0])[0] = res; |
| 254 | + return true; |
| 255 | + } |
| 256 | + \end{lstlisting} |
| 257 | +\end{frame} |
| 258 | + |
| 259 | +\begin{frame}[fragile]{Task's functional tests} |
| 260 | + \lstset{style=CStyle, caption=func\_tests/main.cpp} |
| 261 | + \begin{lstlisting} |
| 262 | + TEST(Sequential, Test_Sum_10) { |
| 263 | + const int count = 10; |
| 264 | + |
| 265 | + // Create data |
| 266 | + std::vector<int> in(1, count); |
| 267 | + std::vector<int> out(1, 0); |
| 268 | + |
| 269 | + // Create TaskData |
| 270 | + std::shared_ptr<ppc::core::TaskData> taskDataSeq = std::make_shared<ppc::core::TaskData>(); |
| 271 | + taskDataSeq->inputs.emplace_back(reinterpret_cast<uint8_t *>(in.data())); |
| 272 | + taskDataSeq->inputs_count.emplace_back(in.size()); |
| 273 | + taskDataSeq->outputs.emplace_back(reinterpret_cast<uint8_t *>(out.data())); |
| 274 | + taskDataSeq->outputs_count.emplace_back(out.size()); |
| 275 | + |
| 276 | + // Create Task |
| 277 | + nesterov_a_test_task_seq::TestTaskSequential testTaskSequential(taskDataSeq); |
| 278 | + ASSERT_EQ(testTaskSequential.validation(), true); |
| 279 | + testTaskSequential.pre_processing(); |
| 280 | + testTaskSequential.run(); |
| 281 | + testTaskSequential.post_processing(); |
| 282 | + ASSERT_EQ(count, out[0]); |
| 283 | + } |
| 284 | + \end{lstlisting} |
| 285 | +\end{frame} |
| 286 | + |
| 287 | +\begin{frame}[fragile]{TaskData structure} |
| 288 | + \lstset{style=CStyle, caption=TaskData} |
| 289 | + \begin{lstlisting} |
| 290 | + struct TaskData { |
| 291 | + std::vector<uint8_t *> inputs; |
| 292 | + std::vector<std::uint32_t> inputs_count; |
| 293 | + std::vector<uint8_t *> outputs; |
| 294 | + std::vector<std::uint32_t> outputs_count; |
| 295 | + enum StateOfTesting { FUNC, PERF } state_of_testing; |
| 296 | + }; |
| 297 | + \end{lstlisting} |
| 298 | + \lstset{style=CStyle, caption=Functions order} |
| 299 | + \begin{lstlisting} |
| 300 | + std::vector<std::string> right_functions_order = |
| 301 | + {"validation", |
| 302 | + "pre_processing", |
| 303 | + "run", |
| 304 | + "post_processing"}; |
| 305 | + \end{lstlisting} |
| 306 | +\end{frame} |
| 307 | + |
| 308 | +\begin{frame}[fragile]{Task's performance tests - part 1} |
| 309 | + \lstset{style=CStyle, caption=perf\_tests/main.cpp} |
| 310 | + \begin{lstlisting} |
| 311 | + TEST(sequential_example_perf_test, test_pipeline_run) { |
| 312 | + const int count = 100; |
| 313 | + |
| 314 | + // Create data |
| 315 | + std::vector<int> in(1, count); |
| 316 | + std::vector<int> out(1, 0); |
| 317 | + |
| 318 | + // Create TaskData |
| 319 | + std::shared_ptr<ppc::core::TaskData> taskDataSeq = std::make_shared<ppc::core::TaskData>(); |
| 320 | + taskDataSeq->inputs.emplace_back(reinterpret_cast<uint8_t *>(in.data())); |
| 321 | + taskDataSeq->inputs_count.emplace_back(in.size()); |
| 322 | + taskDataSeq->outputs.emplace_back(reinterpret_cast<uint8_t *>(out.data())); |
| 323 | + taskDataSeq->outputs_count.emplace_back(out.size()); |
| 324 | + |
| 325 | + // Create Task |
| 326 | + auto testTaskSequential = std::make_shared<nesterov_a_test_task_seq::TestTaskSequential>(taskDataSeq); |
| 327 | + \end{lstlisting} |
| 328 | +\end{frame} |
| 329 | + |
| 330 | +\begin{frame}[fragile]{Task's performance tests - part 2} |
| 331 | + \lstset{style=CStyle, caption=perf\_tests/main.cpp} |
| 332 | + \begin{lstlisting} |
| 333 | + // Create Perf attributes |
| 334 | + auto perfAttr = std::make_shared<ppc::core::PerfAttr>(); |
| 335 | + perfAttr->num_running = 10; |
| 336 | + const auto t0 = std::chrono::high_resolution_clock::now(); |
| 337 | + perfAttr->current_timer = [&] { |
| 338 | + auto current_time_point = std::chrono::high_resolution_clock::now(); |
| 339 | + auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(current_time_point - t0).count(); |
| 340 | + return static_cast<double>(duration) * 1e-9; |
| 341 | + }; |
| 342 | + |
| 343 | + // Create and init perf results |
| 344 | + auto perfResults = std::make_shared<ppc::core::PerfResults>(); |
| 345 | + |
| 346 | + // Create Perf analyzer |
| 347 | + auto perfAnalyzer = std::make_shared<ppc::core::Perf>(testTaskSequential); |
| 348 | + perfAnalyzer->pipeline_run(perfAttr, perfResults); |
| 349 | + ppc::core::Perf::print_perf_statistic(perfResults); |
| 350 | + ASSERT_EQ(count, out[0]); |
| 351 | + } |
| 352 | + \end{lstlisting} |
| 353 | +\end{frame} |
| 354 | + |
| 355 | +\begin{frame}[fragile]{Practice} |
| 356 | + Practice |
75 | 357 | \end{frame}
|
76 | 358 |
|
77 | 359 | \begin{frame}{References}
|
| 360 | + \begin{itemize} |
| 361 | + \item PPC Repository \href{https://github.com/learning-process/parallel\_programming\_course}{https://github.com/learning-process/parallel\_programming\_course} |
| 362 | + \end{itemize} |
78 | 363 | \end{frame}
|
79 | 364 |
|
80 | 365 | \end{document}
|
0 commit comments