Код: Выделить всё
std::size_t size = 1024;
std::vector vec(size);
double total = 0.0;
#pragma omp parallel for simd reduction(+ : total) schedule(static)
for (std::size_t itr_x = 0; itr_x < size; ++itr_x)
{
double val = 1;
vec[itr_x] = val; // without this line `total` gives 1024 as expected
total += val;
}
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78433103/unexpected-result-from-openmp-parallel-simd-reduction-on-m1[/url]