Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

Unexpected behaviour of compiled code

$
0
0

I am having problems with Intex C++ compiler 18.0.1 and TBB.
The sample code looks like this:

#include <iostream>
#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?


Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>