Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7957 Discussions

Unexpected behaviour of compiled code

Seppo_J_
Beginner
260 Views
I am having problems with Intex C++ compiler 18.0.1 and TBB. The sample code looks like this: #include #include "tbb/tbb.h" #include "tbb/parallel_for.h" #include "tbb/blocked_range.h" __declspec(cpu_dispatch(generic, core_4th_gen_avx)) void do_stuff(){} __declspec(cpu_specific(core_4th_gen_avx)) void do_stuff() { std::cout << "in AVX2 version: "; tbb::parallel_for(0,10,[&](const unsigned int m) { if (m == 5) std::cout << "utilizing AVX2 version parallel_for\n"; }); } __declspec(cpu_specific(generic)) void do_stuff() { std::cout << "in generic version: "; tbb::parallel_for(0,10,[&](const unsigned int m) { if (m == 5) std::cout << "utilizing generic version parallel_for\n"; }); } int main() { do_stuff(); return 0; } When I run the compiled binary in Intel processor that does not support AVX2-extensions I get: 'in generic version: utilizing AVX2 version parallel_for' Is this to be expected?
0 Kudos
0 Replies
Reply