openmp slower more than one threads, can't figure out
问题 I got a problem that my following code runs slower with openmp: chunk = nx/nthreads; int i, j; for(int t = 0; t < n; t++){ #pragma omp parallel for default(shared) private(i, j) schedule(static,chunk) for(i = 1; i < nx/2+1; i++){ for(j = 1; j < nx-1; j++){ T_c[i][j] =0.25*(T_p[i-1][j] +T_p[i+1][j]+T_p[i][j-1]+T_p[i][j+1]); T_c[nx-i+1][j] = T_c[i][j]; } } copyT(T_p, T_c, nx); } print2file(T_c, nx, file); The problem is when I run more than one threads, the computational time will be much