From 58e328a7da4068588dba7960cf973cb170b4a5d3 Mon Sep 17 00:00:00 2001 From: Nesterov Alexander Date: Thu, 30 May 2024 19:45:06 +0200 Subject: [PATCH] Initial commit --- .github/workflows/main.yml | 69 +++++++++++++++++++ .gitignore | 10 +++ CMakeLists.txt | 17 +++++ LICENSE | 29 ++++++++ README.md | 99 ++++++++++++++++++++++++++++ cmake/configure.cmake | 10 +++ modules/CMakeLists.txt | 5 ++ modules/example/CMakeLists.txt | 7 ++ modules/example/latex/CMakeLists.txt | 41 ++++++++++++ modules/example/latex/test_latex.tex | 46 +++++++++++++ modules/mpi/CMakeLists.txt | 7 ++ modules/omp/CMakeLists.txt | 7 ++ modules/seq/CMakeLists.txt | 7 ++ modules/stl/CMakeLists.txt | 7 ++ modules/tbb/CMakeLists.txt | 7 ++ 15 files changed, 368 insertions(+) create mode 100644 .github/workflows/main.yml create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 LICENSE create mode 100644 README.md create mode 100644 cmake/configure.cmake create mode 100644 modules/CMakeLists.txt create mode 100644 modules/example/CMakeLists.txt create mode 100644 modules/example/latex/CMakeLists.txt create mode 100644 modules/example/latex/test_latex.tex create mode 100644 modules/mpi/CMakeLists.txt create mode 100644 modules/omp/CMakeLists.txt create mode 100644 modules/seq/CMakeLists.txt create mode 100644 modules/stl/CMakeLists.txt create mode 100644 modules/tbb/CMakeLists.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..eede72e --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,69 @@ +name: Build application + +on: [push, pull_request] + +jobs: + ubuntu-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Setup environment + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install ninja-build + sudo apt-get install texlive* + - name: Build + run: | + mkdir build + cmake -G Ninja -S . -B build -D USE_LATEX=ON + cmake --build build + shell: bash + - uses: actions/upload-artifact@v4 + with: + name: ubuntu-artifacts + path: build/bin/ + windows-build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Setup environment + run: | + choco install miktex.install + shell: pwsh + - name: Build + run: | + Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" + refreshenv + mkdir build + cmake -S . -B build -D USE_LATEX=ON + cmake --build build + shell: pwsh + - uses: actions/upload-artifact@v4 + with: + name: windows-artifacts + path: build/bin/ + macos-build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Setup environment + run: | + brew install --cask mactex + brew install ninja + - name: Build + run: | + eval "$(/usr/libexec/path_helper)" + mkdir build + cmake -G Ninja -S . -B build -D USE_LATEX=ON + cmake --build build + - uses: actions/upload-artifact@v4 + with: + name: macos-artifacts + path: build/bin/ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ad05d70 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +build +mpich +cmake-build-release +cmake-build-debug +.idea/ +.vscode/ +scripts/variants.csv +scripts/variants.xlsx +venv* +sln/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d540c26 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required( VERSION 3.27 ) + +message( STATUS "Programming Course Reports" ) +project(programming_course_reports) + +include(${CMAKE_SOURCE_DIR}/cmake/configure.cmake) + +############################### LATEX ############################### +option(USE_LATEX OFF) +if( USE_LATEX ) + find_package(LATEX REQUIRED) + if(NOT (LATEX_FOUND AND LATEX_PDFLATEX_FOUND)) + set(USE_LATEX OFF) + endif() +endif( USE_LATEX ) + +add_subdirectory(modules) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..980dc46 --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2020, Nesterov Alexander +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..56d0fef --- /dev/null +++ b/README.md @@ -0,0 +1,99 @@ +[![Build application](https://github.com/learning-process/programming_course_reports/actions/workflows/main.yml/badge.svg)](https://github.com/learning-process/programming_course_reports/actions/workflows/main.yml) + +# Programming Course Reports + +The following reporting technologies are considered in practice: + * `LaTeX` + +## Rules for submissions +1. You are not supposed to trigger CI jobs by frequent updates of your pull request. First you should test you work locally with all the scripts (code style) + * Respect others time and don't slow down the job queue +2. Carefully check if the program can hang + +## 1. Set up your environment +### Fetch submodules before building the project +``` +git submodule update --init --recursive +``` + +### Reporting technologies +### `LaTeX` + * **Windows**: + + 1. Install [Chocolatey](https://chocolatey.org/install) + 2. Install TeX distribution: + + Choose one of two (any) TeX distribution to install + + - miktex + ```bash + choco install miktex + ``` + Add miktex installation path to your system PATH environment variable. Default installation location: "C:\Program Files\MiKTeX\miktex\bin\x64" + - texlive (takes more disk space and time to setup) + ```bash + choco install texive --params="'/scheme:full'" --execution-timeout=10000 + ``` + 3. Refresh your environment (reopen the console or type `refreshenv`) and check if TeX distribution is set up. E.g. use this command (it should be available and display the current version of pdflatex tool): + ```bash + pdflatex --version + ``` + + * **Linux**: + ``` + sudo apt install texlive* + ``` + * **MacOS (apple clang)**: + + Unsupported operating system! + +## 2. Build the project with `CMake` +Navigate to a source code folder. + +1) Configure the build: + + ``` + mkdir build && cd build + cmake -D USE_LATEX=ON .. + ``` +*Help on CMake keys:* +- `-D USE_LATEX=ON` enable `LaTeX` reports. + +*A corresponding flag can be omitted if it's not needed.* + +2) Build the project: + ``` + cmake --build . + ``` +3) Check the task + * View report `/build/bin` + +## 3. How to submit you work +* There are `task_1`, `task_2`, `task_3`, `task_4` folders in `modules` directory. There are 4 task's reports for the semester. Move to a folder of your task. Make a directory named `__`. Example: `task1/nesterov_a_vector_sum`. +* Go into the newly created folder and begin you work on the report. There must be only 2 files and 1 of them must be written by you: + - `nesterov_a_vector_sum.tex` - a LaTeX report file which consider information about your program, name it in the same way as `__` same as directory. + - `CMakeLists.txt` - a file to configure your project. Examples for each configuration can be found in `test_tasks/test_latex`. +* The number of directories will increase with time. To build only your project, you need to do the following: + ``` + cmake --build . --target + ``` + Example: + ``` + cmake --build . --target nesterov_a_vector_sum + ``` +* Name your pull request in the following way: + * for report: + ``` + <Фамилия Имя>. Отчет. <Полное название задачи>. + Нестеров Александр. Отчет. Сумма элементов вектора. + ``` +* Provide the full task definition in pull request's description. + + Example pull request is located in repo's pull requests. + +* Work on your fork-repository. Keep your work on a separate branch and **NOT on `master`!!!**. Name you branch in the same way as your task's folder. To create a branch run: + ``` + git checkout -b nesterov_a_vector_sum + ``` + +*Failing to follow the rules makes the project build red.* diff --git a/cmake/configure.cmake b/cmake/configure.cmake new file mode 100644 index 0000000..9efd5e0 --- /dev/null +++ b/cmake/configure.cmake @@ -0,0 +1,10 @@ +MACRO(SUBDIRLIST result curdir) + FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) + SET(dirlist "") + FOREACH(child ${children}) + IF(IS_DIRECTORY ${curdir}/${child}) + LIST(APPEND dirlist ${child}) + ENDIF() + ENDFOREACH() + SET(${result} ${dirlist}) +ENDMACRO() diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt new file mode 100644 index 0000000..4879420 --- /dev/null +++ b/modules/CMakeLists.txt @@ -0,0 +1,5 @@ +SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR}) + +foreach(subd ${subdirs}) + add_subdirectory(${subd}) +endforeach() diff --git a/modules/example/CMakeLists.txt b/modules/example/CMakeLists.txt new file mode 100644 index 0000000..0e692b1 --- /dev/null +++ b/modules/example/CMakeLists.txt @@ -0,0 +1,7 @@ +message(STATUS "Example tasks") + +SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR}) + +foreach(subd ${subdirs}) + add_subdirectory(${subd}) +endforeach() diff --git a/modules/example/latex/CMakeLists.txt b/modules/example/latex/CMakeLists.txt new file mode 100644 index 0000000..a96070f --- /dev/null +++ b/modules/example/latex/CMakeLists.txt @@ -0,0 +1,41 @@ +get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME) + +set(LATEX_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") +if (NOT EXISTS ${LATEX_OUTPUT_PATH}) + file(MAKE_DIRECTORY ${LATEX_OUTPUT_PATH}) +endif () + +if (USE_LATEX) + message( STATUS "-- " ${ProjectId} ) + file(GLOB_RECURSE report_files "*.tex") + + foreach (report ${report_files}) + get_filename_component(report_name ${report} NAME_WE) + list(APPEND list_report_names ${report_name}) + endforeach () + + add_custom_target( ${ProjectId}_prebuild + COMMAND ${PDFLATEX_COMPILER} -draftmode -interaction=nonstopmode ${report_files} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${report_files}) + + add_custom_target( ${ProjectId}_pdf + COMMAND ${PDFLATEX_COMPILER} ${report_files} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${report_files}) + + add_custom_target(${ProjectId}_all_formats ALL) + add_dependencies(${ProjectId}_all_formats ${ProjectId}_pdf) + + foreach (report_name ${list_report_names}) + add_custom_command( + TARGET ${ProjectId}_all_formats + POST_BUILD + COMMAND mv "${CMAKE_CURRENT_SOURCE_DIR}/${report_name}.aux" "${LATEX_OUTPUT_PATH}/${report_name}.aux" + COMMAND mv "${CMAKE_CURRENT_SOURCE_DIR}/${report_name}.log" "${LATEX_OUTPUT_PATH}/${report_name}.log" + COMMAND mv "${CMAKE_CURRENT_SOURCE_DIR}/${report_name}.pdf" "${LATEX_OUTPUT_PATH}/${report_name}.pdf" + ) + endforeach () +else() + message( STATUS "-- ${ProjectId} - NOT BUILD!" ) +endif() diff --git a/modules/example/latex/test_latex.tex b/modules/example/latex/test_latex.tex new file mode 100644 index 0000000..07271fc --- /dev/null +++ b/modules/example/latex/test_latex.tex @@ -0,0 +1,46 @@ +\documentclass[12pt]{article} +\usepackage{lingmacros} +\usepackage{tree-dvips} +\begin{document} + +\section*{Notes for My Paper} + +Don't forget to include examples of topicalization. +They look like this: + +{\small +\enumsentence{Topicalization from sentential subject:\\ +\shortex{7}{a John$_i$ [a & kltukl & [el & + {\bf l-}oltoir & er & ngii$_i$ & a Mary]]} +{ & {\bf R-}clear & {\sc comp} & + {\bf IR}.{\sc 3s}-love & P & him & } +{John, (it's) clear that Mary loves (him).}} +} + +\subsection*{How to handle topicalization} + +I'll just assume a tree structure like (\ex{1}). + +{\small +\enumsentence{Structure of A$'$ Projections:\\ [2ex] +\begin{tabular}[t]{cccc} + & \node{i}{CP}\\ [2ex] + \node{ii}{Spec} & &\node{iii}{C$'$}\\ [2ex] + &\node{iv}{C} & & \node{v}{SAgrP} +\end{tabular} +\nodeconnect{i}{ii} +\nodeconnect{i}{iii} +\nodeconnect{iii}{iv} +\nodeconnect{iii}{v} +} +} + +\subsection*{Mood} + +Mood changes when there is a topic, as well as when +there is WH-movement. \emph{Irrealis} is the mood when +there is a non-subject topic or WH-phrase in Comp. +\emph{Realis} is the mood when there is a subject topic +or WH-phrase. + +\end{document} diff --git a/modules/mpi/CMakeLists.txt b/modules/mpi/CMakeLists.txt new file mode 100644 index 0000000..208b329 --- /dev/null +++ b/modules/mpi/CMakeLists.txt @@ -0,0 +1,7 @@ +message(STATUS "MPI tasks") + +SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR}) + +foreach(subd ${subdirs}) + add_subdirectory(${subd}) +endforeach() diff --git a/modules/omp/CMakeLists.txt b/modules/omp/CMakeLists.txt new file mode 100644 index 0000000..917b358 --- /dev/null +++ b/modules/omp/CMakeLists.txt @@ -0,0 +1,7 @@ +message(STATUS "OpenMP tasks") + +SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR}) + +foreach(subd ${subdirs}) + add_subdirectory(${subd}) +endforeach() diff --git a/modules/seq/CMakeLists.txt b/modules/seq/CMakeLists.txt new file mode 100644 index 0000000..9882eca --- /dev/null +++ b/modules/seq/CMakeLists.txt @@ -0,0 +1,7 @@ +message(STATUS "Sequential tasks") + +SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR}) + +foreach(subd ${subdirs}) + add_subdirectory(${subd}) +endforeach() diff --git a/modules/stl/CMakeLists.txt b/modules/stl/CMakeLists.txt new file mode 100644 index 0000000..1e358d3 --- /dev/null +++ b/modules/stl/CMakeLists.txt @@ -0,0 +1,7 @@ +message(STATUS "STL tasks") + +SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR}) + +foreach(subd ${subdirs}) + add_subdirectory(${subd}) +endforeach() diff --git a/modules/tbb/CMakeLists.txt b/modules/tbb/CMakeLists.txt new file mode 100644 index 0000000..cafda4a --- /dev/null +++ b/modules/tbb/CMakeLists.txt @@ -0,0 +1,7 @@ +message(STATUS "TBB tasks") + +SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR}) + +foreach(subd ${subdirs}) + add_subdirectory(${subd}) +endforeach()