Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
allnes authored May 30, 2024
0 parents commit 58e328a
Show file tree
Hide file tree
Showing 15 changed files with 368 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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/
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
build
mpich
cmake-build-release
cmake-build-debug
.idea/
.vscode/
scripts/variants.csv
scripts/variants.xlsx
venv*
sln/
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
99 changes: 99 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 `<project's folder>/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 `<last name>_<first letter of name>_<short task name>`. 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 `<last name>_<first letter of name>_<short task name>` 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 <name task's directory>
```
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.*
10 changes: 10 additions & 0 deletions cmake/configure.cmake
Original file line number Diff line number Diff line change
@@ -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()
5 changes: 5 additions & 0 deletions modules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR})

foreach(subd ${subdirs})
add_subdirectory(${subd})
endforeach()
7 changes: 7 additions & 0 deletions modules/example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
message(STATUS "Example tasks")

SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR})

foreach(subd ${subdirs})
add_subdirectory(${subd})
endforeach()
41 changes: 41 additions & 0 deletions modules/example/latex/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
46 changes: 46 additions & 0 deletions modules/example/latex/test_latex.tex
Original file line number Diff line number Diff line change
@@ -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}
7 changes: 7 additions & 0 deletions modules/mpi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
message(STATUS "MPI tasks")

SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR})

foreach(subd ${subdirs})
add_subdirectory(${subd})
endforeach()
7 changes: 7 additions & 0 deletions modules/omp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
message(STATUS "OpenMP tasks")

SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR})

foreach(subd ${subdirs})
add_subdirectory(${subd})
endforeach()
7 changes: 7 additions & 0 deletions modules/seq/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
message(STATUS "Sequential tasks")

SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR})

foreach(subd ${subdirs})
add_subdirectory(${subd})
endforeach()
7 changes: 7 additions & 0 deletions modules/stl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
message(STATUS "STL tasks")

SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR})

foreach(subd ${subdirs})
add_subdirectory(${subd})
endforeach()
7 changes: 7 additions & 0 deletions modules/tbb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
message(STATUS "TBB tasks")

SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR})

foreach(subd ${subdirs})
add_subdirectory(${subd})
endforeach()

0 comments on commit 58e328a

Please sign in to comment.