0
在使用C和OpenMP對一組數據使用並行處理時,我一直在使用for循環獲取以下錯誤。使用OpenMP時出錯:並行減少計算無效
Parallel reduction calculation is invalid!
Parallel atomic calculation is invalid!
的代碼是:
#pragma omp parallel for num_threads(numberOfThreads \
reduction(+:number_in_circle) shared(count)
for(count = 0; count < iterations; count++)
//calculate number in circle
# pragma omp parallel for num_threads(numberOfThreads) private(x, y,\
dist_sqrd) shared(count, number_in_circle, iterations)
for(count = 0; count < iterations; count++)
//calculate number_in_circle using atomic instruction to add to it.
是不是有什麼毛病我的語法還是有點毛病循環本身?