【问题标题】:openacc say Segmentation fault when split big dataopenacc 在拆分大数据时说分段错误
【发布时间】:2013-04-17 20:15:18
【问题描述】:

由于我有大数据要在 GPU 中进行 malloc,我必须对其进行拆分。如下所示,将 temp1 和 temp2 从头到尾拆分一次:

for (int start = 0; start < total; start += step) {
    int end = start + step > total?total:start+step;
    fprintf(stderr, "total %ld start :%ld end :%ld\n", total, start, end);

    #pragma acc data pcopyin(sum[0:n_sample], num[0:n_sample*total], lognn[0:preFact])
    #pragma acc data copy(temp1[start*n_array1:end*n_array1], temp2[start*n_array2:end*n_array2])
    #pragma acc kernels loop independent
    for (int index = start; index < end; ++index) {
                unsigned long long * t1 = temp1 + index * n_array1;
                unsigned long long * t2 = temp2 + index * n_array2;
               // fprintf(stderr, "use %d\t", index*n_array1);
                int k = count / 32;
                int l = count / 64;
                t1[k] <<= 2;
                t2[l] <<= 1;
                int x = num[index * n_sample + i];
                int y = num[index * n_sample + j];
     }
}

但是当第一个循环完成并开始运行第二个循环时,我总是被告知分段错误。 索引 var 应该是 [0:end-start] 吗?还是应该在循环完成时进行一些同步?

谢谢!!

【问题讨论】:

  • 您使用的是什么编译器和版本?您的系统中有什么 GPU?

标签: cuda bigdata openacc


【解决方案1】:

数据子句必须为 [0:end-start]。下界和上界可以是表达式。但是,您必须确保 lower_bound

【讨论】:

  • 对不起,我忘记在 openacc 子数组中定义为 arr[start:length]。 非常感谢
  • 和..当我这样使用时,你能告诉我如何修复编译器警告:copyin(temp[starti*n_array:stepi*n_array, temp[startj*n_array:stepj*n_array]) 编译器警告是PGC-W-0155-two data clauses for array temp我使用 PGI,所以我能做什么.. ..
猜你喜欢
  • 2011-03-17
  • 2020-03-27
  • 1970-01-01
  • 2017-04-28
  • 2020-08-02
  • 1970-01-01
  • 1970-01-01
  • 2015-10-29
  • 1970-01-01
相关资源
最近更新 更多