NumCpp icon indicating copy to clipboard operation
NumCpp copied to clipboard

Question :: It could be used inside a CUDA kernel ?

Open andrewssobral opened this issue 2 years ago • 1 comments

Hi, thanks for this great library!

I was wondering if it could be used inside a CUDA kernel like Eigen?

For example:

__global__ void test_kernel(int n, float * r) {
  typedef Eigen::Matrix<thrust::complex<float>,2,2> cuMatrixXcf;

  cuMatrixXcf m;
  m << 1,0, 0,1;
  m *= threadIdx.x;

  Eigen::SelfAdjointEigenSolver< cuMatrixXcf > solver;
  solver.compute(m, Eigen::EigenvaluesOnly);

  auto const& D = solver.eigenvalues();
  
  for (int i = 0; i < n; ++i)
    r[n*threadIdx.x + i] = D(i);
}

Best regards, Andrews

andrewssobral avatar Aug 21 '22 01:08 andrewssobral

It has been several years since I last played around with any CUDA, and even then it was only little bits... With that said, I don't believe NumCpp would work in a CUDA kernel, and there has definitely been no effort in the library (if that is required, I would assume so?) to make sure that it would.

dpilger26 avatar Aug 28 '22 21:08 dpilger26

Closing due to inactivity.

dpilger26 avatar Nov 27 '22 16:11 dpilger26