Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2da407b4d | ||
|
|
a6b90fc9f5 | ||
|
|
1ea36d9e9d | ||
|
|
9924f9e808 | ||
|
|
b60c4d3631 | ||
|
|
0695d176ff | ||
|
|
c6045a4f6f | ||
|
|
d2405e35d1 |
@@ -0,0 +1,55 @@
|
||||
<!--
|
||||
******************************************************************************
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*******************************************************************************/-->
|
||||
|
||||
# How to Contribute
|
||||
As an open source project, we welcome community contributions to oneAPI Threading Building Blocks (oneTBB). This document explains how to participate in project conversations, log bugs and enhancement requests, and submit code patches to the project.
|
||||
|
||||
## Licensing
|
||||
|
||||
Licensing is very important to open source projects. It helps ensure the software continues to be available under the terms that the author desired. The oneTBB project uses the [Apache 2.0 License](https://github.com/oneapi-src/oneTBB/blob/master/LICENSE.txt), a permissive open source license that allows you to freely use, modify, and distribute your own products that include Apache 2.0 licensed software. By contributing to the oneTBB project, you agree to the license and copyright terms therein and release your own contributions under these terms.
|
||||
|
||||
Some imported or reused components within oneTBB use other licenses, as described in [third-party-programs.txt](https://github.com/oneapi-src/oneTBB/blob/master/third-party-programs.txt). By carefully reviewing potential contributions and enforcing a [Developer Certification of Origin (DCO)](https://developercertificate.org/) for contributed code, we can ensure that the community can develop products with oneTBB without concerns over patent or copyright issues.
|
||||
|
||||
The DCO is an attestation attached to every contribution made by every developer. In the commit message of the contribution, (described later), the developer simply adds a Signed-off-by statement and thereby agrees to the DCO.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
As a contributor, you’ll want to be familiar with the oneTBB project and the repository layout. You should also know how to use it as explained in the [oneTBB documentation](https://oneapi-src.github.io/oneTBB/) and how to set up your build development environment to configure, build, and test oneTBB as explained in the [oneTBB Build System Description](cmake/README.md).
|
||||
|
||||
## Issues
|
||||
If you face a problem, first check out open [oneTBB GitHub issues](https://github.com/oneapi-src/oneTBB/issues) to see if the issue you’d like to address is already reported. You may find users that have encountered the bug you’re finding or have similar ideas for changes or additions.
|
||||
|
||||
You can use issues to report a problem, make a feature request, or add comments on an existing issue.
|
||||
|
||||
## Pull Requests
|
||||
|
||||
You can find all [open oneTBB pull requests](https://github.com/oneapi-src/oneTBB/pulls) on GitHub.
|
||||
|
||||
No anonymous contributions are accepted. The name in the commit message Signed-of-by line and your email must match the change authorship information. Make sure your .gitconfig is set up correctly so you can use `git commit -s` for signing your patches:
|
||||
|
||||
`git config --global user.name "Taylor Developer"`
|
||||
|
||||
`git config --global user.email taylor.developer@company.com`
|
||||
|
||||
|
||||
Before contributing changes directly to the oneTBB repository:
|
||||
|
||||
* Make sure you can build the product and run all the tests with your patch.
|
||||
* For a larger feature, provide a relevant test.
|
||||
* Document your code. The oneTBB project uses reStructuredText for documentation.
|
||||
* Submit a pull request into the master branch. You can submit changes with a pull request (preferred) or by sending an email patch.
|
||||
|
||||
Continuous Integration (CI) testing is enabled for the repository. Your pull request must pass all checks before it can be merged. We will review your contribution and may provide feedback to guide you if any additional fixes or modifications are necessary. When reviewed and accepted, your pull request will be merged into our GitHub repository.
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
# Installation from Sources
|
||||
|
||||
Required Software:
|
||||
* DPC++/C++ Compiler
|
||||
* Microsoft* Visual Studio* (Windows* OS only)
|
||||
* GNU Compilers (gcc) 4.8.5–10
|
||||
* GNU C Library (glibc) version 2.17–2.32
|
||||
* Clang* 4.2–11.0
|
||||
|
||||
The project uses CMake build configuration. Make sure that you have CMake version 3.1 or higher.
|
||||
|
||||
Before installing the library, learn how to [configure, build, and test](cmake\README.md) the project.
|
||||
|
||||
NOTE: Be careful about installation. Avoid commands like `make install` unless you fully understand the consequences.
|
||||
|
||||
The following installation components are supported:
|
||||
|
||||
`runtime` - oneTBB runtime package (core shared libraries and .dll files on Windows).
|
||||
`devel` - oneTBB development package (header files, CMake integration files, library symbolic links, and .lib files on Windows).
|
||||
`tbb4py` - oneTBB Module for Python.
|
||||
|
||||
To install the specific components after configuration and build, run:
|
||||
|
||||
```bash
|
||||
cmake -DCOMPONENT=<component> [-DBUILD_TYPE=<build-type>] -P cmake_install.cmake
|
||||
```
|
||||
|
||||
Simple packaging using CPack is supported.
|
||||
The following commands allow to create a simple portable package that includes header files, libraries, and integration files for CMake:
|
||||
|
||||
```bash
|
||||
cmake <options> ..
|
||||
cpack
|
||||
```
|
||||
@@ -2,51 +2,33 @@
|
||||
[](LICENSE.txt) [](https://github.com/oneapi-src/oneTBB/actions/workflows/ci.yml?query=branch%3Amaster)
|
||||
|
||||
oneAPI Threading Building Blocks (oneTBB) lets you easily write parallel C++ programs that take
|
||||
full advantage of multicore performance, that are portable, composable and have future-proof scalability.
|
||||
full advantage of multicore performance that are portable, composable, and have future-proof scalability.
|
||||
|
||||
## Release Information
|
||||
Here are [Release Notes]( https://software.intel.com/en-us/articles/intel-oneapi-threading-building-blocks-release-notes) and
|
||||
[System Requirements](https://software.intel.com/en-us/articles/intel-oneapi-threading-building-blocks-system-requirements).
|
||||
## Installation
|
||||
You can install oneTBB from [GitHub*](https://github.com/oneapi-src/oneTBB/releases).
|
||||
See [Installation from Sources](INSTALL.md) for details.
|
||||
|
||||
## Documentation
|
||||
* [oneTBB Specification](https://spec.oneapi.com/versions/latest/elements/oneTBB/source/nested-index.html)
|
||||
* [oneTBB Developer Guide and Reference](https://software.intel.com/en-us/oneapi-tbb-documentation)
|
||||
* [Migrating from TBB to oneTBB](https://software.intel.com/content/www/us/en/develop/documentation/onetbb-documentation/top/onetbb-developer-guide/migrating-from-threading-building-blocks-tbb.html)
|
||||
* README for build system: [cmake/README.md](cmake/README.md)
|
||||
* [oneTBB Developer Guide and Reference](https://oneapi-src.github.io/oneTBB/)
|
||||
* [Migrating from TBB to oneTBB](https://oneapi-src.github.io/oneTBB/tbb_userguide/Migration_Guide.html)
|
||||
* [README for build system](cmake/README.md)
|
||||
* [Basic support for the Bazel build system](Bazel.md)
|
||||
|
||||
## Support
|
||||
Please report issues and suggestions via
|
||||
[GitHub issues](https://github.com/oneapi-src/oneTBB/issues) or start a topic on the
|
||||
[oneTBB forum](https://community.intel.com/t5/Intel-oneAPI-Threading-Building/bd-p/oneapi-threading-building-blocks).
|
||||
[GitHub issues](https://github.com/oneapi-src/oneTBB/issues).
|
||||
|
||||
## How to Contribute
|
||||
To contribute to oneTBB, please open a GitHub pull request (preferred) or send us a patch by e-mail.
|
||||
|
||||
Please use the sign-off line at the end of the patch.
|
||||
Your signature certifies that you wrote the patch or
|
||||
otherwise have the right to pass it on as an open-source patch.
|
||||
The rules are pretty simple:
|
||||
if you can certify the https://developercertificate.org then you just add a line to every git commit message:
|
||||
```
|
||||
Signed-off-by: Name Surname <user@email.com>
|
||||
```
|
||||
Use your real name (sorry, no pseudonyms or anonymous contributions).
|
||||
|
||||
If you set your `user.name` and `user.email` git configs, you can sign your
|
||||
commit automatically with `git commit -s`.
|
||||
We welcome community contributions, so check our [contributing guidelines](CONTRIBUTING.md)
|
||||
to learn more.
|
||||
|
||||
## License
|
||||
oneAPI Threading Building Blocks is licensed under [Apache License, Version 2.0](LICENSE.txt).
|
||||
By its terms, contributions submitted to the project are also done under that license.
|
||||
|
||||
## Security
|
||||
To report security issues please go to https://intel.com/security.
|
||||
|
||||
## Engineering team contacts
|
||||
* [E-mail us.](mailto:inteltbbdevelopers@intel.com)
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Intel and the Intel logo are trademarks of Intel Corporation or its subsidiaries in the U.S. and/or other countries.
|
||||
|
||||
\* Other names and brands may be claimed as the property of others.
|
||||
\* All names and brands may be claimed as the property of others.
|
||||
|
||||
+2
-1
@@ -129,7 +129,8 @@ else:
|
||||
'path_to_docs': 'doc/main',
|
||||
'use_issues_button': True,
|
||||
'use_edit_page_button': True,
|
||||
'repository_branch': 'master'
|
||||
'repository_branch': 'master',
|
||||
'extra_footer': '<p align="right"><a href="https://www.intel.com/content/www/us/en/privacy/intel-cookie-notice.html">Cookies</a></p>'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -451,8 +451,8 @@ inline auto isolate(F&& f) -> decltype(f()) {
|
||||
|
||||
//! Returns the index, aka slot number, of the calling thread in its current arena
|
||||
inline int current_thread_index() {
|
||||
int idx = r1::execution_slot(nullptr);
|
||||
return idx == -1 ? task_arena_base::not_initialized : idx;
|
||||
slot_id idx = r1::execution_slot(nullptr);
|
||||
return idx == slot_id(-1) ? task_arena_base::not_initialized : int(idx);
|
||||
}
|
||||
|
||||
#if __TBB_PREVIEW_TASK_GROUP_EXTENSIONS
|
||||
|
||||
@@ -167,6 +167,18 @@ static std::uintptr_t get_stack_base(std::size_t stack_size) {
|
||||
#endif /* USE_PTHREAD */
|
||||
}
|
||||
|
||||
#if (_WIN32||_WIN64) && !__TBB_DYNAMIC_LOAD_ENABLED
|
||||
static void register_external_thread_destructor() {
|
||||
struct thread_destructor {
|
||||
~thread_destructor() {
|
||||
governor::terminate_external_thread();
|
||||
}
|
||||
};
|
||||
// ~thread_destructor() will be call during the calling thread termination
|
||||
static thread_local thread_destructor thr_destructor;
|
||||
}
|
||||
#endif // (_WIN32||_WIN64) && !__TBB_DYNAMIC_LOAD_ENABLED
|
||||
|
||||
void governor::init_external_thread() {
|
||||
one_time_init();
|
||||
// Create new scheduler instance with arena
|
||||
@@ -192,6 +204,11 @@ void governor::init_external_thread() {
|
||||
td.my_arena_slot->occupy();
|
||||
a.my_market->add_external_thread(td);
|
||||
set_thread_data(td);
|
||||
#if (_WIN32||_WIN64) && !__TBB_DYNAMIC_LOAD_ENABLED
|
||||
// The external thread destructor is called from dllMain but it is not available with a static build.
|
||||
// Therefore, we need to register the current thread to call the destructor during thread termination.
|
||||
register_external_thread_destructor();
|
||||
#endif
|
||||
}
|
||||
|
||||
void governor::auto_terminate(void* tls) {
|
||||
|
||||
@@ -133,7 +133,7 @@ d1::slot_id __TBB_EXPORTED_FUNC execution_slot(const d1::execution_data* ed) {
|
||||
return ed_ext->task_disp->m_thread_data->my_arena_index;
|
||||
} else {
|
||||
thread_data* td = governor::get_thread_data_if_initialized();
|
||||
return td ? int(td->my_arena_index) : -1;
|
||||
return td ? td->my_arena_index : d1::slot_id(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,18 +74,6 @@ private:
|
||||
tls_key_t my_key;
|
||||
};
|
||||
|
||||
//! More advanced TLS support template class.
|
||||
/** It supports RAII and to some extent mimic __declspec(thread) variables. */
|
||||
template <typename T>
|
||||
class tls : public basic_tls<T> {
|
||||
typedef basic_tls<T> base;
|
||||
public:
|
||||
tls() { base::create(); }
|
||||
~tls() { base::destroy(); }
|
||||
T operator=(T value) { base::set(value); return value; }
|
||||
operator T() { return base::get(); }
|
||||
};
|
||||
|
||||
} // namespace r1
|
||||
} // namespace detail
|
||||
} // namespace tbb
|
||||
|
||||
@@ -25,6 +25,13 @@
|
||||
//! \file conformance_task_arena.cpp
|
||||
//! \brief Test for [scheduler.task_arena scheduler.task_scheduler_observer] specification
|
||||
|
||||
// This test requires TBB in an uninitialized state
|
||||
//! Test for uninitilized arena
|
||||
//! \brief \ref requirement \ref interface
|
||||
TEST_CASE("Test current_thread_index") {
|
||||
REQUIRE_MESSAGE((tbb::this_task_arena::current_thread_index() == tbb::task_arena::not_initialized), "TBB was initialized state");
|
||||
}
|
||||
|
||||
//! Test task arena interfaces
|
||||
//! \brief \ref requirement \ref interface
|
||||
TEST_CASE("Arena interfaces") {
|
||||
|
||||
@@ -212,3 +212,10 @@ TEST_CASE("Test concurrency getters output for constraints with custom concurren
|
||||
c.set_max_threads_per_core(1);
|
||||
check_concurrency_level(c);
|
||||
}
|
||||
|
||||
//! Testing constraints_threads_per_core() reserved entry point
|
||||
//! \brief \ref error_guessing
|
||||
TEST_CASE("Testing constraints_threads_per_core() reserved entry point") {
|
||||
tbb::task_arena::constraints c{};
|
||||
tbb::detail::r1::constraints_threads_per_core(c);
|
||||
}
|
||||
|
||||
@@ -222,6 +222,17 @@ void TestTerminationAndAutoinit(bool autoinit) {
|
||||
REQUIRE(res2);
|
||||
}
|
||||
|
||||
//! Check no reference leak for an external thread
|
||||
//! \brief \ref regression \ref error_guessing
|
||||
TEST_CASE("test decrease reference") {
|
||||
tbb::task_scheduler_handle handle = tbb::task_scheduler_handle::get();
|
||||
|
||||
std::thread thr([] { tbb::parallel_for(0, 1, [](int) {}); } );
|
||||
thr.join();
|
||||
|
||||
REQUIRE(tbb::finalize(handle, std::nothrow));
|
||||
}
|
||||
|
||||
//! Testing lifetime control conformance
|
||||
//! \brief \ref interface \ref requirement
|
||||
TEST_CASE("prolong lifetime simple") {
|
||||
|
||||
@@ -1748,9 +1748,10 @@ struct enqueue_test_helper {
|
||||
|
||||
//--------------------------------------------------//
|
||||
|
||||
// This test should be first
|
||||
// This test requires TBB in an uninitialized state
|
||||
//! \brief \ref requirement
|
||||
TEST_CASE("task_arena initialize soft limit ignoring affinity mask") {
|
||||
REQUIRE_MESSAGE((tbb::this_task_arena::current_thread_index() == tbb::task_arena::not_initialized), "TBB was initialized state");
|
||||
tbb::enumerable_thread_specific<int> ets;
|
||||
|
||||
tbb::task_arena arena(int(utils::get_platform_max_threads() * 2));
|
||||
|
||||
Reference in New Issue
Block a user