diff --git a/.gitignore b/.gitignore index fa84d68..a3f2e32 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ build* # Latex output files *.aux +*.bbl +*.blg *.log *.out *.pdf diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..055ea59 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +# Copyright (c) 2014, Siemens AG. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause + +language: cpp +compiler: + - gcc + - clang +install: + - sudo apt-get install -qq cppcheck + - sudo add-apt-repository --yes ppa:kalakris/cmake + - sudo apt-get update -qq + - sudo apt-get install cmake +script: + - cppcheck -q --enable=all *_c* + - mkdir build && cd build + - cmake .. + - make + - chmod a+x binaries/run_tests.sh + - ./binaries/run_tests.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 73c7784..8c1c673 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,38 @@ -Embedded Multicore Building Blocks (EMBB) +Embedded Multicore Building Blocks (EMB²) ========================================= +Version 0.2.1 +------------- + +### Bug fixes: +- Fixed implementation of atomic operations on ARM. +- Fixed bug in HelpScan routine of hazard pointer implementation. +- Replaced inclusion of non-standard header malloc.h with stdlib.h. + +### Features: +- Added embb_core_count_available() implementation for FreeBSD. + +### Build system: +- Added initial support for Clang. +- Added initial support for Travis. +- Fixed "Policy CMP0026 is not set" warning of CMake >= 3.0.2. +- Made build independent of build-dir / source-dir location. +- Fixed remaining GCC, Clang, MSVC, and cpplint warnings. +- Replaced /bin/bash with /usr/bin/env bash in scripts. +- Added executable flag to shell scripts. +- Omitted Doxygen "Makefiles" from tarball. +- Included patchlevel in name of installation directory on Linux. +- Added LaTeX .bbl and .blg files to ignore list. + +### Documentation: +- Updated README file, created CHANGELOG file, and added markdown support. +- Corrected license in COPYING.md (BSD 2-clause). +- Changed default Doxygen level for API to two. +- Added check for Doxyfile.in (if not present, do not add Doxygen target). +- Added PDF image of building blocks and updated tutorial.tex. +- Fixed typos and wording. + + Version 0.2.0 ------------- diff --git a/COPYING.md b/COPYING.md index d6fc20b..ad0a9ac 100644 --- a/COPYING.md +++ b/COPYING.md @@ -1,4 +1,4 @@ -Embedded Multicore Building Blocks (EMBB) +Embedded Multicore Building Blocks (EMB²) ========================================= Overview diff --git a/README.md b/README.md index 2e91840..c242519 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -Embedded Multicore Building Blocks (EMBB) +Embedded Multicore Building Blocks (EMB²) ========================================= Overview -======== +-------- -The Embedded Multicore Building Blocks (EMBB) are an easy to use yet powerful -and efficient C/C++ library for the development of parallel applications. EMBB +The Embedded Multicore Building Blocks (EMB²) are an easy to use yet powerful +and efficient C/C++ library for the development of parallel applications. EMB² has been specifically designed for embedded systems and the typical requirements that accompany them, such as real-time capability and constraints on memory consumption. As a major advantage, low-level operations are hidden @@ -15,18 +15,18 @@ management and synchronization. This not only improves productivity of parallel software development, but also results in increased reliability and performance of the applications. -EMBB is independent of the hardware architecture (x86, ARM, ...) and runs on +EMB² is independent of the hardware architecture (x86, ARM, ...) and runs on various platforms, from small devices to large systems containing numerous processor cores. It builds on MTAPI, a standardized programming interface for leveraging task parallelism in embedded systems containing symmetric or asymmetric multicore processors. A core feature of MTAPI is low-overhead scheduling of fine-grained tasks among the available cores during runtime. -Unlike existing libraries, EMBB supports task priorities, which allows the +Unlike existing libraries, EMB² supports task priorities, which allows the creation of soft real-time systems. Additionally, the scheduling strategy can be optimized for non-functional requirements such as minimal latency and fairness. -Besides the task scheduler, EMBB provides basic parallel algorithms, concurrent +Besides the task scheduler, EMB² provides basic parallel algorithms, concurrent data structures, and skeletons for implementing stream processing applications. These building blocks are largely implemented in a non-blocking fashion, thus preventing frequently encountered pitfalls like lock contention, @@ -38,7 +38,7 @@ of any other concurrent operations on the same data structure. Community and Contact -===================== +--------------------- Project home: - https://github.com/siemens/embb @@ -61,13 +61,13 @@ Contact: License -======= +------- See the file "COPYING.md" in the project's root directory. Requirements -============ +------------ This project is based on the standards C99 (for C code) and C++03 (for C++ code) to be usable on a wide range of target systems. It has been tested on @@ -81,18 +81,18 @@ the following OS/compiler/architecture combinations: Other compilers and operating systems may be supported without any changes to the source code. The project includes unit tests that can be used to find out -whether a system not officially supported is suitable to run EMBB. If there is +whether a system not officially supported is suitable to run EMB². If there is a requirement to support a system on which the unit tests do not pass, please contact us: embb-dev@googlegroups.com. Directory Structure -=================== +------------------- -EMBB is a technology stack consisting of various building blocks. For some of +EMB² is a technology stack consisting of various building blocks. For some of them, there exist C and C++ versions, others are only implemented in C++. The directory names are postfixed with either "_cpp" or "_c" for the C++ and C -versions, respectively. Currently, EMBB contains the following components: +versions, respectively. Currently, EMB² contains the following components: - base: base_c, base_cpp - mtapi: mtapi_c, mtapi_cpp @@ -115,9 +115,13 @@ data structures for storing object in an organized and thread-safe way. Build and Installation -====================== +---------------------- + +Note: It is recommended to build from a packaged release file and not from a +snapshot of the repository in order to get the documentation and the examples +out-of-the box. -EMBB is built using CMake (version 2.8.9 or higher). CMake is a build file +EMB² is built using CMake (version 2.8.9 or higher). CMake is a build file generator which allows to abstract from the concrete build tools. To generate and invoke the platform-specific build files, open a shell (on Windows, use the Visual Studio developer shell to have the correct environment variables) @@ -125,8 +129,7 @@ and change to the project's root directory. Create a subdirectory, where you want to build the library, e.g., "build". Change to that subdirectory. It is assumed that the project's root directory is now the parent directory. -1. Generation of native build files ------------------------------------ +### 1. Generation of native build files Choose an appropriate build file generator for your system. @@ -147,12 +150,12 @@ option -DCMAKE_BUILD_TYPE=[Release|Debug]. If no build mode is given on Linux, the default (Release) is used. The Visual Studio generators create build files for both modes (the selection is done at build time). -EMBB can be built with and without C++ exception handling, which has to be +EMB² can be built with and without C++ exception handling, which has to be specified on build file generation. When exceptions are turned off, an error -message is emitted and the program aborts in case of an exception within EMBB. +message is emitted and the program aborts in case of an exception within EMB². To disable exceptions, add the option -DUSE_EXCEPTIONS=OFF. -The tutorial of EMBB comes with example source files in doc/examples/. These +The tutorial of EMB² comes with example source files in doc/examples/. These can be built with the other source files using CMake option -DBUILD_EXAMPLES=ON in the generation step. Note, however, that the examples use C++11 features and require a corresponding compiler. @@ -170,8 +173,7 @@ For a Windows build (VS 2013, x86) without exception handling, type Note that "Visual Studio 12" refers to the version number of Visual Studio and not to the year in which it was released (2013). -2. Compiling and linking ------------------------- +### 2. Compiling and linking As the next step, you can compile the library using the generated build files. On Linux, the build mode (Release|Debug) is already given in the build files, @@ -185,10 +187,9 @@ For a Windows Release build, type cmake --build . --config Release -3. Running the tests --------------------- +### 3. Running the tests -To check whether EMBB was compiled correctly, run the tests. The test +To check whether EMB² was compiled correctly, run the tests. The test executables are contained in the subfolder "binaries". On Linux, type @@ -199,10 +200,9 @@ On Windows, type binaries\run_tests.bat -If no error message occurs, EMBB is working fine. +If no error message occurs, EMB² is working fine. -4. Installation ---------------- +### 4. Installation The default installation path on Linux is @@ -230,15 +230,14 @@ installation has to be run with administrator / root privileges. Using the Library -================= +----------------- -To use EMBB, the include files have to be made available during compilation of +To use EMB², the include files have to be made available during compilation of your application and the libraries have to be added during linking. -1. Using C++ ------------- +### 1. Using C++ -If you want to use the C++ functionalities of EMBB, you have to link the +If you want to use the C++ functionalities of EMB², you have to link the following libraries (names will be different on Windows and on Linux) in the given order: @@ -252,8 +251,7 @@ The C++ header files can be included as follows: #include #include -2. Using C ----------- +### 2. Using C The following libraries have to be linked in the given order: @@ -266,17 +264,17 @@ The C header files can be included as follows: Documentation -============= +------------- -EMBB comes with a tutorial, example programs, and an HTML reference +EMB² comes with a tutorial, example programs, and an HTML reference documentation describing the APIs, which can be found in the "doc" folder. The root document of the HTML reference is "doc/reference/index.html". Code Quality -============ +------------ -For the C++ parts of EMBB, we respect most rules of the "Google C++ Style +For the C++ parts of EMB², we respect most rules of the "Google C++ Style Guide" which are checked using the cpplint tool. However, we ignore some rules, as they are not applicable or yield false results for this project. For example, we respect the include order of the Google Style Guide, but use @@ -286,18 +284,26 @@ code using Cppcheck, a static analysis tool for C++. Known Bugs and Limitations -========================== +-------------------------- - The MTAPI implementation is currently limited to homogeneous systems. Support for heterogeneous systems will be added in the near future. -- For memory management reasons, the number of threads EMBB can deal with +- For memory management reasons, the number of threads EMB² can deal with is bounded by a predefined but modifiable constant (see functions embb_thread_get_max_count() / embb_thread_set_max_count() and class embb::base::Thread). +Development and Contribution +---------------------------- + +The EMB² team welcomes all kinds of contributions, preferably as pull requests +or patches via the development mailing lists (see above). If possible, please +refer to a current snapshot of the development branch. + + Links -===== +----- - Multicore Association: http://www.multicore-association.org @@ -305,7 +311,7 @@ Links http://www.multicore-association.org/workgroup/mtapi.php - CMake: http://www.cmake.org/ - - Google C++ Style Guide + - Google C++ Style Guide: http://google-styleguide.googlecode.com/svn/trunk/cppguide.html - cpplint: http://google-styleguide.googlecode.com/svn/trunk/cpplint/ diff --git a/algorithms_cpp/include/embb/algorithms/internal/for_each-inl.h b/algorithms_cpp/include/embb/algorithms/internal/for_each-inl.h index ee5cdc1..f8263ad 100644 --- a/algorithms_cpp/include/embb/algorithms/internal/for_each-inl.h +++ b/algorithms_cpp/include/embb/algorithms/internal/for_each-inl.h @@ -91,7 +91,7 @@ class ForEachFunctor { }; template -void ForEachRecurcive(RAI first, RAI last, Function unary, +void ForEachRecursive(RAI first, RAI last, Function unary, const ExecutionPolicy& policy, size_t block_size) { typedef typename std::iterator_traits::difference_type difference_type; difference_type distance = std::distance(first, last); @@ -121,7 +121,7 @@ template void ForEachIteratorCheck(RAI first, RAI last, Function unary, const ExecutionPolicy& policy, size_t block_size, std::random_access_iterator_tag) { - return ForEachRecurcive(first, last, unary, policy, block_size); + return ForEachRecursive(first, last, unary, policy, block_size); } } // namespace internal diff --git a/algorithms_cpp/include/embb/algorithms/internal/reduce-inl.h b/algorithms_cpp/include/embb/algorithms/internal/reduce-inl.h index 01a02d5..d2a8178 100644 --- a/algorithms_cpp/include/embb/algorithms/internal/reduce-inl.h +++ b/algorithms_cpp/include/embb/algorithms/internal/reduce-inl.h @@ -105,7 +105,7 @@ class ReduceFunctor { template -ReturnType ReduceRecurcive(RAI first, RAI last, ReturnType neutral, +ReturnType ReduceRecursive(RAI first, RAI last, ReturnType neutral, ReductionFunction reduction, TransformationFunction transformation, const ExecutionPolicy& policy, size_t block_size) { @@ -144,7 +144,7 @@ ReturnType ReduceIteratorCheck(RAI first, RAI last, ReductionFunction reduction, ReturnType neutral, const ExecutionPolicy& policy, size_t block_size, std::random_access_iterator_tag) { - return ReduceRecurcive(first, last, neutral, reduction, transformation, + return ReduceRecursive(first, last, neutral, reduction, transformation, policy, block_size); } diff --git a/base_c/src/core_set.c b/base_c/src/core_set.c index 81e419a..f5a3225 100644 --- a/base_c/src/core_set.c +++ b/base_c/src/core_set.c @@ -103,9 +103,9 @@ unsigned int embb_core_count_available() { #ifdef EMBB_HAS_HEADER_SYSINFO return get_nprocs(); #elif defined __FreeBSD__ - const size_t bs = sizeof(unsigned int); - char buf[bs]; - size_t len = bs; + const size_t kBufferSize = sizeof(unsigned int); + char buf[kBufferSize]; + size_t len = kBufferSize; sysctlbyname("hw.ncpu", buf, &len, NULL, 0); return *(unsigned int*)&buf; #else diff --git a/doc/images/embb.pdf b/doc/images/embb.pdf new file mode 100644 index 0000000..233e758 Binary files /dev/null and b/doc/images/embb.pdf differ diff --git a/doc/tutorial/tutorial.tex b/doc/tutorial/tutorial.tex index 97bfe71..9ee9ffa 100644 --- a/doc/tutorial/tutorial.tex +++ b/doc/tutorial/tutorial.tex @@ -15,7 +15,7 @@ \usepackage{pifont} % for \myCheck, \myCross \usepackage[hyphens]{url} \usepackage[hidelinks]{hyperref} % hyperref without colored links -%\usepackage{draftwatermark} +\usepackage{draftwatermark} \usepackage{xspace} \usepackage{pgf} \usepackage{tikz} @@ -36,7 +36,7 @@ \def\lstwidth{0.8\columnwidth} \def\embb{EMB$^\mathsf{2}$\xspace} -%\SetWatermarkColor[gray]{0.9} +\SetWatermarkColor[gray]{0.95} \newcommand{\leadingzero}[1]{\ifnum #1<10 0\the#1\else\the#1\fi} \newcommand{\monthword}[1]{\ifcase#1\or January\or February\or March\or April\or May\or June\or July\or August\or September\or October\or November\or December\fi} @@ -73,7 +73,7 @@ % Set title and author % short title is used on the front cover and on each page header -\renewcommand{\shorttitle}{\embb Tutorial (Draft)} +\renewcommand{\shorttitle}{\embb Introduction and Tutorial} % short date is printed on each page header, right next to short title \renewcommand{\shortdate}{\monthword{\month} \the\year} % copyright date is printed on the back cover @@ -81,7 +81,7 @@ % 1st paramter: a square(!) picture % 2nd parameter: short tile (one line) % 3rd parameter: long title (up to two lines) -\gentitlepage{pics/chicago-square.jpg}{\LARGE Siemens Corporate Technology | \monthword{\month} 2014}{\scalebox{0.9}{Embedded Multicore Building Blocks}\\\scalebox{0.9}{Introduction and Tutorial (Draft)}} +\gentitlepage{pics/chicago-square.jpg}{\LARGE Siemens Corporate Technology | \monthword{\month} 2014}{\scalebox{0.9}{Embedded Multicore Building Blocks}\\\scalebox{0.9}{Introduction and Tutorial}} % List the authors and contributors on the second page, right after the cover page % 1st parameter: contributors (optional)