I am new to openmp and write some code to find out how this parallel for works
#pragma omp parallel for
for (int i=1;i<=x;++i){
for (int j=1;j<=y;++j){
if (diameter < array[i][j]){
diameter = array[i][j];
}
}
}
here are my quesiotns
1: in this struct there are total xy iterations, how many threads will the omp create to do the work? Is it xy threads OR the thread number is limited by machine resource?
2: if question 1 answer is limited by machine resource, say I can run this program on a 32-core machine, does it mean the maximum thread that can run in parallel is 32?
3: for the private and shared variable
-- 3.1 the x and y are only for read, it is necessary to set them as private?
--3.2 the diameter is concurrently read and written. if it is shared I guess it may cause some delay, but if it is private how can I get a single truth of the value