Народ подскажите пожалуйста, почему в параллельной области в цикле, потоки не отрабатывают все итерации
#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <omp.h>
#define N 3
using namespace std;
int main()
{
double start_time=0, end_time=0, tick,f;
int i, j, threads;
int a[N][N];
int sum = 0;
int min;
cout << "Enter the number of threads: ";
cin >> threads;
omp_set_num_threads(threads);
cout << "A massifi\n";
srand(time(NULL));
for (i = 0; i < N; i++)
{
for (j = 0; j < N; j++) {
a[i][j] = rand() % 10+1;
cout << "A[" << i << " " << j << "] = " << a[i][j] << " ";
}
cout << endl;
}
cout << endl;
start_time = omp_get_wtime();
#pragma omp parallel private ( min )
{
min = 100;
#pragma omp for schedule ( static ) reduction (+:sum)
for (i = 0; i < N; i++)
{
for (j = 0; j < N; j++) {
if (min > a[i][j]) {
min = a[i][j];
}
printf("Thread %d done [%d ; %d]\n", omp_get_thread_num(), i, j);
}
sum = min;
}
printf("Hello i am %d thread\n", omp_get_thread_num());
}
end_time = omp_get_wtime();
f = end_time - start_time;
cout << "Time = " << f << endl;
cout << "sum=" << sum;
return 0;
}