diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d2ceaf..b4fa4ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,64 @@ Embedded Multicore Building Blocks (EMB²) ========================================= -Version 0.2.3 +Version 0.3.0 ------------- +### Features: +- mtapi_c: + - Implemented action plugin API + - Implemented load balancing for distributed/heterogeneous systems + - Implemented OpenCL action plugin + - Implemented network action plugin +- mtapi_cpp: + - Added support for distributed/heterogeneous systems + +### Changes and improvements: +- mtapi_c: + - Added multi-instance task support and test + - Improved notification of worker threads +- mtapi_cpp: + - Moved interface for homogeneous systems to tasks_cpp +- base_cpp: + - Moved tick types to internal namespace and added duration typedefs +- dataflow_cpp: + - Removed spinlocks + - Simplified registration of processes (only sources need to be added) + - Increased number of task queues in unit test + - Added assertion in unit test + - Improved exception handling + - Removed stray include + - Refactored to use tasks_cpp +- algorithms_cpp: + - Restricted partitioners to random access iterators + - Added unit tests for partitioners on large ranges + - Refactored to use tasks_cpp + ### Bug fixes: -- Fixed freeing of temporary buffer in MergeSortAllocate -- Fixed minor bugs in mtapi_c -- Fixed paths in Doxyfile.in template +- Fixed unit test for dataflow_cpp +- Fixed wait-free SPSC queue + +### Build system: +- Fixed compilation for newer CMake Versions (>= 3.1) +- Changed task test to avoid Jenkins timeout +- Changed CMakeLists to avoid error if policy is unknown +- Added mtapi_network_c and mtapi_opencl_c to root CMakeLists +- Added tasks_cpp to test scripts / batch file +- Fixed cpplint warnings + +### Documentation: +- Extended tutorial and examples regarding support for distributed/heterogeneous systems including plugins and new task interface +- Added Doxygen documentation for mtapi_opencl_c and mtapi_network_c +- Added Doxygen documentation to mtapi_ext.h +- Updated README and removed limitation to homogeneous systems +- Added missing concurrency tags in mtapi_cpp + + +Version 0.2.3 +------------- + +### Features: +- None ### Changes and improvements: - Changed use of partitioners in ForEach, Reduce, Scan, Count, and MergeSort @@ -21,8 +72,10 @@ Version 0.2.3 - Added tests for Thread::ID (base_cpp), ExecutionPolicy (mtapi_cpp), and error cases in mtapi_c - Added tests on empty and negative input ranges in algorithms -### Features: -- None +### Bug fixes: +- Fixed freeing of temporary buffer in MergeSortAllocate +- Fixed minor bugs in mtapi_c +- Fixed paths in Doxyfile.in template ### Build system: - Added option to CMake to toggle automatic initialization of MTAPI C++ interface @@ -43,17 +96,8 @@ Version 0.2.3 Version 0.2.2 ------------- -### Bug fixes: -- Fixed 64bit problem in atomics -- Fixed bug in dataflow_cpp causing network to hang -- Fixed bug in conversion of core_set -- Fixed fetch-and-add implementation to support armv7-a -- Fixed missing freeing of mutex attributes in case of error -- Fixed bug where closure was allocated with Allocation::New but deleted with operator delete -- Fixed inconsistent naming of unit test cases -- Fixed memory allocation in hazard pointer implementation by replacing calls to new and delete with EMB²-specific functions -- Fixed memory leak in tests for containers -- Fixed affinity implementation for FreeBSD +### Features: +- None ### Changes and improvements: - Added checks for memory leaks in tests @@ -66,8 +110,17 @@ Version 0.2.2 - Added assert in embb_tss_get - Moved ExecutionPolicy from algorithms to mtapi_cpp, removed Affinity -### Features: -- None +### Bug fixes: +- Fixed 64bit problem in atomics +- Fixed bug in dataflow_cpp causing network to hang +- Fixed bug in conversion of core_set +- Fixed fetch-and-add implementation to support armv7-a +- Fixed missing freeing of mutex attributes in case of error +- Fixed bug where closure was allocated with Allocation::New but deleted with operator delete +- Fixed inconsistent naming of unit test cases +- Fixed memory allocation in hazard pointer implementation by replacing calls to new and delete with EMB²-specific functions +- Fixed memory leak in tests for containers +- Fixed affinity implementation for FreeBSD ### Build system: - Removed cppcheck warnings @@ -89,14 +142,17 @@ Version 0.2.2 Version 0.2.1 ------------- +### Features: +- Added embb_core_count_available() implementation for FreeBSD. + +### Changes and improvements: +- None + ### 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. @@ -111,7 +167,7 @@ Version 0.2.1 ### Documentation: - Updated README file, created CHANGELOG file, and added markdown support. -- Corrected license in COPYING.md (BSD 2-clause). +- Corrected license in COPYING file (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. diff --git a/CMakeLists.txt b/CMakeLists.txt index 837e52c..ed453d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,8 +27,8 @@ cmake_minimum_required (VERSION 2.8.9) # Version number set (EMBB_BASE_VERSION_MAJOR 0) -set (EMBB_BASE_VERSION_MINOR 2) -set (EMBB_BASE_VERSION_PATCH 4) +set (EMBB_BASE_VERSION_MINOR 3) +set (EMBB_BASE_VERSION_PATCH 0) # Fix compilation for CMake versions >= 3.1 # diff --git a/containers_cpp/include/embb/containers/wait_free_spsc_queue.h b/containers_cpp/include/embb/containers/wait_free_spsc_queue.h index 1fabf3f..30f7235 100644 --- a/containers_cpp/include/embb/containers/wait_free_spsc_queue.h +++ b/containers_cpp/include/embb/containers/wait_free_spsc_queue.h @@ -154,7 +154,7 @@ class WaitFreeSPSCQueue { /** * Creates a queue with at least the specified capacity. * - * \memory Allocates \c 2^k elements of type \c Type, where \k is the + * \memory Allocates \c 2^k elements of type \c Type, where \c k is the * smallest number such that capacity <= 2^k holds. * * \notthreadsafe diff --git a/containers_cpp/test/queue_test-inl.h b/containers_cpp/test/queue_test-inl.h index b871965..3e63930 100644 --- a/containers_cpp/test/queue_test-inl.h +++ b/containers_cpp/test/queue_test-inl.h @@ -290,7 +290,7 @@ QueueTestSingleThreadEnqueueDequeue_ThreadMethod() { } // Oversized amount should not be larger than the original capacity PT_ASSERT_LT(oversized_count, 2 * n_queue_size); - + // Dequeue the expected amount of elements for (int i = 0; i != n_queue_size; ++i) { element_t dequ(0, -1); diff --git a/dataflow_cpp/test/dataflow_cpp_test_simple.cc b/dataflow_cpp/test/dataflow_cpp_test_simple.cc index 80450b5..78af07c 100644 --- a/dataflow_cpp/test/dataflow_cpp_test_simple.cc +++ b/dataflow_cpp/test/dataflow_cpp_test_simple.cc @@ -149,7 +149,7 @@ SimpleTest::SimpleTest() { void SimpleTest::TestBasic() { // All available cores embb::base::CoreSet core_set(true); - int num_cores = core_set.Count(); + unsigned int num_cores = core_set.Count(); embb::tasks::Node::Initialize( MTAPI_DOMAIN_ID, MTAPI_NODE_ID, @@ -160,8 +160,7 @@ void SimpleTest::TestBasic() { // with (max_queues + 1), see defect embb449 num_cores + 1, // max queues (default: 16) 1024, // queue capacity (default: 1024) - 4 // num priorities (default: 4) - ); + 4); // num priorities (default: 4) for (int ii = 0; ii < 10000; ii++) { ArraySink asink; diff --git a/doc/examples/mtapi/mtapi_c_network-fragmented.cc b/doc/examples/mtapi/mtapi_c_network-fragmented.cc index eafc07a..777e74c 100644 --- a/doc/examples/mtapi/mtapi_c_network-fragmented.cc +++ b/doc/examples/mtapi/mtapi_c_network-fragmented.cc @@ -25,10 +25,10 @@ */ #include -#include "mtapi_network_c_header-snippet.h" +#include "mtapi/mtapi_network_c_header-snippet.h" #include -#include "mtapi_check_status-snippet.h" +#include "mtapi/mtapi_check_status-snippet.h" #define NETWORK_DOMAIN 1 #define NETWORK_LOCAL_NODE 3 @@ -36,7 +36,7 @@ #define NETWORK_REMOTE_NODE 3 #define NETWORK_REMOTE_JOB 4 -#include "mtapi_network_c_action_function-snippet.h" +#include "mtapi/mtapi_network_c_action_function-snippet.h" void RunMTAPI_C_Network() { mtapi_status_t status; @@ -61,13 +61,13 @@ void RunMTAPI_C_Network() { &status); MTAPI_CHECK_STATUS(status); -#include "mtapi_network_c_plugin_initialize-snippet.h" +#include "mtapi/mtapi_network_c_plugin_initialize-snippet.h" MTAPI_CHECK_STATUS(status); -#include "mtapi_network_c_remote_action_create-snippet.h" +#include "mtapi/mtapi_network_c_remote_action_create-snippet.h" MTAPI_CHECK_STATUS(status); -#include "mtapi_network_c_local_action_create-snippet.h" +#include "mtapi/mtapi_network_c_local_action_create-snippet.h" MTAPI_CHECK_STATUS(status); job = mtapi_job_get(NETWORK_LOCAL_JOB, NETWORK_DOMAIN, &status); @@ -94,7 +94,7 @@ void RunMTAPI_C_Network() { } } -#include "mtapi_network_c_plugin_finalize-snippet.h" +#include "mtapi/mtapi_network_c_plugin_finalize-snippet.h" MTAPI_CHECK_STATUS(status); mtapi_finalize(&status); diff --git a/doc/examples/mtapi/mtapi_c_opencl-fragmented.cc b/doc/examples/mtapi/mtapi_c_opencl-fragmented.cc index 741c461..074744a 100644 --- a/doc/examples/mtapi/mtapi_c_opencl-fragmented.cc +++ b/doc/examples/mtapi/mtapi_c_opencl-fragmented.cc @@ -25,16 +25,16 @@ */ #include -#include "mtapi_opencl_c_header-snippet.h" +#include "mtapi/mtapi_opencl_c_header-snippet.h" -#include "mtapi_check_status-snippet.h" +#include "mtapi/mtapi_check_status-snippet.h" #define OPENCL_DOMAIN 1 #define OPENCL_NODE 2 #define OPENCL_JOB 2 // OpenCL Kernel Function for element by element vector addition -#include "mtapi_opencl_c_kernel-snippet.h" +#include "mtapi/mtapi_opencl_c_kernel-snippet.h" void RunMTAPI_C_OpenCL() { mtapi_status_t status; @@ -59,10 +59,10 @@ void RunMTAPI_C_OpenCL() { &status); MTAPI_CHECK_STATUS(status); -#include "mtapi_opencl_c_plugin_initialize-snippet.h" +#include "mtapi/mtapi_opencl_c_plugin_initialize-snippet.h" MTAPI_CHECK_STATUS(status); -#include "mtapi_opencl_c_action_create-snippet.h" +#include "mtapi/mtapi_opencl_c_action_create-snippet.h" MTAPI_CHECK_STATUS(status); status = MTAPI_ERR_UNKNOWN; @@ -90,7 +90,7 @@ void RunMTAPI_C_OpenCL() { } } -#include "mtapi_opencl_c_plugin_finalize-snippet.h" +#include "mtapi/mtapi_opencl_c_plugin_finalize-snippet.h" MTAPI_CHECK_STATUS(status); mtapi_finalize(&status); diff --git a/doc/examples/mtapi/mtapi_c_plugin-fragmented.cc b/doc/examples/mtapi/mtapi_c_plugin-fragmented.cc index b1918ee..b072164 100644 --- a/doc/examples/mtapi/mtapi_c_plugin-fragmented.cc +++ b/doc/examples/mtapi/mtapi_c_plugin-fragmented.cc @@ -42,15 +42,15 @@ #define PLUGIN_NODE_ID 1 #define PLUGIN_JOB_ID 1 -#include "mtapi_check_status-snippet.h" +#include "mtapi/mtapi_check_status-snippet.h" -#include "mtapi_c_plugin_task_schedule-snippet.h" +#include "mtapi/mtapi_c_plugin_task_schedule-snippet.h" -#include "mtapi_c_plugin_task_start_cb-snippet.h" +#include "mtapi/mtapi_c_plugin_task_start_cb-snippet.h" -#include "mtapi_c_plugin_task_cancel_cb-snippet.h" +#include "mtapi/mtapi_c_plugin_task_cancel_cb-snippet.h" -#include "mtapi_c_plugin_action_finalize_cb-snippet.h" +#include "mtapi/mtapi_c_plugin_action_finalize_cb-snippet.h" void RunMTAPI_C_Plugin() { mtapi_status_t status; @@ -66,13 +66,13 @@ void RunMTAPI_C_Plugin() { &status); MTAPI_CHECK_STATUS(status); -#include "mtapi_c_plugin_action_create-snippet.h" +#include "mtapi/mtapi_c_plugin_action_create-snippet.h" MTAPI_CHECK_STATUS(status); -#include "mtapi_c_plugin_get_job-snippet.h" +#include "mtapi/mtapi_c_plugin_get_job-snippet.h" MTAPI_CHECK_STATUS(status); -#include "mtapi_c_plugin_task_start-snippet.h" +#include "mtapi/mtapi_c_plugin_task_start-snippet.h" MTAPI_CHECK_STATUS(status); mtapi_task_wait(task, MTAPI_INFINITE, &status); diff --git a/doc/reference/Doxyfile.in b/doc/reference/Doxyfile.in index 76fc226..8ab6642 100644 --- a/doc/reference/Doxyfile.in +++ b/doc/reference/Doxyfile.in @@ -191,8 +191,6 @@ REFERENCES_LINK_SOURCE = YES SOURCE_TOOLTIPS = YES USE_HTAGS = NO VERBATIM_HEADERS = YES -CLANG_ASSISTED_PARSING = NO -CLANG_OPTIONS = # ============================================================================== # Options related to alphabetical class index diff --git a/doc/reference/embb.dox b/doc/reference/embb.dox index 73402be..4711e21 100644 --- a/doc/reference/embb.dox +++ b/doc/reference/embb.dox @@ -34,9 +34,9 @@ priority inversion. As another advantage in real-time systems, the algorithms and data structures give certain progress guarantees. For example, wait-free data structures guarantee system-wide progress which means that every operation completes within a finite number of steps -independently of any other concurrent operations on the same data -structure. +independently of any other concurrent operations on the same +data structure. -\image html ../images/embb.png +\image html ./images/embb.png */ diff --git a/mtapi_c/include/embb/mtapi/c/mtapi_ext.h b/mtapi_c/include/embb/mtapi/c/mtapi_ext.h index b2b4c26..54630b2 100644 --- a/mtapi_c/include/embb/mtapi/c/mtapi_ext.h +++ b/mtapi_c/include/embb/mtapi/c/mtapi_ext.h @@ -149,15 +149,23 @@ typedef void(*mtapi_ext_plugin_action_finalize_function_t)( * \ingroup C_MTAPI_EXT */ mtapi_action_hndl_t mtapi_ext_plugin_action_create( - MTAPI_IN mtapi_job_id_t job_id, + MTAPI_IN mtapi_job_id_t job_id, /**< [in] Job id */ MTAPI_IN mtapi_ext_plugin_task_start_function_t task_start_function, + /**< [in] Task start function */ MTAPI_IN mtapi_ext_plugin_task_cancel_function_t task_cancel_function, + /**< [in] Task cancel function */ MTAPI_IN mtapi_ext_plugin_action_finalize_function_t action_finalize_function, + /**< [in] Finalize action function */ MTAPI_IN void* plugin_data, + /**< [in] Pointer to plugin data */ MTAPI_IN void* node_local_data, + /**< [in] Pointer to node local data */ MTAPI_IN mtapi_size_t node_local_data_size, + /**< [in] Size of node local data */ MTAPI_IN mtapi_action_attributes_t* attributes, - MTAPI_OUT mtapi_status_t* status + /**< [out] Pointer to attributes */ + MTAPI_OUT mtapi_status_t* status/**< [out] Pointer to error code, + may be \c MTAPI_NULL */ ); diff --git a/mtapi_c/src/embb_mtapi_task_t.c b/mtapi_c/src/embb_mtapi_task_t.c index e2f47dd..ce6511b 100644 --- a/mtapi_c/src/embb_mtapi_task_t.c +++ b/mtapi_c/src/embb_mtapi_task_t.c @@ -281,8 +281,8 @@ static mtapi_task_hndl_t embb_mtapi_task_start( for (mtapi_uint_t kk = 0; kk < task->attributes.num_instances; kk++) { - was_scheduled = was_scheduled & - embb_mtapi_scheduler_schedule_task(scheduler, task, kk); + was_scheduled = (mtapi_boolean_t)(was_scheduled & + embb_mtapi_scheduler_schedule_task(scheduler, task, kk)); } } diff --git a/mtapi_cpp/include/embb/mtapi/status_exception.h b/mtapi_cpp/include/embb/mtapi/status_exception.h index a69c78a..5f1504b 100644 --- a/mtapi_cpp/include/embb/mtapi/status_exception.h +++ b/mtapi_cpp/include/embb/mtapi/status_exception.h @@ -51,7 +51,10 @@ class StatusException : public embb::base::Exception { } /** - * Returns the code of the exception. + * Code associated with this exception + * + * \returns An integer representing the code of the exception + * * \waitfree */ virtual int Code() const { return EMBB_ERROR; } diff --git a/mtapi_opencl_c/src/embb_mtapi_opencl.c b/mtapi_opencl_c/src/embb_mtapi_opencl.c index 2be0693..a4b7e19 100644 --- a/mtapi_opencl_c/src/embb_mtapi_opencl.c +++ b/mtapi_opencl_c/src/embb_mtapi_opencl.c @@ -270,7 +270,6 @@ void mtapi_opencl_plugin_initialize( NULL, NULL, &err); } if (CL_SUCCESS == err) { - size_t work_group_size; err = clGetDeviceInfo(plugin->device_id, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(size_t), &plugin->work_group_size, NULL); }