@@ -83,289 +83,56 @@ \section{The introduction to the repository}
8383 \end {itemize }
8484\end {frame }
8585
86- \begin {frame }[fragile]{Step-by-step guide to build the project}
86+ \begin {frame }{Documentation}
87+ Follow the documentation for detailed instructions and examples:
8788 \begin {itemize }
88- \item Download all submodules
89- \item Set up your environment
90- \item Build the project with CMake
89+ \item EN: \href {https://learning-process.github.io/parallel\_programming\_course/en/}{https://learning-process.github.io/parallel\_ programming\_ course/en/}
90+ \item RU: \href {https://learning-process.github.io/parallel\_programming\_course/ru/}{https://learning-process.github.io/parallel\_ programming\_ course/ru/}
9191 \end {itemize }
9292\end {frame }
9393
94- \begin {frame }[fragile]{Download all submodules \& Set up your environment}
95-
96- \lstset {style=CStyle, caption=Git submodules}
97- \ begin{lstlisting}
98- git submodule update --init --recursive
99- \end {lstlisting }
100-
101- \lstset {style=CStyle, caption=Download MPI}
102- \ begin{lstlisting}
103- // Windows
104- msmpisdk.msi & msmpisetup.exe
105- // Linux (gcc and clang)
106- sudo apt install -y mpich openmpi-bin libopenmpi-dev
107- // MacOS (apple clang)
108- brew install open-mpi
109- \end {lstlisting }
110-
111- \end {frame }
112-
113- \begin {frame }[fragile]{Build the project with help CMake}
114-
115- \lstset {style=CStyle, caption=Configure the build}
116- \ begin{lstlisting}
117- cmake -S <source code/path to CMakeLists.txt> \
118- -B <build directory> \
119- -D USE_SEQ=ON \
120- -D USE_MPI=ON \
121- -D USE_FUNC_TESTS=ON \
122- -D USE_PERF_TESTS=ON \
123- -D CMAKE_BUILD_TYPE=Release ..
124- \end {lstlisting }
125-
126- \lstset {style=CStyle, caption=Build the project}
127- \ begin{lstlisting}
128- cmake --build <build directory> \
129- --config Release \
130- --parallel
131- \end {lstlisting }
132-
133- \end {frame }
134-
135- \section {How to submit your work }
136-
137- \begin {frame }[fragile]{Directories}
138- \begin {table }[h!]
139- \resizebox {8cm}{!} {
140- \begin {tabular }{| p{4.2 cm} | p{4.2 cm} |}
141- \hline
142- \textbf {Directory } & \textbf {What is it? } \\
143- \hline
144- \textbf {.github/workflows } & CI \\
145- \hline
146- \textbf {1stsamples } & Simple examples \\
147- \hline
148- \textbf {3rdparty } & Auxiliary libraries \\
149- \hline
150- \textbf {cmake } & CMake scripts \\
151- \hline
152- \textbf {modules } & API source code \\
153- \hline
154- \textbf {scripts } & Auxiliary scripts \\
155- \hline
156- \textbf {tasks } & Students tasks \\
157- \hline
158- \end {tabular }
159- }
160- \caption {Root directories}
161- \end {table }
162-
163- \begin {table }[h!]
164- \resizebox {8cm}{!} {
165- \begin {tabular }{| p{4.2 cm} | p{4.2 cm} |}
166- \hline
167- \textbf {Directory } & \textbf {What is it? } \\
168- \hline
169- \textbf {mpi } & MPI \\
170- \hline
171- \textbf {omp } & OpenMP \\
172- \hline
173- \textbf {seq } & Sequential \\
174- \hline
175- \textbf {stl } & std:thread \\
176- \hline
177- \textbf {tbb } & Threading Building Blocks \\
178- \hline
179- \end {tabular }
180- }
181- \caption {Tasks directories}
182- \end {table }
183-
184- \end {frame }
185-
186- \begin {frame }[fragile]{Directories}
187- \begin {tikzpicture }
188- [scale=.8,auto=left,every node/.style={circle,fill=blue!20}]
189- \node (n1) at (1,10) {PPC};
190- \node (n2) at (3,8) {tasks};
191- \node (n3) at (5,6) {mpi};
192- \node (n4) at (9,11) {src};
193- \node (n5) at (9,9.5) {include};
194- \node (n6) at (9,7) {func\_ tests};
195- \node (n7) at (9,4) {perf\_ tests};
196-
197- \foreach \from /\to in {n1/n2,n2/n3,n3/n4,n3/n5,n3/n6,n3/n7}
198- \draw (\from ) -- (\to );
199-
200- \end {tikzpicture }
201- \end {frame }
202-
203- \section {API of the course's repository }
204-
205- \begin {frame }[fragile]{Task's prototype}
206- \lstset {style=CStyle, caption=include/ops\_ seq.hpp}
207- \ begin{lstlisting}
208- class TestTaskSequential : public ppc::core::Task {
209- public:
210- explicit TestTaskSequential(std::shared_ptr<ppc::core::TaskData> taskData_) : Task(std::move(taskData_)) {}
211- bool pre_processing() override;
212- bool validation() override;
213- bool run() override;
214- bool post_processing() override;
215-
216- private:
217- int input_{}, res{};
218- };
219- \end {lstlisting }
220- \end {frame }
221-
222- \begin {frame }[fragile]{Task's source code}
223- \lstset {style=CStyle, caption=src/ops\_ seq.cpp | pre\_ processing}
224- \ begin{lstlisting}
225- bool nesterov_a_test_task_seq::TestTaskSequential::pre_processing() {
226- internal_order_test();
227- // Init value for input and output
228- input_ = reinterpret_cast<int*>(taskData->inputs[0])[0];
229- res = 0;
230- return true;
231- }
232- \end {lstlisting }
233-
234- \lstset {style=CStyle, caption=src/ops\_ seq.cpp | validation}
235- \ begin{lstlisting}
236- bool nesterov_a_test_task_seq::TestTaskSequential::validation() {
237- internal_order_test();
238- // Check count elements of output
239- return taskData->inputs_count[0] == 1 && taskData->outputs_count[0] == 1;
240- }
241- \end {lstlisting }
242- \end {frame }
243-
244- \begin {frame }[fragile]{Task's source code}
245- \lstset {style=CStyle, caption=src/ops\_ seq.cpp | run}
246- \ begin{lstlisting}
247- bool nesterov_a_test_task_seq::TestTaskSequential::run() {
248- internal_order_test();
249- for (int i = 0; i < input_; i++) {
250- res++;
251- }
252- return true;
253- }
254- \end {lstlisting }
255-
256- \lstset {style=CStyle, caption=src/ops\_ seq.cpp | post\_ processing}
257- \ begin{lstlisting}
258- bool nesterov_a_test_task_seq::TestTaskSequential::post_processing() {
259- internal_order_test();
260- reinterpret_cast<int*>(taskData->outputs[0])[0] = res;
261- return true;
262- }
263- \end {lstlisting }
264- \end {frame }
265-
266- \begin {frame }[fragile]{Task's functional tests}
267- \lstset {style=CStyle, caption=func\_ tests/main.cpp}
268- \ begin{lstlisting}
269- TEST(Sequential, Test_Sum_10) {
270- const int count = 10;
271-
272- // Create data
273- std::vector<int> in(1, count);
274- std::vector<int> out(1, 0);
275-
276- // Create TaskData
277- std::shared_ptr<ppc::core::TaskData> taskDataSeq = std::make_shared<ppc::core::TaskData>();
278- taskDataSeq->inputs.emplace_back(reinterpret_cast<uint8_t *>(in.data()));
279- taskDataSeq->inputs_count.emplace_back(in.size());
280- taskDataSeq->outputs.emplace_back(reinterpret_cast<uint8_t *>(out.data()));
281- taskDataSeq->outputs_count.emplace_back(out.size());
282-
283- // Create Task
284- nesterov_a_test_task_seq::TestTaskSequential testTaskSequential(taskDataSeq);
285- ASSERT_EQ(testTaskSequential.validation(), true);
286- testTaskSequential.pre_processing();
287- testTaskSequential.run();
288- testTaskSequential.post_processing();
289- ASSERT_EQ(count, out[0]);
290- }
291- \end {lstlisting }
292- \end {frame }
293-
294- \begin {frame }[fragile]{TaskData structure}
295- \lstset {style=CStyle, caption=TaskData}
296- \ begin{lstlisting}
297- struct TaskData {
298- std::vector<uint8_t *> inputs;
299- std::vector<std::uint32_t> inputs_count;
300- std::vector<uint8_t *> outputs;
301- std::vector<std::uint32_t> outputs_count;
302- enum StateOfTesting { FUNC, PERF } state_of_testing;
303- };
304- \end {lstlisting }
305- \lstset {style=CStyle, caption=Functions order}
306- \ begin{lstlisting}
307- std::vector<std::string> right_functions_order =
308- {"validation",
309- "pre_processing",
310- "run",
311- "post_processing"};
312- \end {lstlisting }
313- \end {frame }
314-
315- \begin {frame }[fragile]{Task's performance tests - part 1}
316- \lstset {style=CStyle, caption=perf\_ tests/main.cpp}
317- \ begin{lstlisting}
318- TEST(sequential_example_perf_test, test_pipeline_run) {
319- const int count = 100;
320-
321- // Create data
322- std::vector<int> in(1, count);
323- std::vector<int> out(1, 0);
324-
325- // Create TaskData
326- std::shared_ptr<ppc::core::TaskData> taskDataSeq = std::make_shared<ppc::core::TaskData>();
327- taskDataSeq->inputs.emplace_back(reinterpret_cast<uint8_t *>(in.data()));
328- taskDataSeq->inputs_count.emplace_back(in.size());
329- taskDataSeq->outputs.emplace_back(reinterpret_cast<uint8_t *>(out.data()));
330- taskDataSeq->outputs_count.emplace_back(out.size());
331-
332- // Create Task
333- auto testTaskSequential = std::make_shared<nesterov_a_test_task_seq::TestTaskSequential>(taskDataSeq);
334- \end {lstlisting }
335- \end {frame }
336-
337- \begin {frame }[fragile]{Task's performance tests - part 2}
338- \lstset {style=CStyle, caption=perf\_ tests/main.cpp}
339- \ begin{lstlisting}
340- // Create Perf attributes
341- auto perfAttr = std::make_shared<ppc::core::PerfAttr>();
342- perfAttr->num_running = 10;
343- const auto t0 = std::chrono::high_resolution_clock::now();
344- perfAttr->current_timer = [&] {
345- auto current_time_point = std::chrono::high_resolution_clock::now();
346- auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(current_time_point - t0).count();
347- return static_cast<double>(duration) * 1e-9;
348- };
349-
350- // Create and init perf results
351- auto perfResults = std::make_shared<ppc::core::PerfResults>();
352-
353- // Create Perf analyzer
354- auto perfAnalyzer = std::make_shared<ppc::core::Perf>(testTaskSequential);
355- perfAnalyzer->pipeline_run(perfAttr, perfResults);
356- ppc::core::Perf::print_perf_statistic(perfResults);
357- ASSERT_EQ(count, out[0]);
358- }
359- \end {lstlisting }
94+ \begin {frame }[fragile]{Local Setup and Build}
95+ \begin {itemize }
96+ \item Dev Container (recommended): VS Code + Docker + Dev Containers extension
97+ \item Manual prerequisites: Install CMake; install MPI/OpenMP per OS (see docs)
98+ \item Download submodules: \\
99+ \verb |git submodule update --init --recursive --depth=1 |
100+ \item Configure build: \\
101+ \verb |mkdir build && cd build | \\ [-2pt]
102+ \verb |cmake -D USE_FUNC_TESTS=ON -D USE_PERF_TESTS=ON -D CMAKE_BUILD_TYPE=Release .. |
103+ \item Build: \\
104+ \verb |cmake --build . --config Release --parallel |
105+ \end {itemize }
360106\end {frame }
361107
362- \begin {frame }[fragile]{Practice}
363- Practice
108+ \begin {frame }[fragile]{Docker and Dev Container}
109+ You may use Docker container for the convenience of development.
110+ \begin {itemize }
111+ \item VS Code flow (recommended):
112+ \begin {itemize }
113+ \item Open the repo in VS Code, install Dev Containers extension
114+ \item Use: \verb |Dev Containers: Reopen in Container |
115+ \item VS Code builds a container with GCC, CMake, MPI, OpenMP, tools
116+ \end {itemize }
117+ \item Prebuilt image (in case you do not use dev container or VS Code):
118+ \begin {itemize }
119+ \item Pull: \verb |docker pull ghcr.io/learning-process/ppc-ubuntu:1.1 |
120+ \item Run: \verb |docker run -it ghcr.io/learning-process/ppc-ubuntu:1.1 |
121+ \end {itemize }
122+ \item Build locally (Dockerfile: \texttt {docker/ubuntu.Dockerfile }):
123+ \begin {itemize }
124+ \item Build: \verb |docker build -f docker/ubuntu.Dockerfile -t ppc-dev . |
125+ \item Run: \verb |docker run -it ppc-dev |
126+ \item Mount repo (optional): \verb |-v "$(pwd)":/work -w /work |
127+ \end {itemize }
128+ \end {itemize }
364129\end {frame }
365130
366131\begin {frame }{References}
367132 \begin {itemize }
368133 \item PPC Repository \href {https://github.com/learning-process/parallel\_programming\_course}{https://github.com/learning-process/parallel\_ programming\_ course}
134+ \item PPC Docker image \href {https://github.com/orgs/learning-process/packages/container/package/ppc-ubuntu}{https://github.com/orgs/learning-process/packages/container/package/ppc-ubuntu}
135+ \item VS Code Dev Containers Extension \href {https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers}{https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers}
369136 \end {itemize }
370137\end {frame }
371138
0 commit comments