数组的openmp并行化

时间:2015-02-23 13:04:34

标签: c arrays openmp

我正在尝试实现< a href="www.futurechips.org/tips-for-power-coders/writing-optimizing-parallel-programs-complete.html" >直方图并行化(www.futurechips.org/tips-for-power-coders/writing-optimizing-parallel-programs-complete.html)&lt; / a&gt;使用OpenMP的一个代码。我的代码片段如下:

#pragma omp parallel //shared(frame, f_end, chain) private(f, dt, d)
{
    int tid = omp_get_thread_num();
    __declspec(align(64))double p_acfRv[num_threads + 1][corr_length + 2];
    // memset(p_acfRv, 0, sizeof(double) * (corr_length + 2));

    #pragma omp for
    for(f = frame; f >= f_end; f--) {
        dt = abs(frame - f);
        for(d = 0; d < DIM; d++)
            p_acfRv[tid][dt] += (Rv[f][chain][d] * Rv[frame][chain][d]);
    }
    #pragma omp for
    for(f = frame; f >= f_end; f--) {
        dt = abs(frame - f);
        for(int t = 0; t < num_threads; t++) {
            acfRv[dt] += p_acfRv[t][dt];
        }
    }
}

当我尝试编译代码时,它显示以下错误:

error: expected ‘;’ before ‘double’ error ‘p_acfRv’ undeclared (first use in this function)

任何人都可以指出,我怎样才能摆脱这个错误。我是OpenMP世界的新手。

0 个答案:

没有答案