سؤال

I have to implement a function that I already have in CUDA-C using the OpenACC directives (I have to do a comparison). In the original code there's cubasSgemv call, there is some way to use cublas library under openacc?

هل كانت مفيدة؟

المحلول

Yes, you can use the host_data construct to do this. Here's an example of how to call cublasSaxpy from OpenACC:

 #pragma acc data create(x[0:n]) copyout(y[0:n])
  {
    #pragma acc kernels
    {
      for( i = 0; i < n; i++)
      {
        x[i] = 1.0f;
        y[i] = 0.0f;
      }
    }

    #pragma acc host_data use_device(x,y)
    {
      cublasSaxpy(n, 2.0, x, 1, y, 1);
    }
  }

I have other examples in an an article I wrote about OpenACC interoperability a few months ago. You can find it at http://www.pgroup.com/lit/articles/insider/v5n2a2.htm .

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top