Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/154.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ OpenACC依赖项错误_C++_Parallel Processing_Openacc - Fatal编程技术网

C++ OpenACC依赖项错误

C++ OpenACC依赖项错误,c++,parallel-processing,openacc,C++,Parallel Processing,Openacc,请告诉我这里需要帮助: void RBM::sample_v_given_h(int *h0_sample, double *mean, int *sample) { int c = 0; double r; for(int i=0; i<n_visible; i++) { mean[i] = propdown(h0_sample, i, vbias[i]); if(mean[i] &l

请告诉我这里需要帮助:

    void RBM::sample_v_given_h(int *h0_sample, double *mean, int *sample) {

          int c = 0;
          double r;

      for(int i=0; i<n_visible; i++) {
        mean[i] = propdown(h0_sample, i, vbias[i]);


          if(mean[i] < 0 || mean[i] > 1) 
           sample[i] = 0;
          else{
          r = rand() / (RAND_MAX + 1.0);
          if (r < mean[i]) c++;

        sample[i] = c;
        }
      }          
    }
或如下

   Accelerator restriction: call to 'rand' with no acc routine
当我调用具有rand()的函数时,我想我应该添加“#pragma acc routine”,但如何添加它,因为它在其他库中运行。一般来说,rand()不是线程安全的,所以即使您要用
acc routine
来修饰声明,它也可能给加速器带来麻烦。我过去所做的是为随机数分配一个数组,然后使用cuRand并行地预生成一组随机数,然后在我调用rand()的代码中使用这些随机数。我已经研究过从OpenACC打电话到设备端cuRand,但我发现这比它的价值更难做到。
   Accelerator restriction: call to 'rand' with no acc routine