Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial content to the Sphinx Doc #59

Merged
merged 16 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
2 changes: 2 additions & 0 deletions docs/source/advanced/cmake.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CMake Arguments
SimeonEhrig marked this conversation as resolved.
Show resolved Hide resolved
===============
2 changes: 2 additions & 0 deletions docs/source/basic/algorithm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Algorithm
SimeonEhrig marked this conversation as resolved.
Show resolved Hide resolved
=========
91 changes: 91 additions & 0 deletions docs/source/basic/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
Installation
============

Vikunja builds and installs itself using `CMake <https://cmake.org/>`_. Before you can install and use vikunja, you have to install the only dependency `alpaka <https://github.com/alpaka-group/alpaka>`_. Vikunja supports alpaka from version 0.6 until 0.8. It is recommend to use the latest alpaka version. Alpaka itself has also a single dependency, boost. Read the `alpaka documentation <https://github.com/alpaka-group/alpaka#dependencies>`_ to determine the supported boost version.
SimeonEhrig marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: bash

# assumed alpaka is installed via `cmake --install .` on a location, where cmake can find it
# git clone https://github.com/alpaka-group/vikunja.git
cd vikunja
mkdir build && cd build
cmake ..
cmake --build .
cmake --install .

Build Tests and Examples
------------------------

Enable and run the tests:

.. code-block:: bash

# start in the vikunja project folder
mkdir build && cd build
cmake .. -DBUILD_TESTING=ON
cmake --build .
ctest

Enable and run an example:

.. code-block:: bash

# start in the vikunja project folder
mkdir build && cd build
cmake .. -DVIKUNJA_BUILD_EXAMPLES=ON
cmake --build .
./example/transform/example_transform


Use vikunja in a CMake project via ``find_package``
---------------------------------------------------

Once vikunja and alpaka are successfully installed, you can use them in your project via the cmake function ``find_packge``.
SimeonEhrig marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: cmake

cmake_minimum_required(VERSION 3.18)
project(vikunjaProject)

find_package(vikunja REQUIRED)

alpaka_add_executable(${CMAKE_PROJECT_NAME} main.cpp)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE vikunja::vikunja)

At the cmake configuration time of your project, you need to enable at least on alpaka accelerator to execute a vikunja function on a processor. The accelerators are enabled via the cmake argument``-DALPAKA_ACC_<...>_ENABLE=ON``. All existing accelerators can be found `here <https://alpaka.readthedocs.io/en/latest/advanced/cmake.html>`_.

.. code-block:: bash

# start in the folder of the root CMakeLists.txt
mkdir build && cd build
# enable serial CPU and CUDA GPU accelerator
cmake .. -DALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLE=ON -DALPAKA_ACC_GPU_CUDA_ENABLE=ON
cmake --build .

By default ``find_package(vikunja)`` runs ``find_package(alpaka)``, if the ``alpaka::alpaka`` target is not already defined.
SimeonEhrig marked this conversation as resolved.
Show resolved Hide resolved

Use vikunja in a CMake project via ``add_subdirectory``
-------------------------------------------------------

Vikunja also provides cmake integration via ``add_subdirectory``. The `add_subdirectory <https://cmake.org/cmake/help/latest/command/add_subdirectory.html>`_ approach does not require vikunja or alpaka to be installed and allows for easy deployment of a custom vikunja version together with your project.
SimeonEhrig marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: cmake

cmake_minimum_required(VERSION 3.18)
project(vikunjaProject)

add_subdirectory(alpaka REQUIRED)
add_subdirectory(vikunja REQUIRED)

alpaka_add_executable(${CMAKE_PROJECT_NAME} main.cpp)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE vikunja::vikunja)

.. code-block:: bash

# start in the folder of the root CMakeLists.txt
mkdir build && cd build
# enable OpenMP CPU backend
cmake .. -DALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE=ON
cmake --build .

It is also supported to mix the ``find_package`` and ``add_subdirectory`` approaches for vikunja and alpaka.
18 changes: 18 additions & 0 deletions docs/source/basic/introduction.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Introduction
============

The basic concept of vikunja is to run an ``algorithm`` with an ``operator`` over a range of elements.

* The ``algorithm`` specifies how the elements of one ore more input ranges are accessed and what kind of operator is applied on it. The algorithm also determines the shape of the result. Examples are:

* **Tranform**: Takes a range of elements as input and returns a range of the same size. **Transform** applies an operator on each element of the input range.
SimeonEhrig marked this conversation as resolved.
Show resolved Hide resolved
* **Reduce**: Takes a range of elements as input and returns a single element. The reduce operator takes two elements of the input range, applies an operation to them, and returns a single element. The operator is applied up to the point where only one element remains.
SimeonEhrig marked this conversation as resolved.
Show resolved Hide resolved
* For more examples see: :ref:`Algorithm <Algorithm>`
* An ``operator`` describes an algorithm which is applied to one (unary operator) or two (binary operator) elements and returns a result. The following examples assume that **i** is the first and **j** the second input element:

* **sum**: `return i+j;`
* **double of an element**: `return 2*i;`

.. literalinclude:: ../../../example/transform/src/transform-main.cpp
:language: C++
:caption: transform-main.cpp
8 changes: 7 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autosectionlabel'
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -49,7 +50,12 @@
#
html_theme = 'sphinx_rtd_theme'

html_logo = "logo/vikunja_logo.svg"
html_theme_options = {
"logo_only" : True
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
#html_static_path = ['_static']
2 changes: 2 additions & 0 deletions docs/source/development/sphinx.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sphinx Doc
==========
35 changes: 28 additions & 7 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,40 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to vikunja's documentation!
.. only:: html

.. image:: logo/vikunja_logo.svg
:width: 400

.. only:: latex

.. image:: logo/vikunja_logo.pdf


Vikunja is a performance portable algorithms library defines functions for a variety of purposes that operate on ranges of elements. It supports the execution on multi core CPUs and various GPUs.


vikunja - How to Read This Document
===================================

The documentation will follow. At the moment this empty shinxdoc exists to set up an automatic deployment on readthedocs.
Generally, **follow the manual pages in-order** to get started. Individual chapters are based on the information of the chapters before. The documentation is separated in three sections. The ``basic`` section explains all concepts of vikunja. In the ``advanced`` you will get more details of certain functionalities. If you want to provide to the project, you should have a look in the ``development`` section.
SimeonEhrig marked this conversation as resolved.
Show resolved Hide resolved

.. toctree::
:maxdepth: 2
:caption: Contents:
:caption: Basic

basic/introduction.rst
basic/installation.rst
basic/algorithm.rst

.. toctree::
:maxdepth: 2
:caption: Advanced

advanced/cmake.rst

Indices and tables
==================
.. toctree::
:maxdepth: 2
:caption: Development

* :ref:`genindex`
* :ref:`search`
development/sphinx.rst
1 change: 1 addition & 0 deletions docs/source/logo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Logo was created with Inkscape. The text uses the font `Latin Modern Sans Quotation` and the colors `005aa0ff` (blue - RGBA) and `f0781eff` (orange).
Binary file added docs/source/logo/vikunja_logo.pdf
Binary file not shown.
99 changes: 99 additions & 0 deletions docs/source/logo/vikunja_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading