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

onetbb task Scheduler Bypass #1523

Open
sejabs opened this issue Oct 3, 2024 · 2 comments
Open

onetbb task Scheduler Bypass #1523

sejabs opened this issue Oct 3, 2024 · 2 comments
Labels

Comments

@sejabs
Copy link

sejabs commented Oct 3, 2024

Dear OneTbb developers:
In the section "Migrating from low-level task API" of oneAPI Threading Building Blocks Developer Guide and API Reference, I just followed the code to implement a simplest Scheduler Bypass.

int main() {

tbb::task_group tg;

tg.run_and_wait([&tg] {
    std::println("spawned task.");

    return tg.defer([]{std::println("other task.");});
});

tg.wait();

return 0;}

However, there is no "other task." string printed on the screen. The used onetbb is 2021.13 and built with msvc 17.11. I also noticed the last sentence in section "Task Scheduler Bypass" which said "the only way to use this optimization is to use preview feature of ``onepai::tbb::task_group`". I tried set the TBB_PREVIEW_TASK_GROUP_EXTENSIONS macro to 1 but it didn't work.

@sejabs sejabs added the question label Oct 3, 2024
@vossmjp
Copy link
Contributor

vossmjp commented Oct 3, 2024

Did you set TBB_PREVIEW_TASK_GROUP_EXTENSIONS in the source or via compiler flag? If in source, was it before including any of the TBB headers?

@sejabs
Copy link
Author

sejabs commented Oct 4, 2024

@vossmjp Thx! I put the #define sentence before any include in the test.cpp, so the problem is solved.
By the way, I hope the OneTBB Guide could be enhanced with more detailed and practical examples like the book "Pro TBB". Or Any plan to update "Pro TBB"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants